Skip to content

Commit

Permalink
Replace angular translation before its used
Browse files Browse the repository at this point in the history
(cherry picked from commit 8275ff4)
  • Loading branch information
MariaAga authored and evgeni committed Sep 24, 2024
1 parent ed72022 commit 75ab6d2
Showing 1 changed file with 37 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,43 @@ tfm.i18n.jed.dcnpgettext = function( domain, context, singular_key, plural_key,
return brand_string(translated);
}

if (typeof(angular) !== 'undefined') {
angular.module('Bastion.i18n').config([ '$provide', function($provide) {
$provide.decorator('translate', [
'$delegate',
function ($delegate) {
var originalTranslate = $delegate;
return function(str) {
originalStr = originalTranslate(str);
return brand_string(originalStr);
}
}
document.addEventListener("loadAngularJSi18n", function () {
if (typeof angular !== "undefined") {
angular.module("Bastion.i18n").config([
"$provide",
function ($provide) {
$provide.decorator("translate", [
"$delegate",
function ($delegate) {
var originalTranslate = $delegate;
return function (str) {
originalStr = originalTranslate(str);
return brand_string(originalStr);
};
},
]);
},
]);
}]);
}
}
});

if (typeof(angular) !== 'undefined') {
angular.module('gettext').config([ '$provide', function($provide) {
$provide.decorator('gettextCatalog', [
'$delegate',
function ($delegate) {
var originalTranslate = $delegate.getString;
$delegate.getString = function(str) {
originalStr = originalTranslate.apply($delegate, [str]);
return brand_string(originalStr);
}
return $delegate;
}
document.addEventListener("loadAngularJSgettext", function () {
if (typeof angular !== "undefined") {
angular.module("gettext").config([
"$provide",
function ($provide) {
$provide.decorator("gettextCatalog", [
"$delegate",
function ($delegate) {
var originalTranslate = $delegate.getString;
$delegate.getString = function (str) {
originalStr = originalTranslate.apply($delegate, [str]);
return brand_string(originalStr);
};
return $delegate;
},
]);
},
]);
}]);
}
}
});

0 comments on commit 75ab6d2

Please sign in to comment.