hi!

Have you succed ? because I have got a problem using the TranslateService.
I made a language-picker component that is a child of the app. 
When it modifies the translate language, it does not change the whole app 
language.
I don't know if it is a refresh problem . or if the TranslateService is not 
defined as singleton.



Le vendredi 18 août 2017 11:31:17 UTC+2, becto...@gmail.com a écrit :
>
> if i am using the translate service in angular4+
>
> Can i share data between components just importing this 
> translateService. Pretty much I want that service to remember which 
> language I set it to. Or is this something i need to create my own service 
> for to share the language i set my app to in order to get it in between 
> components. 
> import { TranslateService } from '@ngx-translate/core';
>
>
>  constructor(public translate: TranslateService, public data: DataService) 
> {
>    this.data = data;
>    translate.addLangs(['en', 'fr']);
>    const browserLang: string = translate.getBrowserLang();
>    translate.use(browserLang.match(/en|fr/) ? browserLang : 'en');
>
> }
>
>
>
>
>
> how could I then in another component figure out which 
> languauge translate.use() was already set to? Or can the translateService 
> not persist data between components and i would have to use the DataService 
> that i wrote myself to store it?
>
> Thanks 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to