projects/openvidu-components-angular/src/lib/services/translate/translate.service.ts
Service responsible for managing translations for the application. This service provides methods to add additional translations and to translate keys into the currently selected language.
The pipe TranslatePipe is used to translate keys in the templates.
Properties |
Methods |
constructor(storageService: StorageService)
|
||||||
Parameters :
|
addTranslations | ||||||||
addTranslations(translations: Partial<AdditionalTranslationsType>)
|
||||||||
Adds multiple translations to the additional translations storage.
Parameters :
Returns :
void
|
getAvailableLanguages |
getAvailableLanguages()
|
Retrieves the list of all available language options.
Returns :
LangOption[]
An array of available language options. |
translate | ||||||||
translate(key: string)
|
||||||||
Translates a given key into the current language. This method first attempts to find the translation in the official translations. If the translation is not found, it then looks for the translation in the additional translations registered by the app.
Parameters :
Returns :
string
The translated string if found, otherwise an empty string. |
selectedLanguageOption$ |
Type : Observable<LangOption>
|