BF.i18n()
You can use this functionality to set up multiple languages for your app.
Step 1: Define Languages in Your App Model
In App Model, define your dictionary with keys and values as following example:
You can also have a key to cache the user selection in App model and check it in App Key Caching
.
Step 2: Add Translatable Text in Your HTML
In your HTML block, add the text using BF.i18n()
with the corresponding keys:
Step 3: Set Language Through the App
Set the language in your global scripts global scripts onAppLoad
.
Step 4: Add Function to Handle User Selection
In your global script, create a JavaScript function like selectLanguage
to handle user select.
In your page, use the following to call selectLanguage
and highlight the current selection:
This setup allows your app to support multiple languages, enhancing user experience by displaying content in their preferred language.
Last updated