Issue
When the operator locale is changed, for example to fr_FR, the offline harness configured with the "Always display harness from server" option does not display the correct localized labels in the UI. Although translations are correctly configured and work as expected in online runtime, offline mode does not pick up the updated localized values.
Symptoms and Impact
After the operator locale is changed, for example from en_US to fr_FR, the offline harness configured with "Always display harness from server" turned off continues to display labels, field values, and UI text in the default language instead of the selected locale.
Steps to reproduce
- Set up localization
- Configure field value rules with translations for the target locale (for example, fr_FR) for all labels and UI text used in the harness.
- Configure the offline harness
- Navigate to the harness rule that will be used for offline mode.
- Enable the "Always display harness from server" option on the harness configuration.
- Set the operator locale
- Change the operator's locale to the target language (for example, fr_FR) via the operator profile or localization settings.
- Launch the application and login with operator
Root Cause
The root cause is that offline processing requires all relevant UI and field value rules to be explicitly packaged into the offline configuration. Problems occur when pxObjClass is not packaged for pyDisplayHarness.
Solution
To resolve the localization issue in offline mode, you need to add the affected field values to the offline configuration's Allow List with the runtime class set to @baseclass. This ensures the offline framework can resolve localized labels at runtime.
Update the offline configuration to set the field label to the baseclass at runtime. This allows the offline framework to correctly resolve and display the localized labels based on the operator's locale, rather than defaulting to the original language.
Perform the following steps to resolve the issue:
- Open the Offline Configuration rule
- Navigate to your application's Offline Configuration rule (e.g., Offline Configuration: Custom).
- Go to the Allow List tab Select the Allow list tab at the top of the configuration.
- Select Field Values from the left navigation
- In the left-side menu, select Field values.
- Select the correct radio option
- Under the Field values section, select the "Add field values with multiple runtime class" radio button.
- Add each affected field value
- For each label that does not display the correct localization in offline mode: In the Field Value field, enter the field value reference using the format:
@BASECLASS!<FIELD_NAME>!<LABEL_VALUE>
For example:
@BASECLASS!PYBUTTONLABEL!SUBMIT
@BASECLASS!PYBUTTONLABEL!BUTTON
@BASECLASS!PYCAPTION!CUSTOMCAPTION
- In the Run time classes dropdown, select @baseclass.
- Select Add to add the entry to the list.
- For each label that does not display the correct localization in offline mode: In the Field Value field, enter the field value reference using the format:
- Repeat for all affected labels
- Continue adding entries for every field value / label that requires localization in offline mode.
- Save the configuration
- Rebuild the mobile application