PageSourceSearch

https://www.studioneau.be/jsi18n?20260925.1636

js studioneau.be collected 2026-09-25 15:10:35 UTC 3,120 bytes, 120 lines download raw bytes

1
2
3'use strict';
4{
5  const globals = this;
6  const django = globals.django || (globals.django = {});
7
8  
9  django.pluralidx = function(count) { return (count == 1) ? 0 : 1; };
10  
11
12  /* gettext library */
13
14  django.catalog = django.catalog || {};
15  
16
17  if (!django.jsi18n_initialized) {
18    django.gettext = function(msgid) {
19      const value = django.catalog[msgid];
20      if (typeof value === 'undefined') {
21        return msgid;
22      } else {
23        return (typeof value === 'string') ? value : value[0];
24      }
25    };
26
27    django.ngettext = function(singular, plural, count) {
28      const value = django.catalog[singular];
29      if (typeof value === 'undefined') {
30        return (count == 1) ? singular : plural;
31      } else {
32        return value.constructor === Array ? value[django.pluralidx(count)] : value;
33      }
34    };
35
36    django.gettext_noop = function(msgid) { return msgid; };
37
38    django.pgettext = function(context, msgid) {
39      let value = django.gettext(context + '\x04' + msgid);
40      if (value.includes('\x04')) {
41        value = msgid;
42      }
43      return value;
44    };
45
46    django.npgettext = function(context, singular, plural, count) {
47      let value = django.ngettext(context + '\x04' + singular, context + '\x04' + plural, count);
48      if (value.includes('\x04')) {
49        value = django.ngettext(singular, plural, count);
50      }
51      return value;
52    };
53
54    django.interpolate = function(fmt, obj, named) {
55      if (named) {
56        return fmt.replace(/%\(\w+\)s/g, function(match){return String(obj[match.slice(2,-2)])});
57      } else {
58        return fmt.replace(/%s/g, function(match){return String(obj.shift())});
59      }
60    };
61
62
63    /* formatting library */
64
65    django.formats = {
66    "DATETIME_FORMAT": "j. F Y H:i",
67    "DATETIME_INPUT_FORMATS": [
68      "%d.%m.%Y %H:%M:%S",
69      "%d.%m.%Y %H:%M:%S.%f",
70      "%d.%m.%Y %H:%M",
71      "%Y-%m-%d %H:%M:%S",
72      "%Y-%m-%d %H:%M:%S.%f",
73      "%Y-%m-%d %H:%M",
74      "%Y-%m-%d"
75    ],
76    "DATE_FORMAT": "j. F Y",
77    "DATE_INPUT_FORMATS": [
78      "%d.%m.%Y",
79      "%d.%m.%y",
80      "%Y-%m-%d"
81    ],
82    "DECIMAL_SEPARATOR": ",",
83    "FIRST_DAY_OF_WEEK": 1,
84    "MONTH_DAY_FORMAT": "j. F",
85    "NUMBER_GROUPING": 3,
86    "SHORT_DATETIME_FORMAT": "d.m.Y H:i",
87    "SHORT_DATE_FORMAT": "d.m.Y",
88    "THOUSAND_SEPARATOR": ".",
89    "TIME_FORMAT": "H:i",
90    "TIME_INPUT_FORMATS": [
91      "%H:%M:%S",
92      "%H:%M:%S.%f",
93      "%H:%M"
94    ],
95    "YEAR_MONTH_FORMAT": "F Y"
96  };
97
98    django.get_format = function(format_type) {
99      const value = django.formats[format_type];
100      if (typeof value === 'undefined') {
101        return format_type;
102      } else {
103        return value;
104      }
105    };
106
107    /* add to global namespace */
108    globals.pluralidx = django.pluralidx;
109    globals.gettext = django.gettext;
110    globals.ngettext = django.ngettext;
111    globals.gettext_noop = django.gettext_noop;
112    globals.pgettext = django.pgettext;
113    globals.npgettext = django.npgettext;
114    globals.interpolate = django.interpolate;
115    globals.get_format = django.get_format;
116
117    django.jsi18n_initialized = true;
118  }
119};
120

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.