Language API
A list of TranslocoService language-related API methods and their usages
getDefaultLang()
Returns the default language of the application.
app.component.ts
export class AppComponent {
constructor(private translocoService: TranslocoService) {
const defaultLang = translocoService.getDefaultLang();
console.log(defaultLang);
}
}setDefaultLang()
Sets the default language.
app.component.ts
export class AppComponent {
constructor(private translocoService: TranslocoService) {
translocoService.setDefaultLang('es');
}
}getActiveLang()
Returns the current active language.
setActiveLang()
Sets the active language for the application.
getAvailableLangs()
Retrieves the list of available languages.
setFallbackLangForMissingTranslation()
Defines a fallback language to be used when a translation key is missing for the active language.
setAvailableLangs()
Sets the list of available languages.
langChanges$
An observable that emits whenever the active language changes.
load()
Loads the specified language and adds it to the service.
Last updated
Was this helpful?

