Developer

Using Localization Key in Configuration

When you create Extensibility-specific localizable files, you must use a naming convention.

Name the files according to the localization.<<language code>>.xml pattern, and place them in the strings directory in the ACP (See the Mobile Application Workbench documentation for the structure of the Application Configuration Profile).

Here are several examples of localized Extensibility XMLs:

localization.en.xml
<?xml version="1.0" encoding="utf-8"?>
<Texts>
    <Text id="PRG_NAME" value="SAP Leave Request Demo" />
    <Text id="WELCOME" value="Welcome Demo" />
    <Text id="DEMO_DESCRIPTION" value="Try out the app without logging in." />
    <Text id="ACTIVATE_AND_LOGON" value="Activate and Logon" />
    <Text id="DEMO_MODE" value="View Sample Data" /> 
</Texts>
localization.de.xml
<?xml version="1.0" encoding="utf-8"?>
<Texts>
    <Text id="PRG_NAME" value="SAP Leave Request Demo" />
    <Text id="WELCOME" value="Willkommen Demo" />
    <Text id="DEMO_DESCRIPTION" value="App mit Demo-Server ausprobieren" />
    <Text id="ACTIVATE_AND_LOGON" value="Bitte loggen Sie sich ein" />
    <Text id="DEMO_MODE" value=" Demo-Modus starten" /> 
</Texts>
In the layout configuration, you can refer to a localized string using $_i18n.<key> syntax:
<Tile tileId="LeaveRequestList">
<P pid="title" value="{$_i18n.PRG_NAME}" />

Keys in the Extensibility localization file override any matching keys that are defined in the native Localizable.strings resource. This allows you to customize native localized strings.

For example, if the strings.xml contains:
 <string name=“PRG_NAME”>SAP Leave Request</string> 
and the Extensibility-specific localization.<language_code>.xml has this entry:
<Texts>
    <Text id="PRG_NAME" value="Vodafone Leave Request " />
   ...
</Texts>
at runtime, the framework uses "Vodafone Leave Request".

You can use the MAFCore.getLocalizedText API to access localized texts from both the native and the extensibility-localized string resources.