We just pushed an update to how Bubble handles application languages, which makes handling more than one language much easier.
We added a few things:
You can define a field on the user type that contains the language to apply to the user in the Settings Tab -> Languages. The field should be of type ‘text’ and should contain a value that is part of the list in the languages dropdown (english, french, greek, etc.).
You can access the “current language” in the dropdown, as one of the App Data (like Website home, admin email, etc.). You can use this information in the conditional tab to change the text of some elements, for instance
Elements that are localization sensitive will get adjusted automatically (calendar, date input, map, autocomplete for addresses, etc.). A refresh might be needed as some texts are added service-side.
To change the current user’s language, you just need to modify the value of the field. Again, note that you’ll need to refresh the page for most stuff, as the choice of language is done server-side for performance.
You can overwrite the language in the app URL if you want it to be in a given language. The way you’d do it is for instance by doing
The way the Current Language is defined as, by order of priority
a) if a “lang” parameter in the URL is set, use this
b) if the current user has a value in the relevant field, use this
c) Use the app primary language
Be careful on the value you save (or that you put in the URL), it has to match one of the languages in the dropdown. Something like ‘American english’ won’t be applied as it’s not ‘english’, and so we’ll use the next item on the list in 6).
And if some languages are missing, as usual, reach out, we’d love to have more!
Awesome! I’ll start testing right away!
Thanks for this new feature, but multi language with same date format is not pleasant.
Please add “date format” available in tab “conditional” for Text & DateInput.
Awesome! Thanks a lot, should be very useful.
Has any of you implemented this new feature?
Do you have maybe a public app that you can share? It would be really nice to see how it works. I could not manage to implement it yet
@emmanuel How do you change the language if user is logged out?
You can use a lang parameter in the URL (or actually modify the current user’s field, even if the user is logged out, a temp user exists and can be used).
thanks. i observed that i just need to refresh the page, then it works
How does this play together with the localizejs plugin? If I set the language through the page URL, does localizejs pick that up? (I tried but could not make it work)
Or does it only affect localization-sensitive Bubble components?
This is not related to localize (core features are never related to plugins). But you can use the current app language and use it to call localize
Yes, I see. It would be nice if those two would match, though. Localizejs detects the browser language which is nice because the user in most cases doesn’t have to do anything. If Bubble could do the same, it would be perfect. If the user then decided to switch language, that could be handled in Bubble by storing the user’s preferred language and passing that to Localizejs.
This is very great !
Could be useful to have a way to filter on the elements that have some language sensitive logic: Let’s say some day, a new language has to be supported, it would be very handy to access easily the list of elements that need to be updated.
Or the platinum version: to have a dictionary of texts in several language that could be called, like in the setting tab. this this could come later I guess
Is there a way to handle user language preference for the alerts ?
You mean the native messages (like ‘passwords don’t match’, etc.)?
If so, you can do what is described at the top of the thread, that’s what the feature is about.