firebase / firebaseui-web

FirebaseUI is an open-source JavaScript library for Web that provides simple, customizable UI bindings on top of Firebase SDKs to eliminate boilerplate code and promote best practices.
https://firebase.google.com/
Apache License 2.0
4.58k stars 1.06k forks source link

Could you add support for dynamic language change? #789

Open JosefJezek opened 3 years ago

JosefJezek commented 3 years ago

Could you add support for dynamic language change?

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

esmcs.js 205KB esmen.js 199KB ...

bojeil-google commented 3 years ago

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 commented 3 years ago

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

landsman commented 3 years ago

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 commented 3 years ago

Okay, now I realized how this is made 🥵 : https://github.com/firebase/firebaseui-web-react/issues/21#issuecomment-887456061

landsman commented 2 years ago

Related with #662.