Developer

Using Localization Key in Configuration

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

You must name Extensibility-specific localizable files according to the localization.<<language code>>.xml pattern and place them in the strings directory in the ACP (See 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}" />

The library automatically assigns the associated localized texts to the UI elements and controls, as defined per your configuration.

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 Localizable.strings contains:
"PRG_NAME" = "SAP Leave Request";
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 - localizedText: API to access localized texts from both the native and the extensibility-localized string resources. You can use the NSLocalizedString macro; however, it cannot resolve the extensibility string keys.