[Update] Config Window: MessageFormat. Add translated message to the example display, language flexibly.

This commit is contained in:
Sakamoto Shiina
2024-08-06 08:27:24 +09:00
parent eb38d6a2b1
commit 352222f49d
2 changed files with 14 additions and 3 deletions

View File

@@ -8,7 +8,7 @@ export const MessageFormat = (props) => {
<ExampleComponent {...props}/> <ExampleComponent {...props}/>
<InputComponent {...props}/> <InputComponent {...props}/>
{ {
props.with_t props.with_t === true
? <SwapButton/> ? <SwapButton/>
: null : null
} }
@@ -16,11 +16,22 @@ export const MessageFormat = (props) => {
); );
}; };
import { useUiLanguageStatus } from "@store";
const ExampleComponent = (props) => { const ExampleComponent = (props) => {
const { t } = useTranslation(); const { t } = useTranslation();
const { currentUiLanguageStatus } = useUiLanguageStatus();
const createExampleMessage = () => { const createExampleMessage = () => {
return t("config_window.send_message_format.example_text"); const original_lang_message = t("config_window.send_message_format.example_text");
if (props.with_t === true) {
const translation_locale = currentUiLanguageStatus === "en" ? "ja" : "en";
const translated_lang_message = t("config_window.send_message_format.example_text", {lng: translation_locale});
return original_lang_message + translated_lang_message;
} else {
return original_lang_message;
}
}; };
return ( return (

View File

@@ -28,7 +28,7 @@
.preset_text { .preset_text {
font-size: 1.6rem; font-size: 1.6rem;
width: 100%; width: 40rem;
text-align: center; text-align: center;
} }