Skip to content

Commit 819c3f2

Browse files
author
Vaha
committed
#18012: added i18n wrapper to be used in underscore templates for translation
1 parent 039cce9 commit 819c3f2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/web/mage/translate.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
define([
77
'jquery',
88
'mage/mage',
9-
'mageTranslationDictionary'
10-
], function ($, mage, dictionary) {
9+
'mageTranslationDictionary',
10+
'underscore'
11+
], function ($, mage, dictionary, _) {
1112
'use strict';
1213

1314
$.extend(true, $, {
@@ -46,5 +47,12 @@ define([
4647
});
4748
$.mage.__ = $.proxy($.mage.translate.translate, $.mage.translate);
4849

50+
// Provide i18n wrapper to be used in underscore templates for translation
51+
_.extend(_, {
52+
i18n: function (str) {
53+
return $.mage.__(str);
54+
}
55+
});
56+
4957
return $.mage.__;
5058
});

0 commit comments

Comments
 (0)