Open vituchon opened 2 years ago
Well you know guys, I fix this problem by adding a very specific line on one of your sources.
on ng-i18next/src/translateService.ts if you go to method changeLanguage and the MAGIC LINE (see comment below), this problem is solved.
I18nTranslateService.prototype.changeLanguage = function (lng) {
var _this = this;
if (this.options.lng !== lng && this.i18n.language !== lng) {
this.options.lng = lng;
this.translations = {}; // THIS IS THE MAGIC LINE
this.i18n.changeLanguage(lng, function (err, t) {
_this.$rootScope.$broadcast('i18nextLanguageChange', _this.i18n.language);
});
}
};
I do wonder if this magic line doesn't not breaks other things... at least I'm not seeying that right now.
Cheers
Víctor
🐛 Bug Report :lady_beetle:
Hi all, how you doing?
To Reproduce
Just run the examples below
index.html
script.js
Observed behavior
Expected behavior
Your Environment
Aditional Context
In my ongoing project I'm using angularjs and I start to internationalizating it. First add i18next, then ng-i18next but when I added i18next-http-backend support for using translation files a problem arises. So i submit a ticket into the related proyect http-backend for i18next but after a quick talk with one of their guys and some suspicious things I see debugging your code it might be on your side after all.. i don't know really.
Technical Insight :nerd_face:
I made some debug following the debbuger into the sources and indeed it could be a problem of ng-i18next as I saw that the translations files are correctly loaded (http-backend responsability), but inside the angular service (ng-i18next responsability) the
this.translations["auto"]
remains with the same values once setup I mean, it doesn't change when you change the language. But things are, quite complex to really understand what is actually happening... i need, more knowledge and more debugging time.Cheers
Victor.