Benjamin Renard
4f47dc056d
* Move example application in example sub-directory * Widely use App::get() instead of Config::get()
23 lines
515 B
JavaScript
23 lines
515 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();
|
|
});
|