I translate data that I get locally, they are not async data.
My native text comes from an enum imported in my file V2VehiculeOutput.StatusEnum
But I am forced to reload the page if I want to see the translation.
I tried to load translations, with the code bellow, from the ngOnInit and the constructor but it doesn't change anything.
Object.keys(V2VehiculeOutput.StatusEnum).forEach(s => {
console.log(this.translate.instant('FILTERS.VEHICULE.STATUS.' + V2VehiculeOutput.StatusEnum[s]));
});
});
I read that issue https://github.com/ngx-translate/core/issues/517 but my data is not even async ... So why translate.instant is not loading my data directly ?
Am I missing something ?
This post https://www.digitalocean.com/community/tutorials/angular-ngx-translate helped me.
It seems to work normally now using this exemple.
this.translate.get(['login.username', 'login.password'])
.subscribe(translations => {
this.usernameLabel = translations['login.username'];
this.passwordLabel = translations['login.password'];
});
The bug was not on each load so I will keep an eye on that but it feels good for the moment.