Bug 32482: (follow-up) Add markup comments
[koha.git] / koha-tmpl / intranet-tmpl / js / i18n.js
1 (function() {
2   var params = {
3     "domain": "Koha"
4   };
5   if (typeof json_locale_data !== 'undefined') {
6     params.locale_data = json_locale_data;
7   }
8
9   Koha.i18n = {
10     gt: new Gettext(params),
11
12     expand: function(text, vars) {
13       var replace_callback = function(match, name) {
14         return name in vars ? vars[name] : match;
15       };
16       return text.replace(/\{(.*?)\}/g, replace_callback);
17     }
18   };
19 })();
20
21 function __(msgid) {
22   return Koha.i18n.gt.gettext(msgid);
23 }
24
25 function __x(msgid, vars) {
26   return Koha.i18n.expand(__(msgid), vars);
27 }
28
29 function __n(msgid, msgid_plural, count) {
30   return Koha.i18n.gt.ngettext(msgid, msgid_plural, count);
31 }
32
33 function __nx(msgid, msgid_plural, count, vars) {
34   return Koha.i18n.expand(__n(msgid, msgid_plural, count), vars);
35 }
36
37 function __p(msgctxt, msgid) {
38   return Koha.i18n.gt.pgettext(msgctxt, msgid);
39 }
40
41 function __px(msgctxt, msgid, vars) {
42   return Koha.i18n.expand(__p(msgctxt, msgid), vars);
43 }
44
45 function __np(msgctxt, msgid, msgid_plural, count) {
46   return Koha.i18n.gt.npgettext(msgctxt, msgid, msgid_plural, count);
47 }
48
49 function __npx(msgctxt, msgid, msgid_plural, count, vars) {
50   return Koha.i18n.expand(__np(msgctxt, msgid, msgid_plural, count), vars);
51 }