mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 06:55:46 +01:00
Update app.js
migrated global *translate* to a *require.js* module.
This commit is contained in:
@@ -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,6 +519,7 @@ app.cacheBuster = null;
|
|||||||
};
|
};
|
||||||
|
|
||||||
app.parseAndTranslate = function(template, blockName, data, callback) {
|
app.parseAndTranslate = function(template, blockName, data, callback) {
|
||||||
|
require(['translator'], function(translator) {
|
||||||
if (typeof blockName === 'string') {
|
if (typeof blockName === 'string') {
|
||||||
templates.parse(template, blockName, data, function(html) {
|
templates.parse(template, blockName, data, function(html) {
|
||||||
translator.translate(html, function(translatedHTML) {
|
translator.translate(html, function(translatedHTML) {
|
||||||
@@ -533,5 +534,6 @@ app.cacheBuster = null;
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}());
|
}());
|
||||||
|
|||||||
Reference in New Issue
Block a user