[Update] Config Window: MessageFormat. Add translated message to the example display, language flexibly.
This commit is contained in:
@@ -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 (
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user