File

core/i18n/translate.service.ts

Description

A service to manage the language of the application.

Index

Properties
Methods

Constructor

constructor(ngxTranslate: NgxTranslateService, ui: AppStateService, options: OptionsService)
Parameters :
Name Type Optional
ngxTranslate NgxTranslateService No
ui AppStateService No
options OptionsService No

Methods

convertToLanguageCodePO
convertToLanguageCodePO(lang: string)

Converts a iso language code to a PO language code (e.g. de-de gets de_de).

Parameters :
Name Type Optional Description
lang string No

The iso language code.

Returns : string
Static defaultLang
defaultLang()
Returns : any
firstSupportedLanguage
firstSupportedLanguage()

Finds the first supported language

Returns : any
getNativeLanguage
getNativeLanguage(lang: string)

Returns the language in the native language.

Parameters :
Name Type Optional Description
lang string No

The language two-letter code.

Returns : string

The native name.

getSupported
getSupported(lang: string)
Parameters :
Name Type Optional
lang string No
Returns : any
Async loadLocales
loadLocales(moduleLang)
Parameters :
Name Optional
moduleLang No
Returns : any
queryStringLang
queryStringLang()

Gets the language from the query parameter.

Returns : any

The language two-letter code.

saveInLocalStorage
saveInLocalStorage(lang: string)
Parameters :
Name Type Optional
lang string No
Returns : void
setLanguage
setLanguage(lang: string)
Parameters :
Name Type Optional
lang string No
Returns : void
Async switchToLanguage
switchToLanguage(lang: string)

Switches to given language.

Parameters :
Name Type Optional Description
lang string No

The language as two-letter code.

Returns : any

Properties

langs
Type : any
Default value : keys(this.langsDetail).filter(k => this.langsDetail[k])
langsDetail
Type : any
Default value : this.options.get('languages', {})
Static SAVE_LANGUAGE_KEY
Type : string
Default value : 'c8y_language'

results matching ""

    No results matching ""