I have a service that provides the global app language as follows:
export class LanguageService {
private currentLanguage$ = new ReplaySubject < string > ();
getCurrentLanguage(): Observable < string > {
return this.currentLanguage$.asObservable();
}
}
I use this service to provide language switching on the fly throughout the app. All components respect the language provided by the function above ('en', 'fr', etc.) and I wanted the CurrencyPipe
to also do so.
As I understood I can provide this via LOCALE_ID
, but I cannot find examples or guidance on how to do so in the docs, and especially not on how to provide it using an observable.