I am using Visual Studio 2017 to deploy my app to my android device. I am making an angular, ionic, cordova hybrid app. The languages are loaded after the user logs in because it's on a per-user basis.
I load the languages into i18next in my controller before routing to the home page but the translations are not available on the home page.
Here's the part from my login controller:
languageService.setDefault(data).then(function (response) {
console.log("Success!", response);
$state.go('main.home'); //route to home page
}, function (error) {
console.error("Failed!", error);
});
Here's the part from my language service:
languageService.setDefault = function (langObj) {
// Return a new promise.
return new Promise(function (resolve, reject) {
try {
console.log('> > > > > languageService.save::: ', langObj);
for (var i = 0; i < langObj.languages.length; i++) {
$i18next.i18n.addResourceBundle(langObj.languages[i], 'translations', langObj[langObj.languages[i]], false, true);
}
if ($i18next.i18n.language !== langObj.actual) {
$i18next.i18n.changeLanguage(lng);
}
console.log('- - - - - made it this far: ', $i18next.i18n.options.resources);
//prints out the resources perfectly
resolve(1);
}
catch (err) {
reject(err);
}
});
I have the languages loaded so I'm not sure why it is not available on my home page in time.
I am using Visual Studio 2017 to deploy my app to my android device. I am making an angular, ionic, cordova hybrid app. The languages are loaded after the user logs in because it's on a per-user basis.
I load the languages into i18next in my controller before routing to the home page but the translations are not available on the home page.
Here's the part from my login controller:
Here's the part from my language service:
I have the languages loaded so I'm not sure why it is not available on my home page in time.