This file is indexed.

/usr/lib/python2.7/dist-packages/trytond/ir/gen_time_locale.py is in tryton-server 3.0.2-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
#This file is part of Tryton.  The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
import time
import locale
import os
import pprint

_LOCALE2WIN32 = {
    'af_ZA': 'Afrikaans_South Africa',
    'ar_AE': 'Arabic_UAE',
    'ar_BH': 'Arabic_Bahrain',
    'ar_DZ': 'Arabic_Algeria',
    'ar_EG': 'Arabic_Egypt',
    'ar_IQ': 'Arabic_Iraq',
    'ar_JO': 'Arabic_Jordan',
    'ar_KW': 'Arabic_Kuwait',
    'ar_LB': 'Arabic_Lebanon',
    'ar_LY': 'Arabic_Libya',
    'ar_MA': 'Arabic_Morocco',
    'ar_OM': 'Arabic_Oman',
    'ar_QA': 'Arabic_Qatar',
    'ar_SA': 'Arabic_Saudi_Arabia',
    'ar_SY': 'Arabic_Syria',
    'ar_TN': 'Arabic_Tunisia',
    'ar_YE': 'Arabic_Yemen',
    'az-Cyrl-AZ': 'Azeri_Cyrillic',
    'az-Latn-AZ': 'Azeri_Latin',
    'be_BY': 'Belarusian_Belarus',
    'bg_BG': 'Bulgarian_Bulgaria',
    'bs_BA': 'Serbian (Latin)',
    'ca_ES': 'Catalan_Spain',
    'cs_CZ': 'Czech_Czech Republic',
    'da_DK': 'Danish_Denmark',
    'de_AT': 'German_Austrian',
    'de_CH': 'German_Swiss',
    'de_DE': 'German_Germany',
    'de_LI': 'German_Liechtenstein',
    'de_LU': 'German_Luxembourg',
    'el_GR': 'Greek_Greece',
    'en_AU': 'English_Australian',
    'en_BZ': 'English_Belize',
    'en_CA': 'English_Canadian',
    'en_IE': 'English_Irish',
    'en_JM': 'English_Jamaica',
    'en_TT': 'English_Trinidad',
    'en_US': 'English_USA',
    'en_ZW': 'English_Zimbabwe',
    'es_AR': 'Spanish_Argentina',
    'es_BO': 'Spanish_Bolivia',
    'es_CL': 'Spanish_Chile',
    'es_CO': 'Spanish_Colombia',
    'es_CR': 'Spanish_Costa_Rica',
    'es_DO': 'Spanish_Dominican_Republic',
    'es_EC': 'Spanish_Ecuador',
    'es_ES': 'Spanish_Spain',
    'es_ES_tradnl': 'Spanish_Traditional_Sort',
    'es_GT': 'Spanish_Guatemala',
    'es_HN': 'Spanish_Honduras',
    'es_MX': 'Spanish_Mexican',
    'es_NI': 'Spanish_Nicaragua',
    'es_PA': 'Spanish_Panama',
    'es_PE': 'Spanish_Peru',
    'es_PR': 'Spanish_Puerto_Rico',
    'es_PY': 'Spanish_Paraguay',
    'es_SV': 'Spanish_El_Salvador',
    'es_UY': 'Spanish_Uruguay',
    'es_VE': 'Spanish_Venezuela',
    'et_EE': 'Estonian_Estonia',
    'eu_ES': 'Basque_Spain',
    'fa_IR': 'Farsi_Iran',
    'fi_FI': 'Finnish_Finland',
    'fr_BE': 'French_Belgian',
    'fr_CA': 'French_Canadian',
    'fr_CH': 'French_Swiss',
    'fr_FR': 'French_France',
    'fr_LU': 'French_Luxembourg',
    'fr_MC': 'French_Monaco',
    'ga': 'Scottish Gaelic',
    'gl_ES': 'Galician_Spain',
    'gu': 'Gujarati_India',
    'he_IL': 'Hebrew',
    'he_IL': 'Hebrew_Israel',
    'hi_IN': 'Hindi',
    'hi_IN': 'Hindi',
    'hr_HR': 'Croatian',
    'hu_HU': 'Hungarian',
    'hu': 'Hungarian_Hungary',
    'hy_AM': 'Armenian',
    'id_ID': 'Indonesian_indonesia',
    'is_IS': 'Icelandic_Iceland',
    'it_CH': 'Italian_Swiss',
    'it_IT': 'Italian_Italy',
    'ja_JP': 'Japanese_Japan',
    'ka_GE': 'Georgian_Georgia',
    'kk_KZ': 'Kazakh',
    'km_KH': 'Khmer',
    'kn_IN': 'Kannada',
    'ko_IN': 'Konkani',
    'ko_KR': 'Korean_Korea',
    'lo_LA': 'Lao_Laos',
    'lt_LT': 'Lithuanian_Lithuania',
    'lv_LV': 'Latvian_Latvia',
    'mi_NZ': 'Maori',
    'mi_NZ': 'Maori',
    'mi_NZ': 'Maori',
    'mk_MK': 'Macedonian',
    'ml_IN': 'Malayalam_India',
    'mn': 'Cyrillic_Mongolian',
    'mr_IN': 'Marathi',
    'ms_BN': 'Malay_Brunei_Darussalam',
    'ms_MY': 'Malay_Malaysia',
    'nb_NO': 'Norwegian_Bokmal',
    'nl_BE': 'Dutch_Belgian',
    'nl_NL': 'Dutch_Netherlands',
    'nn_NO': 'Norwegian-Nynorsk_Norway',
    'ph_PH': 'Filipino_Philippines',
    'pl_PL': 'Polish_Poland',
    'pt_BR': 'Portuguese_Brazil',
    'pt_PT': 'Portuguese_Portugal',
    'ro_RO': 'Romanian_Romania',
    'ru_RU': 'Russian_Russia',
    'sa_IN': 'Sanskrit',
    'sk_SK': 'Slovak_Slovakia',
    'sl_SI': 'Slovenian_Slovenia',
    'sq_AL': 'Albanian_Albania',
    'sr_CS': 'Serbian (Cyrillic)_Serbia and Montenegro',
    'sv_FI': 'Swedish_Finland',
    'sv_SE': 'Swedish_Sweden',
    'sw_KE': 'Swahili',
    'ta_IN': 'Tamil',
    'th_TH': 'Thai_Thailand',
    'tr_IN': 'Urdu',
    'tr_TR': 'Turkish_Turkey',
    'tt_RU': 'Tatar',
    'uk_UA': 'Ukrainian_Ukraine',
    'uz-Cyrl_UZ': 'Uzbek_Cyrillic',
    'uz-Latn_UZ': 'Uzbek_Latin',
    'vi_VN': 'Vietnamese_Viet Nam',
    'zh_CN': 'Chinese_PRC',
    'zh_HK': 'Chinese_Hong_Kong',
    'zh_MO': 'Chinese_Macau',
    'zh_SG': 'Chinese_Singapore',
    'zh_TW': 'Chinese_Taiwan',
}


def locale_strftime(lang):
    time_locale = {
        '%a': [],
        '%A': [],
        '%b': [None],
        '%B': [None],
        '%p': [],
    }
    encoding = locale.getdefaultlocale()[1]
    if not encoding:
        encoding = 'UTF-8'
    if encoding.lower() in ('utf', 'utf8'):
        encoding = 'UTF-8'
    if encoding == 'cp1252':
        encoding = '1252'
    if os.name == 'nt':
        lang = _LOCALE2WIN32.get(lang, lang)
    locale.setlocale(locale.LC_ALL, lang + '.' + encoding)
    t = list(time.gmtime())
    for i in range(12):
        t[1] = i + 1
        for format in ('%b', '%B'):
            time_locale[format].append(time.strftime(format,
                t).decode(encoding))
    for i in range(7):
        t[6] = i
        for format in ('%a', '%A'):
            time_locale[format].append(time.strftime(format,
                t).decode(encoding))
    t[3] = 0
    time_locale['%p'].append(time.strftime('%p', t).decode(encoding))
    t[3] = 23
    time_locale['%p'].append(time.strftime('%p', t).decode(encoding))
    return time_locale

if __name__ == '__main__':
    with open(os.path.join(os.path.dirname(__file__), 'time_locale.py'),
            'w') as fp:
        fp.write('''# -*- coding: utf-8 -*-
#This file is part of Tryton.  The COPYRIGHT file at the top level of')
#this repository contains the full copyright notices and license terms.')
''')
        time_locale = {}
        fp.write('TIME_LOCALE = \\\n')
        for lang in [
                'bg_BG',
                'ca_ES',
                'cs_CZ',
                'de_DE',
                'en_US',
                'es_AR',
                'es_ES',
                'es_CO',
                'fr_FR',
                'nl_NL',
                'ru_RU',
                ]:
            time_locale[lang] = locale_strftime(lang)
            #fp.write('"' + lang + '": ' + repr(time_locale) + ',\n')
        #fp.write('}\n')
        pp = pprint.PrettyPrinter(stream=fp)
        pp.pprint(time_locale)