Skip to content

Localisation support

rarrouba edited this page Jul 27, 2017 · 4 revisions

Usage

Under the mobile/src/main/java/res/values/strings.xml folder you will find a strings resource file. This file contains tags and are identified by a name. To have support for other languages another folder needs to be created mobile/src/main/java/res/values-b+ln+cn/strings.xml where 'ln' is the language code and 'cn' is the country code. So for Belgium and Dutch it looks like this: '.../values-b+nl+BE/strings.xml'. If someone wants to add support for different languages they can do this using this syntax.

Here is an example:

<string name="preferences">Preferences: </string>.

Layout resources and other files and classes use these string resources by referencing the "name" of the string tag in the specific text value.

Here is an example of a string resource reference inside a layout resource file:

android:text="@string/preferences"

The @string references to the string resource file and the "preferences" references to the "name" that identifies a string tag.

Back in the string resource folder you will find another string resource file but here, the string values are in Dutch:

<string name="preferences">Voorkeuren: </string>

NOTE: Make sure the "name" identification is the same in both string resource files.

On startup, the application will choose which string resource file to use based on your system language settings.

Clone this wiki locally