eesyphp/public_html/js/translation.js

24 lines
515 B
JavaScript
Raw Normal View History

/*
* 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();
});