You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-desktop/js/i18n.js

23 lines
561 B
JavaScript

/*
* vim: ts=4:sw=4:expandtab
*/
;(function() {
'use strict';
var json = window.env.locale_json;
window.i18n = function (message, substitutions) {
var s = json[message] ? json[message].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.env.locale;
};
})();