Change translation format to JSON

This commit is contained in:
yflory
2019-01-30 14:38:21 +01:00
parent d97ada3e26
commit 6018f57ec1
5 changed files with 22 additions and 9 deletions

View File

@@ -25,6 +25,22 @@ var getLanguage = messages._getLanguage = function () {
};
var language = getLanguage();
// Translations files were migrated from requirejs modules to json.
// To avoid asking every administrator to update their customized translation files,
// we use a requirejs map to redirect the old path to the new one and to use the
// requirejs json plugin
var reqPaths = {
"/common/translations/messages.js":"json!/common/translations/messages.json"
};
Object.keys(map).forEach(function (k) {
reqPaths["/common/translations/messages."+k+".js"] = "json!/common/translations/messages."+k+".json";
});
require.config({
map: {
"*": reqPaths
}
});
var req = ['/common/common-util.js', '/customize/translations/messages.js'];
if (language && map[language]) { req.push('/customize/translations/messages.' + language + '.js'); }