Skip to content

Commit

Permalink
#18012: added i18n wrapper to be used in underscore templates for tra…
Browse files Browse the repository at this point in the history
…nslation
  • Loading branch information
Vaha committed Jan 17, 2020
1 parent 039cce9 commit 819c3f2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/web/mage/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
define([
'jquery',
'mage/mage',
'mageTranslationDictionary'
], function ($, mage, dictionary) {
'mageTranslationDictionary',
'underscore'
], function ($, mage, dictionary, _) {
'use strict';

$.extend(true, $, {
Expand Down Expand Up @@ -46,5 +47,12 @@ define([
});
$.mage.__ = $.proxy($.mage.translate.translate, $.mage.translate);

// Provide i18n wrapper to be used in underscore templates for translation
_.extend(_, {
i18n: function (str) {
return $.mage.__(str);
}
});

return $.mage.__;
});

0 comments on commit 819c3f2

Please sign in to comment.