diff options
author | 2013-07-11 19:34:31 +0200 | |
---|---|---|
committer | 2013-07-11 19:34:31 +0200 | |
commit | 1291f49781fbb0dd3090c9f1ea6737bf334a515d (patch) | |
tree | ac92774e2a00872f37adc9903f29a5a69ac11e22 /pyload/web/app/scripts/helpers | |
parent | fixed settings (diff) | |
download | pyload-1291f49781fbb0dd3090c9f1ea6737bf334a515d.tar.xz |
use gettext/jed for webui translations
Diffstat (limited to 'pyload/web/app/scripts/helpers')
-rw-r--r-- | pyload/web/app/scripts/helpers/gettext.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pyload/web/app/scripts/helpers/gettext.js b/pyload/web/app/scripts/helpers/gettext.js new file mode 100644 index 000000000..d73b5e378 --- /dev/null +++ b/pyload/web/app/scripts/helpers/gettext.js @@ -0,0 +1,16 @@ +require(['underscore', 'handlebars', 'utils/i18n'], function(_, Handlebars, i18n) { + 'use strict'; + // These methods binds additional content directly to translated message + function ngettext(single, plural, n) { + return i18n.sprintf(i18n.ngettext(single, plural, n), n); + } + + function gettext(key, message) { + return i18n.sprintf(i18n.gettext(key), message); + } + + Handlebars.registerHelper('_', gettext); + Handlebars.registerHelper('gettext', gettext); + Handlebars.registerHelper('ngettext', ngettext); + return gettext; +});
\ No newline at end of file |