Provides locale-specific translations for words and phrases.
Installation
npminstall@xeokit/sdk
Usage
The example below demonstrates how to create a LocaleService instance
with English, Māori, and French translations for a NavCube widget.
The LocaleService provides translations for:
"NavCube.front"
"NavCube.back"
"NavCube.top"
"NavCube.bottom"
"NavCube.left"
"NavCube.right"
These terms act as keys that map to translations based on the active locale.
For example, if the locale is set to "fr", "NavCube.back" resolves to "Arrière".
xeokit Localization Service
Provides locale-specific translations for words and phrases.
Installation
Usage
The example below demonstrates how to create a LocaleService instance with English, Māori, and French translations for a NavCube widget.
The
LocaleService
provides translations for:"NavCube.front"
"NavCube.back"
"NavCube.top"
"NavCube.bottom"
"NavCube.left"
"NavCube.right"
These terms act as keys that map to translations based on the active locale. For example, if the locale is set to
"fr"
,"NavCube.back"
resolves to"Arrière"
.Switching Locales Dynamically
Loading New Translations
Clearing Translations
Listening for Locale Changes
The
LocaleService
emits an event when the locale changes or new messages are loaded. This can be useful for refreshing UI elements dynamically.