BF.i18n()
You can use this functionality to set up multiple languages for your app. i18n
is short form internationalization. This function allows easy support for the integration of multiple languages.
Step 1: Define Languages in Your App Model
In App Model, define your dictionary with keys and values as following example:
langDefault
sets the default fallback language if a translation is not available
langSelected
Selects the active language
This can be set or changed with UI or set in onAppLoad action
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
the BF.i18n()
function can be used in both HTML and in calculations.
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
Was this helpful?