diff options
author | Zeno Albisser <zeno.albisser@nokia.com> | 2011-02-22 14:41:59 (GMT) |
---|---|---|
committer | Zeno Albisser <zeno.albisser@nokia.com> | 2011-02-24 11:42:45 (GMT) |
commit | 3def7f4dd09f5d93f90d20eaedd17d8bd8c4a6fd (patch) | |
tree | fd47efebc5b57ba135253fdb06eaf2e3d3024468 /util | |
parent | c9071e8f9a26dee3a166579df69da11e0f6323fa (diff) | |
download | Qt-3def7f4dd09f5d93f90d20eaedd17d8bd8c4a6fd.zip Qt-3def7f4dd09f5d93f90d20eaedd17d8bd8c4a6fd.tar.gz Qt-3def7f4dd09f5d93f90d20eaedd17d8bd8c4a6fd.tar.bz2 |
Implemented QLocale::weekendStart and QLocale::weekendEnd
Reviewed-by: Denis Dzyubenko
Task-number: QTBUG-17088
Diffstat (limited to 'util')
-rwxr-xr-x | util/local_database/cldr2qlocalexml.py | 62 | ||||
-rwxr-xr-x | util/local_database/qlocalexml2cpp.py | 8 |
2 files changed, 68 insertions, 2 deletions
diff --git a/util/local_database/cldr2qlocalexml.py b/util/local_database/cldr2qlocalexml.py index 0bc1664..c70cf18 100755 --- a/util/local_database/cldr2qlocalexml.py +++ b/util/local_database/cldr2qlocalexml.py @@ -413,6 +413,22 @@ def integrateWeekData(filePath): satFirstDayIn = findEntryInFile(filePath, "weekData/firstDay[day=sat]", attribute="territories")[0].split(" ") sunFirstDayIn = findEntryInFile(filePath, "weekData/firstDay[day=sun]", attribute="territories")[0].split(" ") + monWeekendStart = findEntryInFile(filePath, "weekData/weekendStart[day=mon]", attribute="territories")[0].split(" ") + tueWeekendStart = findEntryInFile(filePath, "weekData/weekendStart[day=tue]", attribute="territories")[0].split(" ") + wedWeekendStart = findEntryInFile(filePath, "weekData/weekendStart[day=wed]", attribute="territories")[0].split(" ") + thuWeekendStart = findEntryInFile(filePath, "weekData/weekendStart[day=thu]", attribute="territories")[0].split(" ") + friWeekendStart = findEntryInFile(filePath, "weekData/weekendStart[day=fri]", attribute="territories")[0].split(" ") + satWeekendStart = findEntryInFile(filePath, "weekData/weekendStart[day=sat]", attribute="territories")[0].split(" ") + sunWeekendStart = findEntryInFile(filePath, "weekData/weekendStart[day=sun]", attribute="territories")[0].split(" ") + + monWeekendEnd = findEntryInFile(filePath, "weekData/weekendEnd[day=mon]", attribute="territories")[0].split(" ") + tueWeekendEnd = findEntryInFile(filePath, "weekData/weekendEnd[day=tue]", attribute="territories")[0].split(" ") + wedWeekendEnd = findEntryInFile(filePath, "weekData/weekendEnd[day=wed]", attribute="territories")[0].split(" ") + thuWeekendEnd = findEntryInFile(filePath, "weekData/weekendEnd[day=thu]", attribute="territories")[0].split(" ") + friWeekendEnd = findEntryInFile(filePath, "weekData/weekendEnd[day=fri]", attribute="territories")[0].split(" ") + satWeekendEnd = findEntryInFile(filePath, "weekData/weekendEnd[day=sat]", attribute="territories")[0].split(" ") + sunWeekendEnd = findEntryInFile(filePath, "weekData/weekendEnd[day=sun]", attribute="territories")[0].split(" ") + firstDayByCountryCode = {} for countryCode in monFirstDayIn: firstDayByCountryCode[countryCode] = "mon" @@ -429,6 +445,38 @@ def integrateWeekData(filePath): for countryCode in sunFirstDayIn: firstDayByCountryCode[countryCode] = "sun" + weekendStartByCountryCode = {} + for countryCode in monWeekendStart: + weekendStartByCountryCode[countryCode] = "mon" + for countryCode in tueWeekendStart: + weekendStartByCountryCode[countryCode] = "tue" + for countryCode in wedWeekendStart: + weekendStartByCountryCode[countryCode] = "wed" + for countryCode in thuWeekendStart: + weekendStartByCountryCode[countryCode] = "thu" + for countryCode in friWeekendStart: + weekendStartByCountryCode[countryCode] = "fri" + for countryCode in satWeekendStart: + weekendStartByCountryCode[countryCode] = "sat" + for countryCode in sunWeekendStart: + weekendStartByCountryCode[countryCode] = "sun" + + weekendEndByCountryCode = {} + for countryCode in monWeekendEnd: + weekendEndByCountryCode[countryCode] = "mon" + for countryCode in tueWeekendEnd: + weekendEndByCountryCode[countryCode] = "tue" + for countryCode in wedWeekendEnd: + weekendEndByCountryCode[countryCode] = "wed" + for countryCode in thuWeekendEnd: + weekendEndByCountryCode[countryCode] = "thu" + for countryCode in friWeekendEnd: + weekendEndByCountryCode[countryCode] = "fri" + for countryCode in satWeekendEnd: + weekendEndByCountryCode[countryCode] = "sat" + for countryCode in sunWeekendEnd: + weekendEndByCountryCode[countryCode] = "sun" + for (key,locale) in locale_database.iteritems(): countryCode = locale['country_code'] if countryCode in firstDayByCountryCode: @@ -436,6 +484,16 @@ def integrateWeekData(filePath): else: locale_database[key]['firstDayOfWeek'] = firstDayByCountryCode["001"] + if countryCode in weekendStartByCountryCode: + locale_database[key]['weekendStart'] = weekendStartByCountryCode[countryCode] + else: + locale_database[key]['weekendStart'] = weekendStartByCountryCode["001"] + + if countryCode in weekendEndByCountryCode: + locale_database[key]['weekendEnd'] = weekendEndByCountryCode[countryCode] + else: + locale_database[key]['weekendEnd'] = weekendEndByCountryCode["001"] + if len(sys.argv) != 2: usage() @@ -611,6 +669,8 @@ print \ <am>AM</am>\n\ <pm>PM</pm>\n\ <firstDayOfWeek>mon</firstDayOfWeek>\n\ + <weekendStart>sat</weekendStart>\n\ + <weekendEnd>sun</weekendEnd>\n\ <longDateFormat>EEEE, d MMMM yyyy</longDateFormat>\n\ <shortDateFormat>d MMM yyyy</shortDateFormat>\n\ <longTimeFormat>HH:mm:ss z</longTimeFormat>\n\ @@ -659,6 +719,8 @@ for key in locale_keys: print " <am>" + l['am'].encode('utf-8') + "</am>" print " <pm>" + l['pm'].encode('utf-8') + "</pm>" print " <firstDayOfWeek>" + l['firstDayOfWeek'].encode('utf-8') + "</firstDayOfWeek>" + print " <weekendStart>" + l['weekendStart'].encode('utf-8') + "</weekendStart>" + print " <weekendEnd>" + l['weekendEnd'].encode('utf-8') + "</weekendEnd>" print " <longDateFormat>" + l['longDateFormat'].encode('utf-8') + "</longDateFormat>" print " <shortDateFormat>" + l['shortDateFormat'].encode('utf-8') + "</shortDateFormat>" print " <longTimeFormat>" + l['longTimeFormat'].encode('utf-8') + "</longTimeFormat>" diff --git a/util/local_database/qlocalexml2cpp.py b/util/local_database/qlocalexml2cpp.py index 6b8fdb9..86adf90 100755 --- a/util/local_database/qlocalexml2cpp.py +++ b/util/local_database/qlocalexml2cpp.py @@ -218,6 +218,8 @@ class Locale: self.am = eltText(firstChildElt(elt, "am")) self.pm = eltText(firstChildElt(elt, "pm")) self.firstDayOfWeek = convertToQtDayOfWeek(eltText(firstChildElt(elt, "firstDayOfWeek"))) + self.weekendStart = convertToQtDayOfWeek(eltText(firstChildElt(elt, "weekendStart"))) + self.weekendEnd = convertToQtDayOfWeek(eltText(firstChildElt(elt, "weekendEnd"))) self.longDateFormat = convertFormat(eltText(firstChildElt(elt, "longDateFormat"))) self.shortDateFormat = convertFormat(eltText(firstChildElt(elt, "shortDateFormat"))) self.longTimeFormat = convertFormat(eltText(firstChildElt(elt, "longTimeFormat"))) @@ -451,7 +453,7 @@ def main(): for key in locale_keys: l = locale_map[key] - data_temp_file.write(" { %6d,%6d,%6d,%6d,%6d,%6d,%6d,%6d,%6d,%6d,%6d,%6d,%6d,%6d,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s, {%s}, %s,%s,%s,%s,%6d,%6d,%6d }, // %s/%s\n" \ + data_temp_file.write(" { %6d,%6d,%6d,%6d,%6d,%6d,%6d,%6d,%6d,%6d,%6d,%6d,%6d,%6d,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s, {%s}, %s,%s,%s,%s,%6d,%6d,%6d,%6d,%6d }, // %s/%s\n" \ % (key[0], key[1], l.decimal, l.group, @@ -491,9 +493,11 @@ def main(): l.currencyDigits, l.currencyRounding, l.firstDayOfWeek, + l.weekendStart, + l.weekendEnd, l.language, l.country)) - data_temp_file.write(" { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, {0,0,0}, 0,0, 0,0, 0,0, 0,0, 0, 0, 0 } // trailing 0s\n") + data_temp_file.write(" { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, {0,0,0}, 0,0, 0,0, 0,0, 0,0, 0, 0, 0, 0, 0 } // trailing 0s\n") data_temp_file.write("};\n") data_temp_file.write("\n") |