Constructs a LocaleService.
LocaleService configuration
Optional
locale?: stringInitial locale
Optional
messages?: anySet of locale translations
Gets the current locale.
The current locale.
Sets the current locale.
The new current locale.
Gets the list of available locales.
These are derived from the currently configured set of translations.
The list of available locales.
Replaces the current set of locale translations.
viewer.localeService.setMessages({
messages: {
"en": { // English
"NavCube": {
"front": "Front",
"back": "Back",
"top": "Top",
"bottom": "Bottom",
"left": "Left",
"right": "Right"
}
},
"mi": { // Māori
"NavCube": {
"front": "Mua",
"back": "Tuarā",
"top": "Runga",
"bottom": "Raro",
"left": "Mauī",
"right": "Tika"
}
}
}
});
The new translations.
Clears all locale translations.
Loads a new set of locale translations, adding them to the existing translations.
viewer.localeService.loadMessages({
"jp": { // Japanese
"NavCube": {
"front": "前部",
"back": "裏",
"top": "上",
"bottom": "底",
"left": "左",
"right": "右"
}
}
});
The new translations.
Translates the given phrase according to the current locale.
Returns null if no translation can be found.
Phrase to translate.
The plural number.
Optional
args: anyExtra parameters.
String|null Translated string if found, else null.
The localization service for a Viewer.
See @xeokit/sdk/locale for usage.