PageSourceSearch

https://glampinghub.com/jsi18n/

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

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.