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