Forum Academy Marketplace Showcase Pricing Features

Language: Any trick to run javascript before loading App Text?

My question:
Anyone has an idea how to (1) either execute a javascript expression (very simple) and user data field change before App Texts are loaded, or (2) how to reload App Text’s without a complete page refresh?

We use 2 languages (might grow into more) for website and application on Bubble.

To do this we use a language setting field on the user (works perfectly so far - even for users that are not logged in) and App Text’s to define all standard texts (e.g. buttons, menu, etc) in both languages (works great too, really like the feature).

Now if somebody comes to the page for the first time we have no language setting in the user thing. Here we use a super simple javascript expression (utilizing the Toolbox plugin from @mishav - thank you for that btw. it is a repeat life saver) to identify whether the browser language selection fits to any language we offer.

This works very well again, albeit with one big caveat: the javascript is executed after the App Text elements have loaded. So when changing the language it is immediately applied to all content or conditions defined in the screen (perfect) but not to the App Text (which would be their main job kinda).

What is the pain
We have to either force a page reload (ugly user experience, also negatively impacting page statistics) or avoid app texts and rebuild everything (lot’s of work) with dynamic content (not so ideal for performance & data cleanness) or hard-coded conditions (near impossible to manage in the long run).

Any tricks or ideas greatly appreciated.
Many thanks!

hey, have you checked out localize.js?

There is a bubble plugin and it’s pretty awesome for changing text without refreshing the page. However, there is 1 drawback in that elements can’t resize, i.e if your translated text is longer than the text when the page loaded you can get overlapping elements. But could be useful for what you’re trying to do.

Bubble have said the overlapping issue may be improved in the future when the new responsive engine comes out.

Thanks @andy.i

I have not tried this plugin yet, will investigate. The drawback you mention is an issue as we have texts of varying sizes and translations vary by as much as 30% in text length.