Skip to content

Commit

Permalink
fix(webapps): add translation handler
Browse files Browse the repository at this point in the history
related to #4351
  • Loading branch information
tasso94 committed May 15, 2024
1 parent 3f6cb30 commit 4bfccf5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions webapps/frontend/ui/common/scripts/services/locales.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ var moment = require('camunda-commons-ui/vendor/moment'),
angular = require('camunda-commons-ui/vendor/angular');

module.exports = function(ngModule, appRoot, appName) {
ngModule.factory('sanitizeMissingTranslationKey', [
'$translateSanitization',
function($sanitize) {
return function(translationKey) {
// avoid escape already escaped html character entities
if (!['<', '>', '<=', '>='].includes(translationKey)) {
return $sanitize.sanitize(translationKey, 'text', 'escape');
}
};
}
]);

ngModule.factory('localeLoader', [
'$q',
'$http',
Expand Down Expand Up @@ -101,6 +113,9 @@ module.exports = function(ngModule, appRoot, appName) {
'$translateProvider',
'configurationProvider',
function($translateProvider, configurationProvider) {
$translateProvider.useMissingTranslationHandler(
'sanitizeMissingTranslationKey'
);
var avail = configurationProvider.getAvailableLocales();
var fallback = configurationProvider.getFallbackLocale();

Expand Down

0 comments on commit 4bfccf5

Please sign in to comment.