2022-04-24 16:46:38 +02:00
|
|
|
/*
|
2024-01-23 19:23:10 +01:00
|
|
|
* I18n
|
|
|
|
*/
|
2022-04-24 16:46:38 +02:00
|
|
|
var translations;
|
2022-04-24 20:17:48 +02:00
|
|
|
var translations_data;
|
2022-04-24 16:46:38 +02:00
|
|
|
|
|
|
|
function _(string) {
|
2024-01-23 19:23:10 +01: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) {
|
2024-01-23 19:23:10 +01:00
|
|
|
return translations
|
|
|
|
? translations.ngettext(singular, plural, n)
|
|
|
|
: n > 1
|
|
|
|
? plural
|
|
|
|
: singular;
|
2022-04-24 16:46:38 +02:00
|
|
|
}
|
|
|
|
|
2024-01-23 19:23:10 +01:00
|
|
|
$(document).ready(function () {
|
2022-04-24 16:46:38 +02:00
|
|
|
// Load Gettext translations
|
2024-01-23 19:23:10 +01:00
|
|
|
translations = babel.Translations.load(
|
|
|
|
translations_data ? translations_data : {}
|
|
|
|
).install();
|
2022-04-24 16:46:38 +02:00
|
|
|
});
|