eesyphp/static/js/translation.js
2024-01-23 19:23:10 +01:00

25 lines
531 B
JavaScript

/*
* I18n
*/
var translations;
var translations_data;
function _(string) {
var translated = translations ? translations.gettext(string) : string;
return translated !== "" ? translated : string;
}
function ngettext(singular, plural, n) {
return translations
? translations.ngettext(singular, plural, n)
: n > 1
? plural
: singular;
}
$(document).ready(function () {
// Load Gettext translations
translations = babel.Translations.load(
translations_data ? translations_data : {}
).install();
});