Merge pull request #4081 from manolino/patch-3

Update app.js
v1.18.x
Julian Lam 9 years ago
commit 0368280e52

@ -1,5 +1,5 @@
"use strict"; "use strict";
/*global templates, translator, ajaxify, utils, bootbox, overrides, socket, config, Visibility*/ /*global templates, ajaxify, utils, bootbox, overrides, socket, config, Visibility*/
var app = app || {}; var app = app || {};
@ -519,19 +519,21 @@ app.cacheBuster = null;
}; };
app.parseAndTranslate = function(template, blockName, data, callback) { app.parseAndTranslate = function(template, blockName, data, callback) {
if (typeof blockName === 'string') { require(['translator'], function(translator) {
templates.parse(template, blockName, data, function(html) { if (typeof blockName === 'string') {
translator.translate(html, function(translatedHTML) { templates.parse(template, blockName, data, function(html) {
callback($(translatedHTML)); translator.translate(html, function(translatedHTML) {
callback($(translatedHTML));
});
}); });
}); } else {
} else { callback = data, data = blockName;
callback = data, data = blockName; templates.parse(template, data, function(html) {
templates.parse(template, data, function(html) { translator.translate(html, function(translatedHTML) {
translator.translate(html, function(translatedHTML) { callback($(translatedHTML));
callback($(translatedHTML)); });
}); });
}); }
} });
}; };
}()); }());

Loading…
Cancel
Save