0
|
1 |
#!/usr/bin/env python
|
|
2 |
#############################################################################
|
|
3 |
##
|
|
4 |
## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
5 |
## All rights reserved.
|
|
6 |
## Contact: Nokia Corporation (qt-info@nokia.com)
|
|
7 |
##
|
|
8 |
## This file is part of the test suite of the Qt Toolkit.
|
|
9 |
##
|
|
10 |
## $QT_BEGIN_LICENSE:LGPL$
|
|
11 |
## No Commercial Usage
|
|
12 |
## This file contains pre-release code and may not be distributed.
|
|
13 |
## You may use this file in accordance with the terms and conditions
|
|
14 |
## contained in the Technology Preview License Agreement accompanying
|
|
15 |
## this package.
|
|
16 |
##
|
|
17 |
## GNU Lesser General Public License Usage
|
|
18 |
## Alternatively, this file may be used under the terms of the GNU Lesser
|
|
19 |
## General Public License version 2.1 as published by the Free Software
|
|
20 |
## Foundation and appearing in the file LICENSE.LGPL included in the
|
|
21 |
## packaging of this file. Please review the following information to
|
|
22 |
## ensure the GNU Lesser General Public License version 2.1 requirements
|
|
23 |
## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
24 |
##
|
|
25 |
## In addition, as a special exception, Nokia gives you certain additional
|
|
26 |
## rights. These rights are described in the Nokia Qt LGPL Exception
|
|
27 |
## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
28 |
##
|
|
29 |
## If you have questions regarding the use of this file, please contact
|
|
30 |
## Nokia at qt-info@nokia.com.
|
|
31 |
##
|
|
32 |
##
|
|
33 |
##
|
|
34 |
##
|
|
35 |
##
|
|
36 |
##
|
|
37 |
##
|
|
38 |
##
|
|
39 |
## $QT_END_LICENSE$
|
|
40 |
##
|
|
41 |
#############################################################################
|
|
42 |
|
|
43 |
import os
|
|
44 |
import sys
|
|
45 |
import enumdata
|
|
46 |
import xpathlite
|
|
47 |
from xpathlite import DraftResolution
|
|
48 |
import re
|
|
49 |
|
|
50 |
findEntry = xpathlite.findEntry
|
|
51 |
|
|
52 |
def ordStr(c):
|
|
53 |
if len(c) == 1:
|
|
54 |
return str(ord(c))
|
|
55 |
return "##########"
|
|
56 |
|
|
57 |
# the following functions are supposed to fix the problem with QLocale
|
|
58 |
# returning a character instead of strings for QLocale::exponential()
|
|
59 |
# and others. So we fallback to default values in these cases.
|
|
60 |
def fixOrdStrExp(c):
|
|
61 |
if len(c) == 1:
|
|
62 |
return str(ord(c))
|
|
63 |
return str(ord('e'))
|
|
64 |
def fixOrdStrPercent(c):
|
|
65 |
if len(c) == 1:
|
|
66 |
return str(ord(c))
|
|
67 |
return str(ord('%'))
|
|
68 |
def fixOrdStrList(c):
|
|
69 |
if len(c) == 1:
|
|
70 |
return str(ord(c))
|
|
71 |
return str(ord(';'))
|
|
72 |
|
|
73 |
def generateLocaleInfo(path):
|
|
74 |
(dir_name, file_name) = os.path.split(path)
|
|
75 |
|
|
76 |
exp = re.compile(r"([a-z]+)_([A-Z]{2})\.xml")
|
|
77 |
m = exp.match(file_name)
|
|
78 |
if not m:
|
|
79 |
return {}
|
|
80 |
|
|
81 |
language_code = m.group(1)
|
|
82 |
country_code = m.group(2)
|
|
83 |
|
|
84 |
language_id = enumdata.languageCodeToId(language_code)
|
|
85 |
if language_id == -1:
|
|
86 |
sys.stderr.write("unnknown language code \"" + language_code + "\"\n")
|
|
87 |
return {}
|
|
88 |
language = enumdata.language_list[language_id][0]
|
|
89 |
|
|
90 |
country_id = enumdata.countryCodeToId(country_code)
|
|
91 |
if country_id == -1:
|
|
92 |
sys.stderr.write("unnknown country code \"" + country_code + "\"\n")
|
|
93 |
return {}
|
|
94 |
country = enumdata.country_list[country_id][0]
|
|
95 |
|
|
96 |
base = dir_name + "/" + language_code + "_" + country_code
|
|
97 |
|
|
98 |
result = {}
|
|
99 |
result['base'] = base
|
|
100 |
|
|
101 |
result['language'] = language
|
|
102 |
result['country'] = country
|
|
103 |
result['language_id'] = language_id
|
|
104 |
result['country_id'] = country_id
|
|
105 |
result['decimal'] = findEntry(base, "numbers/symbols/decimal")
|
|
106 |
result['group'] = findEntry(base, "numbers/symbols/group")
|
|
107 |
result['list'] = findEntry(base, "numbers/symbols/list")
|
|
108 |
result['percent'] = findEntry(base, "numbers/symbols/percentSign")
|
|
109 |
result['zero'] = findEntry(base, "numbers/symbols/nativeZeroDigit")
|
|
110 |
result['minus'] = findEntry(base, "numbers/symbols/minusSign")
|
|
111 |
result['plus'] = findEntry(base, "numbers/symbols/plusSign")
|
|
112 |
result['exp'] = findEntry(base, "numbers/symbols/exponential").lower()
|
|
113 |
result['am'] = findEntry(base, "dates/calendars/calendar[gregorian]/am", draft=DraftResolution.approved)
|
|
114 |
result['pm'] = findEntry(base, "dates/calendars/calendar[gregorian]/pm", draft=DraftResolution.approved)
|
|
115 |
result['longDateFormat'] = findEntry(base, "dates/calendars/calendar[gregorian]/dateFormats/dateFormatLength[full]/dateFormat/pattern")
|
|
116 |
result['shortDateFormat'] = findEntry(base, "dates/calendars/calendar[gregorian]/dateFormats/dateFormatLength[short]/dateFormat/pattern")
|
|
117 |
result['longTimeFormat'] = findEntry(base, "dates/calendars/calendar[gregorian]/timeFormats/timeFormatLength[full]/timeFormat/pattern")
|
|
118 |
result['shortTimeFormat'] = findEntry(base, "dates/calendars/calendar[gregorian]/timeFormats/timeFormatLength[short]/timeFormat/pattern")
|
|
119 |
|
|
120 |
standalone_long_month_path = "dates/calendars/calendar[gregorian]/months/monthContext[stand-alone]/monthWidth[wide]/month"
|
|
121 |
result['standaloneLongMonths'] \
|
|
122 |
= findEntry(base, standalone_long_month_path + "[1]") + ";" \
|
|
123 |
+ findEntry(base, standalone_long_month_path + "[2]") + ";" \
|
|
124 |
+ findEntry(base, standalone_long_month_path + "[3]") + ";" \
|
|
125 |
+ findEntry(base, standalone_long_month_path + "[4]") + ";" \
|
|
126 |
+ findEntry(base, standalone_long_month_path + "[5]") + ";" \
|
|
127 |
+ findEntry(base, standalone_long_month_path + "[6]") + ";" \
|
|
128 |
+ findEntry(base, standalone_long_month_path + "[7]") + ";" \
|
|
129 |
+ findEntry(base, standalone_long_month_path + "[8]") + ";" \
|
|
130 |
+ findEntry(base, standalone_long_month_path + "[9]") + ";" \
|
|
131 |
+ findEntry(base, standalone_long_month_path + "[10]") + ";" \
|
|
132 |
+ findEntry(base, standalone_long_month_path + "[11]") + ";" \
|
|
133 |
+ findEntry(base, standalone_long_month_path + "[12]") + ";"
|
|
134 |
|
|
135 |
standalone_short_month_path = "dates/calendars/calendar[gregorian]/months/monthContext[stand-alone]/monthWidth[abbreviated]/month"
|
|
136 |
result['standaloneShortMonths'] \
|
|
137 |
= findEntry(base, standalone_short_month_path + "[1]") + ";" \
|
|
138 |
+ findEntry(base, standalone_short_month_path + "[2]") + ";" \
|
|
139 |
+ findEntry(base, standalone_short_month_path + "[3]") + ";" \
|
|
140 |
+ findEntry(base, standalone_short_month_path + "[4]") + ";" \
|
|
141 |
+ findEntry(base, standalone_short_month_path + "[5]") + ";" \
|
|
142 |
+ findEntry(base, standalone_short_month_path + "[6]") + ";" \
|
|
143 |
+ findEntry(base, standalone_short_month_path + "[7]") + ";" \
|
|
144 |
+ findEntry(base, standalone_short_month_path + "[8]") + ";" \
|
|
145 |
+ findEntry(base, standalone_short_month_path + "[9]") + ";" \
|
|
146 |
+ findEntry(base, standalone_short_month_path + "[10]") + ";" \
|
|
147 |
+ findEntry(base, standalone_short_month_path + "[11]") + ";" \
|
|
148 |
+ findEntry(base, standalone_short_month_path + "[12]") + ";"
|
|
149 |
|
|
150 |
standalone_narrow_month_path = "dates/calendars/calendar[gregorian]/months/monthContext[stand-alone]/monthWidth[narrow]/month"
|
|
151 |
result['standaloneNarrowMonths'] \
|
|
152 |
= findEntry(base, standalone_narrow_month_path + "[1]") + ";" \
|
|
153 |
+ findEntry(base, standalone_narrow_month_path + "[2]") + ";" \
|
|
154 |
+ findEntry(base, standalone_narrow_month_path + "[3]") + ";" \
|
|
155 |
+ findEntry(base, standalone_narrow_month_path + "[4]") + ";" \
|
|
156 |
+ findEntry(base, standalone_narrow_month_path + "[5]") + ";" \
|
|
157 |
+ findEntry(base, standalone_narrow_month_path + "[6]") + ";" \
|
|
158 |
+ findEntry(base, standalone_narrow_month_path + "[7]") + ";" \
|
|
159 |
+ findEntry(base, standalone_narrow_month_path + "[8]") + ";" \
|
|
160 |
+ findEntry(base, standalone_narrow_month_path + "[9]") + ";" \
|
|
161 |
+ findEntry(base, standalone_narrow_month_path + "[10]") + ";" \
|
|
162 |
+ findEntry(base, standalone_narrow_month_path + "[11]") + ";" \
|
|
163 |
+ findEntry(base, standalone_narrow_month_path + "[12]") + ";"
|
|
164 |
|
|
165 |
long_month_path = "dates/calendars/calendar[gregorian]/months/monthContext[format]/monthWidth[wide]/month"
|
|
166 |
result['longMonths'] \
|
|
167 |
= findEntry(base, long_month_path + "[1]") + ";" \
|
|
168 |
+ findEntry(base, long_month_path + "[2]") + ";" \
|
|
169 |
+ findEntry(base, long_month_path + "[3]") + ";" \
|
|
170 |
+ findEntry(base, long_month_path + "[4]") + ";" \
|
|
171 |
+ findEntry(base, long_month_path + "[5]") + ";" \
|
|
172 |
+ findEntry(base, long_month_path + "[6]") + ";" \
|
|
173 |
+ findEntry(base, long_month_path + "[7]") + ";" \
|
|
174 |
+ findEntry(base, long_month_path + "[8]") + ";" \
|
|
175 |
+ findEntry(base, long_month_path + "[9]") + ";" \
|
|
176 |
+ findEntry(base, long_month_path + "[10]") + ";" \
|
|
177 |
+ findEntry(base, long_month_path + "[11]") + ";" \
|
|
178 |
+ findEntry(base, long_month_path + "[12]") + ";"
|
|
179 |
|
|
180 |
short_month_path = "dates/calendars/calendar[gregorian]/months/monthContext[format]/monthWidth[abbreviated]/month"
|
|
181 |
result['shortMonths'] \
|
|
182 |
= findEntry(base, short_month_path + "[1]") + ";" \
|
|
183 |
+ findEntry(base, short_month_path + "[2]") + ";" \
|
|
184 |
+ findEntry(base, short_month_path + "[3]") + ";" \
|
|
185 |
+ findEntry(base, short_month_path + "[4]") + ";" \
|
|
186 |
+ findEntry(base, short_month_path + "[5]") + ";" \
|
|
187 |
+ findEntry(base, short_month_path + "[6]") + ";" \
|
|
188 |
+ findEntry(base, short_month_path + "[7]") + ";" \
|
|
189 |
+ findEntry(base, short_month_path + "[8]") + ";" \
|
|
190 |
+ findEntry(base, short_month_path + "[9]") + ";" \
|
|
191 |
+ findEntry(base, short_month_path + "[10]") + ";" \
|
|
192 |
+ findEntry(base, short_month_path + "[11]") + ";" \
|
|
193 |
+ findEntry(base, short_month_path + "[12]") + ";"
|
|
194 |
|
|
195 |
narrow_month_path = "dates/calendars/calendar[gregorian]/months/monthContext[format]/monthWidth[narrow]/month"
|
|
196 |
result['narrowMonths'] \
|
|
197 |
= findEntry(base, narrow_month_path + "[1]") + ";" \
|
|
198 |
+ findEntry(base, narrow_month_path + "[2]") + ";" \
|
|
199 |
+ findEntry(base, narrow_month_path + "[3]") + ";" \
|
|
200 |
+ findEntry(base, narrow_month_path + "[4]") + ";" \
|
|
201 |
+ findEntry(base, narrow_month_path + "[5]") + ";" \
|
|
202 |
+ findEntry(base, narrow_month_path + "[6]") + ";" \
|
|
203 |
+ findEntry(base, narrow_month_path + "[7]") + ";" \
|
|
204 |
+ findEntry(base, narrow_month_path + "[8]") + ";" \
|
|
205 |
+ findEntry(base, narrow_month_path + "[9]") + ";" \
|
|
206 |
+ findEntry(base, narrow_month_path + "[10]") + ";" \
|
|
207 |
+ findEntry(base, narrow_month_path + "[11]") + ";" \
|
|
208 |
+ findEntry(base, narrow_month_path + "[12]") + ";"
|
|
209 |
|
|
210 |
long_day_path = "dates/calendars/calendar[gregorian]/days/dayContext[format]/dayWidth[wide]/day"
|
|
211 |
result['longDays'] \
|
|
212 |
= findEntry(base, long_day_path + "[sun]") + ";" \
|
|
213 |
+ findEntry(base, long_day_path + "[mon]") + ";" \
|
|
214 |
+ findEntry(base, long_day_path + "[tue]") + ";" \
|
|
215 |
+ findEntry(base, long_day_path + "[wed]") + ";" \
|
|
216 |
+ findEntry(base, long_day_path + "[thu]") + ";" \
|
|
217 |
+ findEntry(base, long_day_path + "[fri]") + ";" \
|
|
218 |
+ findEntry(base, long_day_path + "[sat]") + ";"
|
|
219 |
|
|
220 |
short_day_path = "dates/calendars/calendar[gregorian]/days/dayContext[format]/dayWidth[abbreviated]/day"
|
|
221 |
result['shortDays'] \
|
|
222 |
= findEntry(base, short_day_path + "[sun]") + ";" \
|
|
223 |
+ findEntry(base, short_day_path + "[mon]") + ";" \
|
|
224 |
+ findEntry(base, short_day_path + "[tue]") + ";" \
|
|
225 |
+ findEntry(base, short_day_path + "[wed]") + ";" \
|
|
226 |
+ findEntry(base, short_day_path + "[thu]") + ";" \
|
|
227 |
+ findEntry(base, short_day_path + "[fri]") + ";" \
|
|
228 |
+ findEntry(base, short_day_path + "[sat]") + ";"
|
|
229 |
|
|
230 |
narrow_day_path = "dates/calendars/calendar[gregorian]/days/dayContext[format]/dayWidth[narrow]/day"
|
|
231 |
result['narrowDays'] \
|
|
232 |
= findEntry(base, narrow_day_path + "[sun]") + ";" \
|
|
233 |
+ findEntry(base, narrow_day_path + "[mon]") + ";" \
|
|
234 |
+ findEntry(base, narrow_day_path + "[tue]") + ";" \
|
|
235 |
+ findEntry(base, narrow_day_path + "[wed]") + ";" \
|
|
236 |
+ findEntry(base, narrow_day_path + "[thu]") + ";" \
|
|
237 |
+ findEntry(base, narrow_day_path + "[fri]") + ";" \
|
|
238 |
+ findEntry(base, narrow_day_path + "[sat]") + ";"
|
|
239 |
|
|
240 |
standalone_long_day_path = "dates/calendars/calendar[gregorian]/days/dayContext[stand-alone]/dayWidth[wide]/day"
|
|
241 |
result['standaloneLongDays'] \
|
|
242 |
= findEntry(base, standalone_long_day_path + "[sun]") + ";" \
|
|
243 |
+ findEntry(base, standalone_long_day_path + "[mon]") + ";" \
|
|
244 |
+ findEntry(base, standalone_long_day_path + "[tue]") + ";" \
|
|
245 |
+ findEntry(base, standalone_long_day_path + "[wed]") + ";" \
|
|
246 |
+ findEntry(base, standalone_long_day_path + "[thu]") + ";" \
|
|
247 |
+ findEntry(base, standalone_long_day_path + "[fri]") + ";" \
|
|
248 |
+ findEntry(base, standalone_long_day_path + "[sat]") + ";"
|
|
249 |
|
|
250 |
standalone_short_day_path = "dates/calendars/calendar[gregorian]/days/dayContext[stand-alone]/dayWidth[abbreviated]/day"
|
|
251 |
result['standaloneShortDays'] \
|
|
252 |
= findEntry(base, standalone_short_day_path + "[sun]") + ";" \
|
|
253 |
+ findEntry(base, standalone_short_day_path + "[mon]") + ";" \
|
|
254 |
+ findEntry(base, standalone_short_day_path + "[tue]") + ";" \
|
|
255 |
+ findEntry(base, standalone_short_day_path + "[wed]") + ";" \
|
|
256 |
+ findEntry(base, standalone_short_day_path + "[thu]") + ";" \
|
|
257 |
+ findEntry(base, standalone_short_day_path + "[fri]") + ";" \
|
|
258 |
+ findEntry(base, standalone_short_day_path + "[sat]") + ";"
|
|
259 |
|
|
260 |
standalone_narrow_day_path = "dates/calendars/calendar[gregorian]/days/dayContext[stand-alone]/dayWidth[narrow]/day"
|
|
261 |
result['standaloneNarrowDays'] \
|
|
262 |
= findEntry(base, standalone_narrow_day_path + "[sun]") + ";" \
|
|
263 |
+ findEntry(base, standalone_narrow_day_path + "[mon]") + ";" \
|
|
264 |
+ findEntry(base, standalone_narrow_day_path + "[tue]") + ";" \
|
|
265 |
+ findEntry(base, standalone_narrow_day_path + "[wed]") + ";" \
|
|
266 |
+ findEntry(base, standalone_narrow_day_path + "[thu]") + ";" \
|
|
267 |
+ findEntry(base, standalone_narrow_day_path + "[fri]") + ";" \
|
|
268 |
+ findEntry(base, standalone_narrow_day_path + "[sat]") + ";"
|
|
269 |
|
|
270 |
|
|
271 |
return result
|
|
272 |
|
|
273 |
def addEscapes(s):
|
|
274 |
result = ''
|
|
275 |
for c in s:
|
|
276 |
n = ord(c)
|
|
277 |
if n < 128:
|
|
278 |
result += c
|
|
279 |
else:
|
|
280 |
result += "\\x"
|
|
281 |
result += "%02x" % (n)
|
|
282 |
return result
|
|
283 |
|
|
284 |
def unicodeStr(s):
|
|
285 |
utf8 = s.encode('utf-8')
|
|
286 |
return "<size>" + str(len(utf8)) + "</size><data>" + addEscapes(utf8) + "</data>"
|
|
287 |
|
|
288 |
def usage():
|
|
289 |
print "Usage: cldr2qlocalexml.py <path-to-cldr-main>"
|
|
290 |
sys.exit()
|
|
291 |
|
|
292 |
if len(sys.argv) != 2:
|
|
293 |
usage()
|
|
294 |
|
|
295 |
cldr_dir = sys.argv[1]
|
|
296 |
|
|
297 |
if not os.path.isdir(cldr_dir):
|
|
298 |
usage()
|
|
299 |
|
|
300 |
cldr_files = os.listdir(cldr_dir)
|
|
301 |
|
|
302 |
locale_database = {}
|
|
303 |
for file in cldr_files:
|
|
304 |
l = generateLocaleInfo(cldr_dir + "/" + file)
|
|
305 |
if not l:
|
|
306 |
sys.stderr.write("skipping file \"" + file + "\"\n")
|
|
307 |
continue
|
|
308 |
|
|
309 |
locale_database[(l['language_id'], l['country_id'])] = l
|
|
310 |
|
|
311 |
locale_keys = locale_database.keys()
|
|
312 |
locale_keys.sort()
|
|
313 |
|
|
314 |
print "<localeDatabase>"
|
|
315 |
print " <languageList>"
|
|
316 |
for id in enumdata.language_list:
|
|
317 |
l = enumdata.language_list[id]
|
|
318 |
print " <language>"
|
|
319 |
print " <name>" + l[0] + "</name>"
|
|
320 |
print " <id>" + str(id) + "</id>"
|
|
321 |
print " <code>" + l[1] + "</code>"
|
|
322 |
print " </language>"
|
|
323 |
print " </languageList>"
|
|
324 |
|
|
325 |
print " <countryList>"
|
|
326 |
for id in enumdata.country_list:
|
|
327 |
l = enumdata.country_list[id]
|
|
328 |
print " <country>"
|
|
329 |
print " <name>" + l[0] + "</name>"
|
|
330 |
print " <id>" + str(id) + "</id>"
|
|
331 |
print " <code>" + l[1] + "</code>"
|
|
332 |
print " </country>"
|
|
333 |
print " </countryList>"
|
|
334 |
|
|
335 |
print \
|
|
336 |
" <defaultCountryList>\n\
|
|
337 |
<defaultCountry>\n\
|
|
338 |
<language>Afrikaans</language>\n\
|
|
339 |
<country>SouthAfrica</country>\n\
|
|
340 |
</defaultCountry>\n\
|
|
341 |
<defaultCountry>\n\
|
|
342 |
<language>Afan</language>\n\
|
|
343 |
<country>Ethiopia</country>\n\
|
|
344 |
</defaultCountry>\n\
|
|
345 |
<defaultCountry>\n\
|
|
346 |
<language>Afar</language>\n\
|
|
347 |
<country>Djibouti</country>\n\
|
|
348 |
</defaultCountry>\n\
|
|
349 |
<defaultCountry>\n\
|
|
350 |
<language>Arabic</language>\n\
|
|
351 |
<country>SaudiArabia</country>\n\
|
|
352 |
</defaultCountry>\n\
|
|
353 |
<defaultCountry>\n\
|
|
354 |
<language>Chinese</language>\n\
|
|
355 |
<country>China</country>\n\
|
|
356 |
</defaultCountry>\n\
|
|
357 |
<defaultCountry>\n\
|
|
358 |
<language>Dutch</language>\n\
|
|
359 |
<country>Netherlands</country>\n\
|
|
360 |
</defaultCountry>\n\
|
|
361 |
<defaultCountry>\n\
|
|
362 |
<language>English</language>\n\
|
|
363 |
<country>UnitedStates</country>\n\
|
|
364 |
</defaultCountry>\n\
|
|
365 |
<defaultCountry>\n\
|
|
366 |
<language>French</language>\n\
|
|
367 |
<country>France</country>\n\
|
|
368 |
</defaultCountry>\n\
|
|
369 |
<defaultCountry>\n\
|
|
370 |
<language>German</language>\n\
|
|
371 |
<country>Germany</country>\n\
|
|
372 |
</defaultCountry>\n\
|
|
373 |
<defaultCountry>\n\
|
|
374 |
<language>Greek</language>\n\
|
|
375 |
<country>Greece</country>\n\
|
|
376 |
</defaultCountry>\n\
|
|
377 |
<defaultCountry>\n\
|
|
378 |
<language>Italian</language>\n\
|
|
379 |
<country>Italy</country>\n\
|
|
380 |
</defaultCountry>\n\
|
|
381 |
<defaultCountry>\n\
|
|
382 |
<language>Malay</language>\n\
|
|
383 |
<country>Malaysia</country>\n\
|
|
384 |
</defaultCountry>\n\
|
|
385 |
<defaultCountry>\n\
|
|
386 |
<language>Portuguese</language>\n\
|
|
387 |
<country>Portugal</country>\n\
|
|
388 |
</defaultCountry>\n\
|
|
389 |
<defaultCountry>\n\
|
|
390 |
<language>Russian</language>\n\
|
|
391 |
<country>RussianFederation</country>\n\
|
|
392 |
</defaultCountry>\n\
|
|
393 |
<defaultCountry>\n\
|
|
394 |
<language>Serbian</language>\n\
|
|
395 |
<country>SerbiaAndMontenegro</country>\n\
|
|
396 |
</defaultCountry>\n\
|
|
397 |
<defaultCountry>\n\
|
|
398 |
<language>SerboCroatian</language>\n\
|
|
399 |
<country>SerbiaAndMontenegro</country>\n\
|
|
400 |
</defaultCountry>\n\
|
|
401 |
<defaultCountry>\n\
|
|
402 |
<language>Somali</language>\n\
|
|
403 |
<country>Somalia</country>\n\
|
|
404 |
</defaultCountry>\n\
|
|
405 |
<defaultCountry>\n\
|
|
406 |
<language>Spanish</language>\n\
|
|
407 |
<country>Spain</country>\n\
|
|
408 |
</defaultCountry>\n\
|
|
409 |
<defaultCountry>\n\
|
|
410 |
<language>Swahili</language>\n\
|
|
411 |
<country>Kenya</country>\n\
|
|
412 |
</defaultCountry>\n\
|
|
413 |
<defaultCountry>\n\
|
|
414 |
<language>Swedish</language>\n\
|
|
415 |
<country>Sweden</country>\n\
|
|
416 |
</defaultCountry>\n\
|
|
417 |
<defaultCountry>\n\
|
|
418 |
<language>Tigrinya</language>\n\
|
|
419 |
<country>Eritrea</country>\n\
|
|
420 |
</defaultCountry>\n\
|
|
421 |
<defaultCountry>\n\
|
|
422 |
<language>Uzbek</language>\n\
|
|
423 |
<country>Uzbekistan</country>\n\
|
|
424 |
</defaultCountry>\n\
|
|
425 |
<defaultCountry>\n\
|
|
426 |
<language>Persian</language>\n\
|
|
427 |
<country>Iran</country>\n\
|
|
428 |
</defaultCountry>\n\
|
|
429 |
</defaultCountryList>"
|
|
430 |
|
|
431 |
print " <localeList>"
|
|
432 |
print \
|
|
433 |
" <locale>\n\
|
|
434 |
<language>C</language>\n\
|
|
435 |
<country>AnyCountry</country>\n\
|
|
436 |
<decimal>46</decimal>\n\
|
|
437 |
<group>44</group>\n\
|
|
438 |
<list>59</list>\n\
|
|
439 |
<percent>37</percent>\n\
|
|
440 |
<zero>48</zero>\n\
|
|
441 |
<minus>45</minus>\n\
|
|
442 |
<plus>43</plus>\n\
|
|
443 |
<exp>101</exp>\n\
|
|
444 |
<am>AM</am>\n\
|
|
445 |
<pm>PM</pm>\n\
|
|
446 |
<longDateFormat>EEEE, d MMMM yyyy</longDateFormat>\n\
|
|
447 |
<shortDateFormat>d MMM yyyy</shortDateFormat>\n\
|
|
448 |
<longTimeFormat>HH:mm:ss z</longTimeFormat>\n\
|
|
449 |
<shortTimeFormat>HH:mm:ss</shortTimeFormat>\n\
|
|
450 |
<standaloneLongMonths>January;February;March;April;May;June;July;August;September;October;November;December;</standaloneLongMonths>\n\
|
|
451 |
<standaloneShortMonths>Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec;</standaloneShortMonths>\n\
|
|
452 |
<standaloneNarrowMonths>J;F;M;A;M;J;J;A;S;O;N;D;</standaloneNarrowMonths>\n\
|
|
453 |
<longMonths>January;February;March;April;May;June;July;August;September;October;November;December;</longMonths>\n\
|
|
454 |
<shortMonths>Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec;</shortMonths>\n\
|
|
455 |
<narrowMonths>1;2;3;4;5;6;7;8;9;10;11;12;</narrowMonths>\n\
|
|
456 |
<longDays>Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday;</longDays>\n\
|
|
457 |
<shortDays>Sun;Mon;Tue;Wed;Thu;Fri;Sat;</shortDays>\n\
|
|
458 |
<narrowDays>7;1;2;3;4;5;6;</narrowDays>\n\
|
|
459 |
<standaloneLongDays>Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday;</standaloneLongDays>\n\
|
|
460 |
<standaloneShortDays>Sun;Mon;Tue;Wed;Thu;Fri;Sat;</standaloneShortDays>\n\
|
|
461 |
<standaloneNarrowDays>S;M;T;W;T;F;S;</standaloneNarrowDays>\n\
|
|
462 |
</locale>"
|
|
463 |
|
|
464 |
for key in locale_keys:
|
|
465 |
l = locale_database[key]
|
|
466 |
|
|
467 |
print " <locale>"
|
|
468 |
# print " <source>" + l['base'] + "</source>"
|
|
469 |
print " <language>" + l['language'] + "</language>"
|
|
470 |
print " <country>" + l['country'] + "</country>"
|
|
471 |
print " <decimal>" + ordStr(l['decimal']) + "</decimal>"
|
|
472 |
print " <group>" + ordStr(l['group']) + "</group>"
|
|
473 |
print " <list>" + fixOrdStrList(l['list']) + "</list>"
|
|
474 |
print " <percent>" + fixOrdStrPercent(l['percent']) + "</percent>"
|
|
475 |
print " <zero>" + ordStr(l['zero']) + "</zero>"
|
|
476 |
print " <minus>" + ordStr(l['minus']) + "</minus>"
|
|
477 |
print " <plus>" + ordStr(l['plus']) + "</plus>"
|
|
478 |
print " <exp>" + fixOrdStrExp(l['exp']) + "</exp>"
|
|
479 |
print " <am>" + l['am'].encode('utf-8') + "</am>"
|
|
480 |
print " <pm>" + l['pm'].encode('utf-8') + "</pm>"
|
|
481 |
print " <longDateFormat>" + l['longDateFormat'].encode('utf-8') + "</longDateFormat>"
|
|
482 |
print " <shortDateFormat>" + l['shortDateFormat'].encode('utf-8') + "</shortDateFormat>"
|
|
483 |
print " <longTimeFormat>" + l['longTimeFormat'].encode('utf-8') + "</longTimeFormat>"
|
|
484 |
print " <shortTimeFormat>" + l['shortTimeFormat'].encode('utf-8') + "</shortTimeFormat>"
|
|
485 |
print " <standaloneLongMonths>" + l['standaloneLongMonths'].encode('utf-8') + "</standaloneLongMonths>"
|
|
486 |
print " <standaloneShortMonths>"+ l['standaloneShortMonths'].encode('utf-8') + "</standaloneShortMonths>"
|
|
487 |
print " <standaloneNarrowMonths>"+ l['standaloneNarrowMonths'].encode('utf-8') + "</standaloneNarrowMonths>"
|
|
488 |
print " <longMonths>" + l['longMonths'].encode('utf-8') + "</longMonths>"
|
|
489 |
print " <shortMonths>" + l['shortMonths'].encode('utf-8') + "</shortMonths>"
|
|
490 |
print " <narrowMonths>" + l['narrowMonths'].encode('utf-8') + "</narrowMonths>"
|
|
491 |
print " <longDays>" + l['longDays'].encode('utf-8') + "</longDays>"
|
|
492 |
print " <shortDays>" + l['shortDays'].encode('utf-8') + "</shortDays>"
|
|
493 |
print " <narrowDays>" + l['narrowDays'].encode('utf-8') + "</narrowDays>"
|
|
494 |
print " <standaloneLongDays>" + l['standaloneLongDays'].encode('utf-8') + "</standaloneLongDays>"
|
|
495 |
print " <standaloneShortDays>" + l['standaloneShortDays'].encode('utf-8') + "</standaloneShortDays>"
|
|
496 |
print " <standaloneNarrowDays>" + l['standaloneNarrowDays'].encode('utf-8') + "</standaloneNarrowDays>"
|
|
497 |
print " </locale>"
|
|
498 |
print " </localeList>"
|
|
499 |
print "</localeDatabase>"
|