src/tools/localization.service.ts
Service which is wrapping the configuration logic of TranslateService from ngx-translate Any application willing to use localization just needs to inject LocalizationService in the root component and call its configure() method.
Properties |
|
Methods |
|
Accessors |
constructor(translateService: TranslateService, logger: LoggerService, configuration: LocalizationConfiguration, store?: Store<LocalizationOverrideStore>)
|
|||||||||||||||
Parameters :
|
Public configure |
configure()
|
Configures TranslateService and registers locales. This method is called from the application level.
Returns :
void
|
Public getCurrentLanguage |
getCurrentLanguage()
|
Wrapper to get the ngx-translate service TranslateService currentLang.
Returns :
any
|
Public getKey | ||||||||
getKey(requestedKey: string)
|
||||||||
Get an observable of translation key after global mapping
Parameters :
Returns :
any
|
Public getLanguages |
getLanguages()
|
Wrapper to call the ngx-translate service TranslateService method getLangs().
Returns :
any
|
Public getTranslateService |
getTranslateService()
|
Get the instance of the ngx-translate TranslateService used by LocalizationService.
Returns :
TranslateService
|
Public isTranslationDeactivationEnabled |
isTranslationDeactivationEnabled()
|
Is the translation deactivation enabled
Returns :
any
|
Public toggleShowKeys | ||||||||
toggleShowKeys(value?: boolean)
|
||||||||
Toggle the ShowKeys mode between active and inactive.
Parameters :
Returns :
void
|
Public translate | ||||||||||||
translate(key: string, interpolateParams?: object)
|
||||||||||||
Returns a stream of translated values of a key which updates whenever the language changes.
Parameters :
Returns :
any
A stream of the translated key |
Public useLanguage | ||||||
useLanguage(language: string)
|
||||||
Wrapper to call the ngx-translate service TranslateService method use(language).
Parameters :
Returns :
Observable<any>
|
Public showKeys$ |
Default value : this._showKeys$.asObservable()
|
_showKeys$ exposed as an Observable |
showKeys |
getshowKeys()
|
Return the current value of debug show/hide translation keys. |