summaryrefslogtreecommitdiffstats
path: root/util/local_database/qlocalexml2cpp.py
diff options
context:
space:
mode:
authorZeno Albisser <zeno.albisser@nokia.com>2011-02-15 12:50:20 (GMT)
committerZeno Albisser <zeno.albisser@nokia.com>2011-02-15 15:58:03 (GMT)
commit049cc0e6717f684453d40f78e9ec0e9093df2c1d (patch)
tree57c6acce26322e35c36f3e306f8a2581c4d34be0 /util/local_database/qlocalexml2cpp.py
parent6f313a63d4155b53659917a3f7a71f4de60d0d91 (diff)
downloadQt-049cc0e6717f684453d40f78e9ec0e9093df2c1d.zip
Qt-049cc0e6717f684453d40f78e9ec0e9093df2c1d.tar.gz
Qt-049cc0e6717f684453d40f78e9ec0e9093df2c1d.tar.bz2
Implemented QLocale::firstDayOfWeek()
REMARK: This commit is missing updated static cldr data in src/corelib/tools/qlocale_data_p.h that has been left out intentionally to avoid repository bloating. Before compiling make sure to update that file using the scripts util/local_database/cldr2qlocalexml.py and util/local_database/qlocalexml2cpp.py. Otherwise you will most likely experience segmentation faults. Reviewed-By: Denis Dzyubenko
Diffstat (limited to 'util/local_database/qlocalexml2cpp.py')
-rwxr-xr-xutil/local_database/qlocalexml2cpp.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/util/local_database/qlocalexml2cpp.py b/util/local_database/qlocalexml2cpp.py
index 9251e1f..9bc3c7e 100755
--- a/util/local_database/qlocalexml2cpp.py
+++ b/util/local_database/qlocalexml2cpp.py
@@ -188,6 +188,10 @@ def convertFormat(format):
return result
+def convertToQtDayOfWeek(firstDay):
+ qtDayOfWeek = {"mon":1, "tue":2, "wed":3, "thu":4, "fri":5, "sat":6, "sun":7}
+ return qtDayOfWeek[firstDay]
+
class Locale:
def __init__(self, elt):
self.language = eltText(firstChildElt(elt, "language"))
@@ -202,6 +206,7 @@ class Locale:
self.exp = int(eltText(firstChildElt(elt, "exp")))
self.am = eltText(firstChildElt(elt, "am"))
self.pm = eltText(firstChildElt(elt, "pm"))
+ self.firstDayOfWeek = convertToQtDayOfWeek(eltText(firstChildElt(elt, "firstDayOfWeek")))
self.longDateFormat = convertFormat(eltText(firstChildElt(elt, "longDateFormat")))
self.shortDateFormat = convertFormat(eltText(firstChildElt(elt, "shortDateFormat")))
self.longTimeFormat = convertFormat(eltText(firstChildElt(elt, "longTimeFormat")))
@@ -397,7 +402,7 @@ def main():
for key in locale_keys:
l = locale_map[key]
- print " { %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" \
+ print " { %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,%6d }, // %s/%s" \
% (key[0], key[1],
l.decimal,
l.group,
@@ -425,9 +430,10 @@ def main():
days_data.append(l.narrowDays),
am_data.append(l.am),
pm_data.append(l.pm),
+ l.firstDayOfWeek,
l.language,
l.country)
- print " { 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"
+ print " { 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"
print "};"
print