diff --git a/avRegistration/login-controller/login-controller-spec.js b/avRegistration/login-controller/login-controller-spec.js
index 1a5ef9ea..963f0cfc 100644
--- a/avRegistration/login-controller/login-controller-spec.js
+++ b/avRegistration/login-controller/login-controller-spec.js
@@ -35,7 +35,6 @@ describe("Login Controler tests", function () {
$scope: $scope,
$stateParams: { id: 1, code: 'qwerty', email: 'test@sequentech.io', isOpenId: false },
$filter: undefined,
- $i18next: undefined,
$cookies: undefined,
$window: window,
ConfigService: {},
diff --git a/avRegistration/login-directive/login-directive.js b/avRegistration/login-directive/login-directive.js
index af5f48e2..37d89297 100644
--- a/avRegistration/login-directive/login-directive.js
+++ b/avRegistration/login-directive/login-directive.js
@@ -24,7 +24,6 @@ angular.module('avRegistration')
$state,
$location,
$cookies,
- $i18next,
$window,
$timeout,
ConfigService,
diff --git a/avRegistration/logout-controller/logout-controller.js b/avRegistration/logout-controller/logout-controller.js
index 1a83037a..58ebc7e4 100644
--- a/avRegistration/logout-controller/logout-controller.js
+++ b/avRegistration/logout-controller/logout-controller.js
@@ -16,7 +16,7 @@
**/
angular.module('avRegistration').controller('LogoutController',
- function($scope, $stateParams, $filter, ConfigService, $i18next, $state, $cookies, Authmethod) {
+ function($scope, $stateParams, $filter, ConfigService, $state, $cookies, Authmethod) {
var adminId = ConfigService.freeAuthId;
var authevent = Authmethod.getAuthevent();
var postfix = "_authevent_" + authevent;
diff --git a/avRegistration/register-controller/register-controller.js b/avRegistration/register-controller/register-controller.js
index 29e5df5c..ca772045 100644
--- a/avRegistration/register-controller/register-controller.js
+++ b/avRegistration/register-controller/register-controller.js
@@ -16,7 +16,7 @@
**/
angular.module('avRegistration').controller('RegisterController',
- function($scope, $stateParams, $filter, ConfigService, $i18next) {
+ function($scope, $stateParams, $filter, ConfigService) {
$scope.event_id = $stateParams.id;
$scope.email = $stateParams.email;
}
diff --git a/avRegistration/register-directive/register-directive.js b/avRegistration/register-directive/register-directive.js
index 1e996672..0c2ddd1d 100644
--- a/avRegistration/register-directive/register-directive.js
+++ b/avRegistration/register-directive/register-directive.js
@@ -16,7 +16,7 @@
**/
angular.module('avRegistration')
- .directive('avRegister', function(Authmethod, StateDataService, $parse, $state, ConfigService, $cookies, $i18next, $sce) {
+ .directive('avRegister', function(Authmethod, StateDataService, $parse, $state, ConfigService, $cookies, $window, $sce) {
// we use it as something similar to a controller here
function link(scope, element, attrs) {
var autheventid = attrs.eventId;
@@ -76,13 +76,13 @@ angular.module('avRegistration')
scope.user = response.data.user;
data.successfulRegistration = true;
StateDataService.go(details.path, details.data, data);
- scope.error = response.data.msg || $sce.trustAsHtml($i18next('avRegistration.invalidRegisterData', {
+ scope.error = response.data.msg || $sce.trustAsHtml($window.i18next.t('avRegistration.invalidRegisterData', {
url: $state.href(details.path, details.data)
}));
} else {
scope.sendingData = false;
scope.status = 'Not found';
- scope.error = response.data.msg || $sce.trustAsHtml($i18next('avRegistration.invalidRegisterData', {
+ scope.error = response.data.msg || $sce.trustAsHtml($window.i18next.t('avRegistration.invalidRegisterData', {
url: $state.href(details.path, details.data)
}));
}
@@ -93,9 +93,9 @@ angular.module('avRegistration')
scope.status = 'Registration error: ' + response.data.message;
if (!!response.data.error_codename && response.data.error_codename === 'invalid-dni') {
- scope.error = $sce.trustAsHtml($i18next('avRegistration.invalidRegisterDNI'));
+ scope.error = $sce.trustAsHtml($window.i18next.t('avRegistration.invalidRegisterDNI'));
} else {
- scope.error = response.data.msg || $sce.trustAsHtml($i18next('avRegistration.invalidRegisterData', {
+ scope.error = response.data.msg || $sce.trustAsHtml($window.i18next.t('avRegistration.invalidRegisterData', {
url: $state.href(details.path, details.data)
}));
if (response.data.msg === 'Invalid captcha') {
diff --git a/avUi/i18n-override-service.js b/avUi/i18n-override-service.js
index f6a06b00..4ef3b105 100644
--- a/avUi/i18n-override-service.js
+++ b/avUi/i18n-override-service.js
@@ -54,21 +54,15 @@ angular
if (languagesConf)
{
- // For some reason it seems that `$i18next.options.lng` gets desynced
- // from `$window.i18next.resolvedLanguage`. This might result in an unexpected
- // language change when the init() function from $i18next gets called
- // later in this code. For this reason, we set the correct language in
- // `$i18next.options.lng` to ensure that doesn't happen.
$i18next.options.lng = (languagesConf.force_default_language) ?
languagesConf.default_language : $window.i18next.resolvedLanguage;
$i18next.options.lngWhitelist = languagesConf.available_languages;
$i18next.options.preload = languagesConf.available_languages;
- $i18next.options.fallbackLng = [languagesConf.default_language, 'en'];
}
console.log("calling $window.i18next.reloadResources()..");
$window.i18next
- .reloadResources($i18next.options.preload)
+ .reloadResources($i18next.options.preload, ['override'])
.then(function () {
if (
languagesConf &&
diff --git a/avUi/show-versions-modal-service.js b/avUi/show-versions-modal-service.js
index f2a1cfe5..854bd165 100644
--- a/avUi/show-versions-modal-service.js
+++ b/avUi/show-versions-modal-service.js
@@ -19,7 +19,7 @@ angular
.module('avUi')
.service(
'ShowVersionsModalService',
- function(ConfigService, $modal, $i18next) {
+ function(ConfigService, $modal, $sce, $window) {
return function () {
$modal
.open({
@@ -28,7 +28,7 @@ angular
size: 'lg',
resolve: {
data: function () {
- var mainVersion = $i18next('avCommon.showVersionModal.mainVersion');
+ var mainVersion = $window.i18next.t('avCommon.showVersionModal.mainVersion');
var versionList = (
"
" + mainVersion + " (deployment-tool): " +
ConfigService.mainVersion +
@@ -46,17 +46,18 @@ angular
);
}
);
- var body = $i18next(
+ var body = $sce.trustAsHtml($window.i18next.t(
'avCommon.showVersionModal.body',
{
- versionList: versionList
+ versionList: versionList,
+ interpolation: { escapeValue: false }
}
- );
+ ));
return {
i18n: {
- header: $i18next('avCommon.showVersionModal.header'),
+ header: $window.i18next.t('avCommon.showVersionModal.header'),
body: body,
- confirmButton: $i18next('avCommon.showVersionModal.confirmButton'),
+ confirmButton: $window.i18next.t('avCommon.showVersionModal.confirmButton'),
},
hideCancelButton: true
};
diff --git a/dist/appCommon-v10.1.0.js b/dist/appCommon-v10.1.0.js
index 952b83c7..3de3242b 100644
--- a/dist/appCommon-v10.1.0.js
+++ b/dist/appCommon-v10.1.0.js
@@ -445,7 +445,7 @@ angular.module("avRegistration").config(function() {}), angular.module("avRegist
$scope.withCode = $stateParams.withCode, $scope.withAltMethod = $stateParams.withAltMethod,
$scope.selectedAltMethod = $stateParams.altmethod, $scope.isOtl = $stateParams.isOtl,
$scope.otlSecret = $stateParams.otlSecret;
-} ]), angular.module("avRegistration").directive("avLogin", [ "Authmethod", "StateDataService", "$state", "$location", "$cookies", "$i18next", "$window", "$timeout", "ConfigService", "Patterns", function(Authmethod, StateDataService, $state, $location, $cookies, $i18next, $window, $timeout, ConfigService, Patterns) {
+} ]), angular.module("avRegistration").directive("avLogin", [ "Authmethod", "StateDataService", "$state", "$location", "$cookies", "$window", "$timeout", "ConfigService", "Patterns", function(Authmethod, StateDataService, $state, $location, $cookies, $window, $timeout, ConfigService, Patterns) {
return {
restrict: "AE",
scope: !0,
@@ -731,16 +731,16 @@ angular.module("avRegistration").config(function() {}), angular.module("avRegist
},
templateUrl: "avRegistration/login-directive/login-directive.html"
};
-} ]), angular.module("avRegistration").controller("LogoutController", [ "$scope", "$stateParams", "$filter", "ConfigService", "$i18next", "$state", "$cookies", "Authmethod", function($scope, $stateParams, $filter, ConfigService, $i18next, $state, $cookies, postfix) {
+} ]), angular.module("avRegistration").controller("LogoutController", [ "$scope", "$stateParams", "$filter", "ConfigService", "$state", "$cookies", "Authmethod", function($scope, $stateParams, $filter, ConfigService, $state, $cookies, postfix) {
ConfigService.freeAuthId;
var authevent = postfix.getAuthevent(), postfix = "_authevent_" + authevent;
$cookies.put("user" + postfix, ""), $cookies.put("auth" + postfix, ""), $cookies.put("authevent_" + authevent, ""),
$cookies.put("userid" + postfix, ""), $cookies.put("isAdmin" + postfix, !1), authevent !== ConfigService.freeAuthId + "" && authevent ? $state.go("registration.login", {
id: $cookies.get("authevent_" + authevent)
}) : $state.go("admin.login");
-} ]), angular.module("avRegistration").controller("RegisterController", [ "$scope", "$stateParams", "$filter", "ConfigService", "$i18next", function($scope, $stateParams, $filter, ConfigService, $i18next) {
+} ]), angular.module("avRegistration").controller("RegisterController", [ "$scope", "$stateParams", "$filter", "ConfigService", function($scope, $stateParams, $filter, ConfigService) {
$scope.event_id = $stateParams.id, $scope.email = $stateParams.email;
-} ]), angular.module("avRegistration").directive("avRegister", [ "Authmethod", "StateDataService", "$parse", "$state", "ConfigService", "$cookies", "$i18next", "$sce", function(Authmethod, StateDataService, $parse, $state, ConfigService, $cookies, $i18next, $sce) {
+} ]), angular.module("avRegistration").directive("avRegister", [ "Authmethod", "StateDataService", "$parse", "$state", "ConfigService", "$cookies", "$window", "$sce", function(Authmethod, StateDataService, $parse, $state, ConfigService, $cookies, $window, $sce) {
return {
restrict: "AE",
scope: !0,
@@ -771,12 +771,12 @@ angular.module("avRegistration").config(function() {}), angular.module("avRegist
}), Authmethod.signup(data, autheventid).then(function(response) {
details = scope.getLoginDetails(autheventid), "ok" === response.data.status ? (scope.user = response.data.user,
data.successfulRegistration = !0, StateDataService.go(details.path, details.data, data)) : (scope.sendingData = !1,
- scope.status = "Not found"), scope.error = response.data.msg || $sce.trustAsHtml($i18next("avRegistration.invalidRegisterData", {
+ scope.status = "Not found"), scope.error = response.data.msg || $sce.trustAsHtml($window.i18next.t("avRegistration.invalidRegisterData", {
url: $state.href(details.path, details.data)
}));
}, function(response) {
details = scope.getLoginDetails(autheventid), scope.sendingData = !1, scope.status = "Registration error: " + response.data.message,
- response.data.error_codename && "invalid-dni" === response.data.error_codename ? scope.error = $sce.trustAsHtml($i18next("avRegistration.invalidRegisterDNI")) : (scope.error = response.data.msg || $sce.trustAsHtml($i18next("avRegistration.invalidRegisterData", {
+ response.data.error_codename && "invalid-dni" === response.data.error_codename ? scope.error = $sce.trustAsHtml($window.i18next.t("avRegistration.invalidRegisterDNI")) : (scope.error = response.data.msg || $sce.trustAsHtml($window.i18next.t("avRegistration.invalidRegisterData", {
url: $state.href(details.path, details.data)
})), "Invalid captcha" === response.data.msg && Authmethod.newCaptcha());
}));
@@ -1093,7 +1093,7 @@ angular.module("avRegistration").config(function() {}), angular.module("avRegist
}, $scope.cancel = function() {
$modalInstance.dismiss("cancel");
};
-} ]), angular.module("avUi").service("ShowVersionsModalService", [ "ConfigService", "$modal", "$i18next", function(ConfigService, $modal, $i18next) {
+} ]), angular.module("avUi").service("ShowVersionsModalService", [ "ConfigService", "$modal", "$sce", "$window", function(ConfigService, $modal, $sce, $window) {
return function() {
$modal.open({
templateUrl: "avUi/confirm-modal-controller/confirm-modal-controller.html",
@@ -1101,18 +1101,21 @@ angular.module("avRegistration").config(function() {}), angular.module("avRegist
size: "lg",
resolve: {
data: function() {
- var versionList = "" + $i18next("avCommon.showVersionModal.mainVersion") + " (deployment-tool): " + ConfigService.mainVersion + "
";
+ var versionList = "" + $window.i18next.t("avCommon.showVersionModal.mainVersion") + " (deployment-tool): " + ConfigService.mainVersion + "
";
_.each(ConfigService.repoVersions, function(repo) {
versionList += "" + repo.repoName + ": " + repo.repoVersion + "";
});
- var body = $i18next("avCommon.showVersionModal.body", {
- versionList: versionList
- });
+ var body = $sce.trustAsHtml($window.i18next.t("avCommon.showVersionModal.body", {
+ versionList: versionList,
+ interpolation: {
+ escapeValue: !1
+ }
+ }));
return {
i18n: {
- header: $i18next("avCommon.showVersionModal.header"),
+ header: $window.i18next.t("avCommon.showVersionModal.header"),
body: body,
- confirmButton: $i18next("avCommon.showVersionModal.confirmButton")
+ confirmButton: $window.i18next.t("avCommon.showVersionModal.confirmButton")
},
hideCancelButton: !0
};
@@ -1125,9 +1128,8 @@ angular.module("avRegistration").config(function() {}), angular.module("avRegist
force = !!angular.isDefined(force) && force;
null === overrides || !force && JSON.stringify(overrides) === JSON.stringify($window.i18nOverride) || ($window.i18nOverride = overrides),
languagesConf && ($i18next.options.lng = languagesConf.force_default_language ? languagesConf.default_language : $window.i18next.resolvedLanguage,
- $i18next.options.lngWhitelist = languagesConf.available_languages, $i18next.options.preload = languagesConf.available_languages,
- $i18next.options.fallbackLng = [ languagesConf.default_language, "en" ]), console.log("calling $window.i18next.reloadResources().."),
- $window.i18next.reloadResources($i18next.options.preload).then(function() {
+ $i18next.options.lngWhitelist = languagesConf.available_languages, $i18next.options.preload = languagesConf.available_languages),
+ console.log("calling $window.i18next.reloadResources().."), $window.i18next.reloadResources($i18next.options.preload, [ "override" ]).then(function() {
languagesConf && languagesConf.force_default_language && $window.i18next.changeAppLang ? (console.log("reloadResources: successful. force-changing default lang to=" + languagesConf.default_language),
$window.i18next.changeAppLang(languagesConf.default_language)) : (console.log("reloadResources: successful. broadcast i18nextLanguageChange signal"),
$rootScope.$broadcast("i18nextLanguageChange", $i18next.options.lng));