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": "N j, Y, P", 67 "DATETIME_INPUT_FORMATS": [ 68 "%Y-%m-%d %H:%M:%S", 69 "%Y-%m-%d %H:%M:%S.%f", 70 "%Y-%m-%d %H:%M", 71 "%m/%d/%Y %H:%M:%S", 72 "%m/%d/%Y %H:%M:%S.%f", 73 "%m/%d/%Y %H:%M", 74 "%m/%d/%y %H:%M:%S", 75 "%m/%d/%y %H:%M:%S.%f", 76 "%m/%d/%y %H:%M", 77 "%Y-%m-%d" 78 ], 79 "DATE_FORMAT": "N j, Y", 80 "DATE_INPUT_FORMATS": [ 81 "%Y-%m-%d", 82 "%m/%d/%Y", 83 "%m/%d/%y" 84 ], 85 "DECIMAL_SEPARATOR": ".", 86 "FIRST_DAY_OF_WEEK": 0, 87 "MONTH_DAY_FORMAT": "F j", 88 "NUMBER_GROUPING": 3, 89 "SHORT_DATETIME_FORMAT": "m/d/Y P", 90 "SHORT_DATE_FORMAT": "m/d/Y", 91 "THOUSAND_SEPARATOR": ",", 92 "TIME_FORMAT": "P", 93 "TIME_INPUT_FORMATS": [ 94 "%H:%M:%S", 95 "%H:%M:%S.%f", 96 "%H:%M" 97 ], 98 "YEAR_MONTH_FORMAT": "F Y" 99 }; 100 101 django.get_format = function(format_type) { 102 const value = django.formats[format_type]; 103 if (typeof value === 'undefined') { 104 return format_type; 105 } else { 106 return value; 107 } 108 }; 109 110 /* add to global namespace */ 111 globals.pluralidx = django.pluralidx; 112 globals.gettext = django.gettext; 113 globals.ngettext = django.ngettext; 114 globals.gettext_noop = django.gettext_noop; 115 globals.pgettext = django.pgettext; 116 globals.npgettext = django.npgettext; 117 globals.interpolate = django.interpolate; 118 globals.get_format = django.get_format; 119 120 django.jsi18n_initialized = true; 121 } 122}; 123
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.