Skip to end of metadata
Go to start of metadata

If you have users who speak different languages, you don't have to build multiple apps. This guide explains how one app can use your translation library along with properly named string files to provide multiple language experiences.


Language Files

Your app can include multiple language/locale-based string files. Each file should be included in your file and must be named in this way:



Each file exports a 'keys' object of key-value pairs that are a language key and a language string. The values are mapped to arrays, which can (optionally) contain singular and pluralized versions of the string. For example:

Using the Language APIs

In your application, when you want to display a string, do not put the language string in the app. Instead, pass the language key to the translator. The phone uses the correct file, finds the string, and displays it to the user.

The phone's chosen localization setting determines which language file the phone uses. However, if the does not include a language file for the chosen language, the phone uses the en_us language file or whichever you have indicated by the defaultLangLocale parameter you use when you initialize the app (app.init).

Using app.t is the prefered way to utilize translation. 

However, you can create your own Language object and use its translate method.

  • No labels