2022-04-24 16:46:38 +02:00
|
|
|
/*
|
|
|
|
* I18n
|
|
|
|
*/
|
|
|
|
var translations;
|
2022-04-24 20:17:48 +02:00
|
|
|
var translations_data;
|
2022-04-24 16:46:38 +02:00
|
|
|
|
|
|
|
function _(string) {
|
2022-04-24 20:17:48 +02:00
|
|
|
var translated = (translations?translations.gettext(string):string);
|
|
|
|
return (translated !== '') ? translated : string;
|
2022-04-24 16:46:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function ngettext(singular, plural, n) {
|
2022-04-24 20:17:48 +02:00
|
|
|
return (
|
|
|
|
translations?
|
|
|
|
translations.ngettext(singular, plural, n):
|
|
|
|
(n > 1?plural:singular)
|
|
|
|
);
|
2022-04-24 16:46:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready( function() {
|
|
|
|
// Load Gettext translations
|
2022-04-24 20:17:48 +02:00
|
|
|
translations = babel.Translations.load(translations_data?translations_data:{}).install();
|
2022-04-24 16:46:38 +02:00
|
|
|
});
|