Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could you add support for dynamic language change? #789

Open
JosefJezek opened this issue Dec 8, 2020 · 5 comments
Open

Could you add support for dynamic language change? #789

JosefJezek opened this issue Dec 8, 2020 · 5 comments

Comments

@JosefJezek
Copy link

Could you add support for dynamic language change?

ES module per language has about 200KB. :-(

esm__cs.js 205KB
esm__en.js 199KB
...

@bojeil-google
Copy link
Contributor

Hey @JosefJezek, our localization mechanism generates a new binary per language. This works by importing a specific binary based on a specific language (you shouldn't import all languages at the same time). You should be able to build your own language change mechanism based on that, for example, you could have the language in the url path and based on the path always import the specific localized binary.
Even if we support dynamic languages change, it is unlikely we will bundle all the translations into one binary (there are a lot of languages that we support). A server round trip will still likely be required.

@JosefJezek
Copy link
Author

Could you create a base module + small modules per language?

@landsman
Copy link

Could you create a base module + small modules per language?

Exactly, this can be dynamically loaded after the user selects the language.
Good inspiration: https://lingui.js.org/guides/dynamic-loading-catalogs.html#final-i18n-loader-helper

@landsman
Copy link

Okay, now I realized how this is made 🥵 :
firebase/firebaseui-web-react#21 (comment)

@landsman
Copy link

landsman commented Dec 7, 2021

Related with #662.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants