SiNoTranslateService documentation¶
provided in root
✓
Pass through implementation of the SiTranslateService which is used as a default.
Attributes and Methods¶
Name | Type | Default | Description |
---|---|---|---|
availableLanguages ¶ | string [] | The available languages. | |
(readonly) currentLanguage ¶ | string | The currently used language. | |
getDefaultLanguage() ¶ | () => string | The language to be used as default. Returns The code of the default language. | |
prevent$LocalizeInit | boolean | ||
setCurrentLanguage(...) ¶ | (lang: string ) => Observable <void > | Sets a new language to be used. If needed, loads the language file. Returns An observable that emits when the new language is loaded and activated. Parameters
| |
setDefaultLanguage(...) ¶ | (lang: string ) => void | The language to be used as default. Parameters
| |
setDocumentLanguage(...) ¶ | (lang: string ) => void | Parameters
| |
setTranslation(...) | (key: string , value: string ) => void | If supported by the underlying translation library, this method can be used to add a translation for a specific key. It is intended to be used for adding the english default value. It will be called whenever a key within element is resolved. An implementation of this method must check that it does not override an existing translation. Parameters | |
translate(...) ¶ | <(T: (string | string []))> (keys: T , _params: Record <string , unknown >) => TranslationResult <T > | Translates the key(s) by using the underlying translation library. Returns Returns the translated key or an object with the translated keys. Depending on the underlying translation library (sync/async) the result will be wrapped in an Observable. Parameters | |
translateAsync(...) ¶ | <(T: (string | string []))> (keys: T , params: Record <string , unknown >) => Observable <TranslationResult <T >> | Translates the key(s) by using the underlying translation library in an asynchronous manner. It will emit each time the active language is changed. Returns Returns the translated key or an object with the translated keys wrapped in an Observable. Parameters | |
translateSync(...) ¶ | <(T: (string | string []))> (keys: T , params: Record <string , unknown >) => TranslationResult <T > | Translates the key(s) by using the underlying translation library in a synchronous manner. Warning: The caller of this function needs to make sure the translation file(s) are already loaded. It is generally not recommended to use this function unless you know exactly what you are doing. Returns Returns the translated key or an object with the translated keys. Parameters | |
(readonly) translationChange ¶ | Observable <void > | If the underlying translation library supports switching the language and/or updating the translation texts, this observable will emit. There is no initial emit. |
Types Documentation¶
Function |
---|
Wrapper around an actual translation framework which is meant to be used internally by Element. Applications must not use this service. Use injectSiTranslateService to get an instance of the translation service. | |||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||
|
Except where otherwise noted, content on this site is licensed under MIT License.