LinkedIn
Copied!

Table of Contents

Configuring localization for offline-enabled mobile apps

Version:

Only available versions of this content are shown in the dropdown
Applicable to Theme Cosmos applications

Configure localization in your offline-enabled mobile app to give users a consistent experience regardless of network connection status, and enable them to change languages within the app at run time without losing data.

For example, when surveying individuals who speak different languages, survey takers can easily switch languages by selecting a language option in the language list of the offline-enabled app.
  • Define the languages that your users speak and find out which language packs are in your system. To acquire language packs, contact Global Client Support.
  • Install the language packs that you need. For more information, see Installing Pega language packs.
  • Localize your application for the languages that you need. For more information, see Internationalization and localization.

By default, when you configure offline localization for your app, the system packages and makes available offline only those field values and paragraphs that the UI directly references. The system also packages field values with parameters.

Auto-generated controls also support offline localization. For more information, see Creating auto-generated custom controls.

  1. In the header of Dev Studio, click Configure Mobile Offline configuration .

  2. On the Offline configuration tab, in the Configuration template section, click the template that you want to use with your offline-enabled mobile app.

  3. On the Resources tab, add the locales that you want to support in offline mode:

    1. In the Locales section, click Add locale.

    2. In the dialog box, enter the names of the locales that you want to add, and then click Add.

    You can add multiple locales by adding the ISO codes for standard languages and dialects. For example, you can add de_DE for German, es_ES for Spanish, and zh_CN for simplified Chinese.
  4. In the upper-right corner of the offline configuration template form, click Save.

  5. Decide how you want users to switch locales at run time, and based on your choice, add a button, a link, or a drop-down list to your section.

    For more information, see Adding controls.
  6. Configure the following action sets for your control:

    For more information about configuring action sets for a control, see Adding action sets to a control.

    1. In the action set table, click Add an event, and then based on your choice of control, define the event:

      • For a Button or Link control, select Click.
      • For a Dropdown control, select Change.
    2. Click Add an action, and then select the Run script action.

    3. In the Function name field, enter the switchLocale function to run the provided API.

      The pega.clientTools.switchLocale(newLocale) API works only for cases that are marked as offline-enabled.
    4. In the Parameters table, define a parameter name and value. For example, enter Locale and de_DE.

    5. Configure the Refresh-Other section action set.

      For more information, see Adding action sets to a control.
    6. Click Submit.

  7. Optional:

    To package and make available offline field values that are no UI section directly references, for example, the case status, or to package field values that are dynamically resolved (through a property reference), add these field values to the allow list by performing the following actions:

    1. On the Allow list tab, click Add field values.

    2. Populate the auto-complete field with the field values that the UI does not directly references but which you want to include in packaging, and then click Add.

      To package the ButtonLabel Add Item field value, which is used in a section from the Work- class, select the AddItem field value from the list.
    3. If multiple classes reference a field value, click Add field values with multiple runtime class.

    4. Populate the Field Value auto-complete field with the field value.

    5. In the Run time classes list, select the classes that reference the field value, and then click Add.

      For the ActionPrompt Delete item field value, which you access from the section in the Work- and Work-Cover classes, make the following entries:

      @BASECLASS!PYACTIONPROMPT!DELETE ITEM"Work-"

      @BASECLASS!PYACTIONPROMPT!DELETE ITEM"Work-Cover"

    The field values for all the locales that the template configuration includes are downloaded to the client store when the mobile app performs a full synchronization. For more information, see Data synchronization in offline mode.
Did you find this content helpful?

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.