signal-desktop/js/i18n.js
lilia c83dbc1bf0
Rename window.env to window.config
Also normalize to camelCase for configs.

// FREEBIE
2017-09-14 16:53:38 -07:00

25 lines
593 B
JavaScript

/*
* vim: ts=4:sw=4:expandtab
*/
;(function() {
'use strict';
var json = window.config.locale_json;
window.i18n = function (message, substitutions) {
if (!json[message]) {
return;
}
var s = json[message].message;
if (substitutions instanceof Array) {
substitutions.forEach(function(sub) {
s = s.replace(/\$.+?\$/, sub);
});
} else if (substitutions) {
s = s.replace(/\$.+?\$/, substitutions);
}
return s;
};
i18n.getLocale = function() {
return window.config.locale;
};
})();