2025-04-12- translation: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 3: | Line 3: | ||
===MyTranslation=== | ===MyTranslation=== | ||
*send reference word to i18n for output translated word follow by current using language | *send reference word to i18n for output translated word follow by current using language | ||
format | |||
<syntaxhighlight lang="Javascript"> | <syntaxhighlight lang="Javascript"> | ||
{MyTranslation("greeting")} | {MyTranslation("greeting")} | ||
</syntaxhighlight> | |||
===changeLanguage=== | |||
*set new language | |||
example | |||
<syntaxhighlight lang="Javascript"> | |||
changeLanguage("jp"); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 05:05, 15 April 2025
Translation Microfrontend
function
MyTranslation
- send reference word to i18n for output translated word follow by current using language
format
{MyTranslation("greeting")}
changeLanguage
- set new language
example
changeLanguage("jp");
S3
- Store translations of each language in their respective directory.
S3 tree
/translations-language
/locales
/{language_name}
-{namespace_name}.json
.json file
- key = reference word
- value = translated word
{
"greeting": "Hello",
"text": "Thank you for visiting our website.",
"language": "Language",
"Hi": "What's up",
"Hello": "greeting from translation"
}
Object link
- format
"https://translations-language.s3.us-east-2.amazonaws.com/locales/Template:Lng/Template:Ns.json"
- example
"https://translations-language.s3.us-east-2.amazonaws.com/locales/en/buying.json"