Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
edulix committed Feb 7, 2024
1 parent 3e70e6d commit 23ee401
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
7 changes: 3 additions & 4 deletions avUi/change-lang-directive/change-lang-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,10 @@ angular.module('avUi')
$window.i18next
.changeLanguage(lang)
.then(function () {
console.log("changeLang: changed, calling $i18next.reInit()");
console.log("changeLang: changed, calling $i18next.changeLanguage($i18next.options.lng);");

// This will trigget a $i18next's init function to be called and all
// angularjs $i18next translations to be updated accordingly.
$i18next.reInit();
// This will trigger a _this.$rootScope.$broadcast('i18nextLanguageChange', _this.i18n.language);
$i18next.changeLanguage($i18next.options.lng);

});

Expand Down
4 changes: 2 additions & 2 deletions avUi/i18n-override-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ angular
}
);
}
console.log("reloadResources: $i18next.reInit()");
console.log("reloadResources: $i18next.changeLanguage($i18next.options.lng);");

// This will trigget a $i18next's init function to be called and all
// angularjs $i18next translations to be updated accordingly.
$i18next.reInit();
$i18next.changeLanguage($i18next.options.lng);
});
};
}
Expand Down
6 changes: 4 additions & 2 deletions dist/appCommon-v10.1.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,8 @@ angular.module("avRegistration").config(function() {}), angular.module("avRegist
console.log("reloadResources: successful. Now checking overrides"), performOverrides && (console.log("reloadResources: adding overrides"),
_.map($window.i18nOverride, function(i18nOverride, language) {
$window.i18next.addResourceBundle(language, "translation", i18nOverride, !0, !0);
})), console.log("reloadResources: $i18next.reInit()"), $i18next.reInit();
})), console.log("reloadResources: $i18next.changeLanguage($i18next.options.lng);"),
$i18next.changeLanguage($i18next.options.lng);
});
};
} ]), angular.module("avUi").directive("avChangeLang", [ "$i18next", "ipCookie", "angularLoad", "amMoment", "$rootScope", "ConfigService", "$window", "I18nOverride", "Authmethod", function($i18next, ipCookie, angularLoad, amMoment, $rootScope, ConfigService, $window, I18nOverride, Authmethod) {
Expand All @@ -1167,7 +1168,8 @@ angular.module("avRegistration").config(function() {}), angular.module("avRegist
scope.deflang = languageCode, scope.langs = $i18next.options.lngWhitelist, scope.$apply();
}), scope.changeLang = function(lang) {
$window.i18next.changeLanguage(lang).then(function() {
console.log("changeLang: changed, calling $i18next.reInit()"), $i18next.reInit();
console.log("changeLang: changed, calling $i18next.changeLanguage($i18next.options.lng);"),
$i18next.changeLanguage($i18next.options.lng);
}), console.log("setting cookie");
ipCookie("lang", lang, _.extend({
expires: 360,
Expand Down

0 comments on commit 23ee401

Please sign in to comment.