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