oblique-bit / oblique

An Angular front-end framework Tailored for your swiss branded business web application, Oblique provides a standardized corporate design look and feel as well as a collection of ready-to-use Angular components. Oblique, through its fully customizable master layout, takes care of the application's structure, letting you focus on the content.
https://oblique.bit.admin.ch
MIT License
56 stars 13 forks source link

ObLanguageService deprecated #129

Closed BenjaminHofstetter closed 4 months ago

BenjaminHofstetter commented 4 months ago
/**
 * @deprecated since Oblique 11.3.0. It will be removed with Oblique 12 
 * with no replacement as it won't be needed anymore.
 */

I need this service in my UI to detect language changes. It there another way to detect language changes?

I have multi language data. If the language changes i have to (re)fetch the data for the desired language. How can i do that in Oblique 12?

gillerr commented 4 months ago

Hi @BenjaminHofstetter

If you only need to detect language changes, you can use the translateService:

private readonly translateService = inject(TranslateService);
...
translateService.onLangChange.subscribe(language => {
    console.log(language.lang);
}

If you need to detect locale changes, then I'm interested in your use case, because this won't be possible anymore.

BenjaminHofstetter commented 4 months ago

Thank you @gillerr. I don't need the locale. This solution works well.