Localization
Most of the strings specified in presentation rules and visible to the end user can be localized.
The library uses a simplified i18next JSON format - it only supports simple key-value pairs (including nesting) without plurals or interpolation.
Localization happens on the frontend. In the case of only using the backend, you must provide a localization function PresentationManagerProps.getLocalizedString when initializing the presentation backend. The localization function should translate:
List of translatable strings
- @RulesEngine:LABEL_General_NotSpecified@,
- @RulesEngine:LABEL_General_Other@,
- @RulesEngine:LABEL_General_Varies@,
- @RulesEngine:LABEL_General_MultipleInstances@,
- @ECPresentation:FIELD_LABEL_DisplayLabel@,
- @ECPresentation:CATEGORY_LABEL_SelectedItems@,
- @ECPresentation:CATEGORY_DESCRIPTION_SelectedItems@,
function getLocalizedStringExample(key: string) {
// implementation...
}
const presentationBackendProps: PresentationProps = {
getLocalizedString: (key) => getLocalizedStringExample(key),
};
Presentation.initialize(presentationBackendProps);
Localization in presentation rulesets
The strings in presentation rule sets can be localized by using the following
format: @LocalizationNamespace:StringId@
. Additionally, you can use multiple
localized pieces in one string, e.g. Concat_@Namespace:String1@_and_@Namespace:String2@
.
Last Updated: 30 November, 2023