MindSphere Web Components
Internationalization
MindSphere Web Components support different locales via the locale
property. They provide the locales en
and de
by default and allow developers to add or modify locales using the localeManager
.
The localeManager
provides the following methods for reading, overwriting or defining new i18n texts of MindSphere Web Components:
Member | Description |
---|---|
getLocaleSettings(): any | Returns the locale settings of the component. Use this method to determine translatable texts and check the current locale settings of the component. |
addLocale(LocaleName: string, settings: any) | Defines a new locale and provides an object with translated texts. |
Info
The locale attribute is available for all MindSphere Web Components, but some components (e.g. Map) do not contain any translatable texts.
Snippets¶
Change the default locales¶
// displays the component in German
ruleComp.locale = "de";
// displays the component in English
ruleComp.locale = "en";
Create a new locale¶
In the following example a new locale fr
is defined for the asset view and the search
text is overwritten in French.
// check the locale setting of the component
var currentLocale = assetViewComp.localeManager.getLocaleSettings();
// replace the text for "search" with the french word
var frLocale = { search: "recherche" };
// create a new locale "fr" with the updated translation
assetViewComp.localeManager.addLocale("fr", frLocale);
// change the view to the new locale
assetViewComp.locale = "fr";
Any questions left?
Except where otherwise noted, content on this site is licensed under the Development License Agreement.
Last update: November 22, 2021