-
Hello! 👋 I have a specific problem and I am looking for some advice. I have a language switcher in my application and I'd like to translate it in the "resulting" language (not in the language of the current page but in the language of the country we are switching to). For example, we are on MX page which is in Spanish and I'd like to have there this button (which is in english): Similarly, when we are on US page which is in English, I'd like to have there this Spanish button: It's because when a user lands on a page, I'd like to help them switch the language using a text they know. My questions are:
Thanks! 🙂 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You essentially want to "fetch" the appropriate translation for your given instance based on the locale itself.
https://github.com/facebook/fbt/blob/master/runtime/nonfb/fbtInit.js#L39 |
Beta Was this translation helpful? Give feedback.
You essentially want to "fetch" the appropriate translation for your given instance based on the locale itself.
fbt
is really optimized for one language/locale on the entire page and pulls the locale from the one set globally onIntlViewerContext
. Today, you could overridegetTranslatedInput
with the initialization function (init
).https://github.com/facebook/fbt/blob/master/runtime/nonfb/fbtInit.js#L39