diff --git a/util/locale_database/cldr2qtimezone.py b/util/locale_database/cldr2qtimezone.py index 0817435d40..1c82e1d58f 100755 --- a/util/locale_database/cldr2qtimezone.py +++ b/util/locale_database/cldr2qtimezone.py @@ -89,169 +89,171 @@ class ByteArrayData: self.data += lst return index -# List of currently known Windows IDs. If script fails on missing ID plase add it here -# Not public so may be safely changed. -# Windows Key : [ Windows Id, Offset Seconds ] -windowsIdList = { - 1 : [ u'Afghanistan Standard Time', 16200 ], - 2 : [ u'Alaskan Standard Time', -32400 ], - 3 : [ u'Arab Standard Time', 10800 ], - 4 : [ u'Arabian Standard Time', 14400 ], - 5 : [ u'Arabic Standard Time', 10800 ], - 6 : [ u'Argentina Standard Time', -10800 ], - 7 : [ u'Atlantic Standard Time', -14400 ], - 8 : [ u'AUS Central Standard Time', 34200 ], - 9 : [ u'AUS Eastern Standard Time', 36000 ], - 10 : [ u'Azerbaijan Standard Time', 14400 ], - 11 : [ u'Azores Standard Time', -3600 ], - 12 : [ u'Bahia Standard Time', -10800 ], - 13 : [ u'Bangladesh Standard Time', 21600 ], - 14 : [ u'Belarus Standard Time', 10800 ], - 15 : [ u'Canada Central Standard Time', -21600 ], - 16 : [ u'Cape Verde Standard Time', -3600 ], - 17 : [ u'Caucasus Standard Time', 14400 ], - 18 : [ u'Cen. Australia Standard Time', 34200 ], - 19 : [ u'Central America Standard Time', -21600 ], - 20 : [ u'Central Asia Standard Time', 21600 ], - 21 : [ u'Central Brazilian Standard Time', -14400 ], - 22 : [ u'Central Europe Standard Time', 3600 ], - 23 : [ u'Central European Standard Time', 3600 ], - 24 : [ u'Central Pacific Standard Time', 39600 ], - 25 : [ u'Central Standard Time (Mexico)', -21600 ], - 26 : [ u'Central Standard Time', -21600 ], - 27 : [ u'China Standard Time', 28800 ], - 28 : [ u'Dateline Standard Time', -43200 ], - 29 : [ u'E. Africa Standard Time', 10800 ], - 30 : [ u'E. Australia Standard Time', 36000 ], - 31 : [ u'E. South America Standard Time', -10800 ], - 32 : [ u'Eastern Standard Time', -18000 ], - 33 : [ u'Eastern Standard Time (Mexico)', -18000 ], - 34 : [ u'Egypt Standard Time', 7200 ], - 35 : [ u'Ekaterinburg Standard Time', 18000 ], - 36 : [ u'Fiji Standard Time', 43200 ], - 37 : [ u'FLE Standard Time', 7200 ], - 38 : [ u'Georgian Standard Time', 14400 ], - 39 : [ u'GMT Standard Time', 0 ], - 40 : [ u'Greenland Standard Time', -10800 ], - 41 : [ u'Greenwich Standard Time', 0 ], - 42 : [ u'GTB Standard Time', 7200 ], - 43 : [ u'Hawaiian Standard Time', -36000 ], - 44 : [ u'India Standard Time', 19800 ], - 45 : [ u'Iran Standard Time', 12600 ], - 46 : [ u'Israel Standard Time', 7200 ], - 47 : [ u'Jordan Standard Time', 7200 ], - 48 : [ u'Kaliningrad Standard Time', 7200 ], - 49 : [ u'Korea Standard Time', 32400 ], - 50 : [ u'Libya Standard Time', 7200 ], - 51 : [ u'Line Islands Standard Time', 50400 ], - 52 : [ u'Magadan Standard Time', 36000 ], - 53 : [ u'Mauritius Standard Time', 14400 ], - 54 : [ u'Middle East Standard Time', 7200 ], - 55 : [ u'Montevideo Standard Time', -10800 ], - 56 : [ u'Morocco Standard Time', 0 ], - 57 : [ u'Mountain Standard Time (Mexico)', -25200 ], - 58 : [ u'Mountain Standard Time', -25200 ], - 59 : [ u'Myanmar Standard Time', 23400 ], - 60 : [ u'N. Central Asia Standard Time', 21600 ], - 61 : [ u'Namibia Standard Time', 3600 ], - 62 : [ u'Nepal Standard Time', 20700 ], - 63 : [ u'New Zealand Standard Time', 43200 ], - 64 : [ u'Newfoundland Standard Time', -12600 ], - 65 : [ u'North Asia East Standard Time', 28800 ], - 66 : [ u'North Asia Standard Time', 25200 ], - 67 : [ u'Pacific SA Standard Time', -10800 ], - 68 : [ u'E. Europe Standard Time', 7200 ], - 69 : [ u'Pacific Standard Time', -28800 ], - 70 : [ u'Pakistan Standard Time', 18000 ], - 71 : [ u'Paraguay Standard Time', -14400 ], - 72 : [ u'Romance Standard Time', 3600 ], - 73 : [ u'Russia Time Zone 3', 14400 ], - 74 : [ u'Russia Time Zone 10', 39600 ], - 75 : [ u'Russia Time Zone 11', 43200 ], - 76 : [ u'Russian Standard Time', 10800 ], - 77 : [ u'SA Eastern Standard Time', -10800 ], - 78 : [ u'SA Pacific Standard Time', -18000 ], - 79 : [ u'SA Western Standard Time', -14400 ], - 80 : [ u'Samoa Standard Time', 46800 ], - 81 : [ u'SE Asia Standard Time', 25200 ], - 82 : [ u'Singapore Standard Time', 28800 ], - 83 : [ u'South Africa Standard Time', 7200 ], - 84 : [ u'Sri Lanka Standard Time', 19800 ], - 85 : [ u'Syria Standard Time', 7200 ], - 86 : [ u'Taipei Standard Time', 28800 ], - 87 : [ u'Tasmania Standard Time', 36000 ], - 88 : [ u'Tokyo Standard Time', 32400 ], - 89 : [ u'Tonga Standard Time', 46800 ], - 90 : [ u'Turkey Standard Time', 7200 ], - 91 : [ u'Ulaanbaatar Standard Time', 28800 ], - 92 : [ u'US Eastern Standard Time', -18000 ], - 93 : [ u'US Mountain Standard Time', -25200 ], - 94 : [ u'UTC-02', -7200 ], - 95 : [ u'UTC-11', -39600 ], - 96 : [ u'UTC', 0 ], - 97 : [ u'UTC+12', 43200 ], - 98 : [ u'Venezuela Standard Time', -16200 ], - 99 : [ u'Vladivostok Standard Time', 36000 ], - 100: [ u'W. Australia Standard Time', 28800 ], - 101: [ u'W. Central Africa Standard Time', 3600 ], - 102: [ u'W. Europe Standard Time', 3600 ], - 103: [ u'West Asia Standard Time', 18000 ], - 104: [ u'West Pacific Standard Time', 36000 ], - 105: [ u'Yakutsk Standard Time', 32400 ], - 106: [ u'North Korea Standard Time', 30600 ] -} +# List of currently known Windows IDs. +# If this script reports missing IDs, please add them here. +# Look up the offset using (google and) timeanddate.com. +# Not public so may safely be changed. Please keep in alphabetic order by ID. +# ( Windows Id, Offset Seconds ) +windowsIdList = ( + (u'Afghanistan Standard Time', 16200), + (u'Alaskan Standard Time', -32400), + (u'Arab Standard Time', 10800), + (u'Arabian Standard Time', 14400), + (u'Arabic Standard Time', 10800), + (u'Argentina Standard Time', -10800), + (u'Atlantic Standard Time', -14400), + (u'AUS Central Standard Time', 34200), + (u'AUS Eastern Standard Time', 36000), + (u'Azerbaijan Standard Time', 14400), + (u'Azores Standard Time', -3600), + (u'Bahia Standard Time', -10800), + (u'Bangladesh Standard Time', 21600), + (u'Belarus Standard Time', 10800), + (u'Canada Central Standard Time', -21600), + (u'Cape Verde Standard Time', -3600), + (u'Caucasus Standard Time', 14400), + (u'Cen. Australia Standard Time', 34200), + (u'Central America Standard Time', -21600), + (u'Central Asia Standard Time', 21600), + (u'Central Brazilian Standard Time', -14400), + (u'Central Europe Standard Time', 3600), + (u'Central European Standard Time', 3600), + (u'Central Pacific Standard Time', 39600), + (u'Central Standard Time (Mexico)', -21600), + (u'Central Standard Time', -21600), + (u'China Standard Time', 28800), + (u'Dateline Standard Time', -43200), + (u'E. Africa Standard Time', 10800), + (u'E. Australia Standard Time', 36000), + (u'E. Europe Standard Time', 7200), + (u'E. South America Standard Time', -10800), + (u'Eastern Standard Time', -18000), + (u'Eastern Standard Time (Mexico)', -18000), + (u'Egypt Standard Time', 7200), + (u'Ekaterinburg Standard Time', 18000), + (u'Fiji Standard Time', 43200), + (u'FLE Standard Time', 7200), + (u'Georgian Standard Time', 14400), + (u'GMT Standard Time', 0), + (u'Greenland Standard Time', -10800), + (u'Greenwich Standard Time', 0), + (u'GTB Standard Time', 7200), + (u'Hawaiian Standard Time', -36000), + (u'India Standard Time', 19800), + (u'Iran Standard Time', 12600), + (u'Israel Standard Time', 7200), + (u'Jordan Standard Time', 7200), + (u'Kaliningrad Standard Time', 7200), + (u'Korea Standard Time', 32400), + (u'Libya Standard Time', 7200), + (u'Line Islands Standard Time', 50400), + (u'Magadan Standard Time', 36000), + (u'Mauritius Standard Time', 14400), + (u'Middle East Standard Time', 7200), + (u'Montevideo Standard Time', -10800), + (u'Morocco Standard Time', 0), + (u'Mountain Standard Time (Mexico)', -25200), + (u'Mountain Standard Time', -25200), + (u'Myanmar Standard Time', 23400), + (u'N. Central Asia Standard Time', 21600), + (u'Namibia Standard Time', 3600), + (u'Nepal Standard Time', 20700), + (u'New Zealand Standard Time', 43200), + (u'Newfoundland Standard Time', -12600), + (u'North Asia East Standard Time', 28800), + (u'North Asia Standard Time', 25200), + (u'North Korea Standard Time', 30600), + (u'Pacific SA Standard Time', -10800), + (u'Pacific Standard Time', -28800), + (u'Pakistan Standard Time', 18000), + (u'Paraguay Standard Time', -14400), + (u'Romance Standard Time', 3600), + (u'Russia Time Zone 3', 14400), + (u'Russia Time Zone 10', 39600), + (u'Russia Time Zone 11', 43200), + (u'Russian Standard Time', 10800), + (u'SA Eastern Standard Time', -10800), + (u'SA Pacific Standard Time', -18000), + (u'SA Western Standard Time', -14400), + (u'Samoa Standard Time', 46800), + (u'SE Asia Standard Time', 25200), + (u'Singapore Standard Time', 28800), + (u'South Africa Standard Time', 7200), + (u'Sri Lanka Standard Time', 19800), + (u'Syria Standard Time', 7200), + (u'Taipei Standard Time', 28800), + (u'Tasmania Standard Time', 36000), + (u'Tokyo Standard Time', 32400), + (u'Tonga Standard Time', 46800), + (u'Turkey Standard Time', 7200), + (u'Ulaanbaatar Standard Time', 28800), + (u'US Eastern Standard Time', -18000), + (u'US Mountain Standard Time', -25200), + (u'UTC-11', -39600), + (u'UTC-02', -7200), + (u'UTC', 0), + (u'UTC+12', 43200), + (u'Venezuela Standard Time', -16200), + (u'Vladivostok Standard Time', 36000), + (u'W. Australia Standard Time', 28800), + (u'W. Central Africa Standard Time', 3600), + (u'W. Europe Standard Time', 3600), + (u'West Asia Standard Time', 18000), + (u'West Pacific Standard Time', 36000), + (u'Yakutsk Standard Time', 32400), +) def windowsIdToKey(windowsId): - for windowsKey in windowsIdList: - if windowsIdList[windowsKey][0] == windowsId: - return windowsKey + for index, pair in enumerate(windowsIdList): + if pair[0] == windowsId: + return index + 1 return 0 # List of standard UTC IDs to use. Not public so may be safely changed. -# Do not remove ID's as is part of API/behavior guarantee -# Key : [ UTC Id, Offset Seconds ] -utcIdList = { - 0 : [ u'UTC', 0 ], # Goes first so is default - 1 : [ u'UTC-14:00', -50400 ], - 2 : [ u'UTC-13:00', -46800 ], - 3 : [ u'UTC-12:00', -43200 ], - 4 : [ u'UTC-11:00', -39600 ], - 5 : [ u'UTC-10:00', -36000 ], - 6 : [ u'UTC-09:00', -32400 ], - 7 : [ u'UTC-08:00', -28800 ], - 8 : [ u'UTC-07:00', -25200 ], - 9 : [ u'UTC-06:00', -21600 ], - 10 : [ u'UTC-05:00', -18000 ], - 11 : [ u'UTC-04:30', -16200 ], - 12 : [ u'UTC-04:00', -14400 ], - 13 : [ u'UTC-03:30', -12600 ], - 14 : [ u'UTC-03:00', -10800 ], - 15 : [ u'UTC-02:00', -7200 ], - 16 : [ u'UTC-01:00', -3600 ], - 17 : [ u'UTC-00:00', 0 ], - 18 : [ u'UTC+00:00', 0 ], - 19 : [ u'UTC+01:00', 3600 ], - 20 : [ u'UTC+02:00', 7200 ], - 21 : [ u'UTC+03:00', 10800 ], - 22 : [ u'UTC+03:30', 12600 ], - 23 : [ u'UTC+04:00', 14400 ], - 24 : [ u'UTC+04:30', 16200 ], - 25 : [ u'UTC+05:00', 18000 ], - 26 : [ u'UTC+05:30', 19800 ], - 27 : [ u'UTC+05:45', 20700 ], - 28 : [ u'UTC+06:00', 21600 ], - 29 : [ u'UTC+06:30', 23400 ], - 30 : [ u'UTC+07:00', 25200 ], - 31 : [ u'UTC+08:00', 28800 ], - 32 : [ u'UTC+09:00', 32400 ], - 33 : [ u'UTC+09:30', 34200 ], - 34 : [ u'UTC+10:00', 36000 ], - 35 : [ u'UTC+11:00', 39600 ], - 36 : [ u'UTC+12:00', 43200 ], - 37 : [ u'UTC+13:00', 46800 ], - 38 : [ u'UTC+14:00', 50400 ], - 39 : [ u'UTC+08:30', 30600 ] -} +# Do not remove IDs, as each entry is part of the API/behavior guarantee. +# ( UTC Id, Offset Seconds ) +utcIdList = ( + (u'UTC', 0), # Goes first so is default + (u'UTC-14:00', -50400), + (u'UTC-13:00', -46800), + (u'UTC-12:00', -43200), + (u'UTC-11:00', -39600), + (u'UTC-10:00', -36000), + (u'UTC-09:00', -32400), + (u'UTC-08:00', -28800), + (u'UTC-07:00', -25200), + (u'UTC-06:00', -21600), + (u'UTC-05:00', -18000), + (u'UTC-04:30', -16200), + (u'UTC-04:00', -14400), + (u'UTC-03:30', -12600), + (u'UTC-03:00', -10800), + (u'UTC-02:00', -7200), + (u'UTC-01:00', -3600), + (u'UTC-00:00', 0), + (u'UTC+00:00', 0), + (u'UTC+01:00', 3600), + (u'UTC+02:00', 7200), + (u'UTC+03:00', 10800), + (u'UTC+03:30', 12600), + (u'UTC+04:00', 14400), + (u'UTC+04:30', 16200), + (u'UTC+05:00', 18000), + (u'UTC+05:30', 19800), + (u'UTC+05:45', 20700), + (u'UTC+06:00', 21600), + (u'UTC+06:30', 23400), + (u'UTC+07:00', 25200), + (u'UTC+08:00', 28800), + (u'UTC+08:30', 30600), + (u'UTC+09:00', 32400), + (u'UTC+09:30', 34200), + (u'UTC+10:00', 36000), + (u'UTC+11:00', 39600), + (u'UTC+12:00', 43200), + (u'UTC+13:00', 46800), + (u'UTC+14:00', 50400), +) def usage(): print "Usage: cldr2qtimezone.py " @@ -370,13 +372,10 @@ print "Done Zone Data" # Write Windows ID key table newTempFile.write("// Windows ID Key, Windows ID Index, IANA ID Index, UTC Offset\n") newTempFile.write("static const QWindowsData windowsDataTable[] = {\n") -for windowsKey in windowsIdList: +for index, pair in enumerate(windowsIdList): newTempFile.write(" { %6d,%6d,%6d,%6d }, // %s\n" - % (windowsKey, - windowsIdData.append(windowsIdList[windowsKey][0]), - ianaIdData.append(defaultDict[windowsKey]), - windowsIdList[windowsKey][1], - windowsIdList[windowsKey][0])) + % (index + 1, windowsIdData.append(pair[0]), + ianaIdData.append(defaultDict[index + 1]), pair[1], pair[0])) newTempFile.write(" { 0, 0, 0, 0 } // Trailing zeroes\n") newTempFile.write("};\n\n") @@ -385,12 +384,9 @@ print "Done Windows Data Table" # Write UTC ID key table newTempFile.write("// IANA ID Index, UTC Offset\n") newTempFile.write("static const QUtcData utcDataTable[] = {\n") -for index in utcIdList: - data = utcIdList[index] +for pair in utcIdList: newTempFile.write(" { %6d,%6d }, // %s\n" - % (ianaIdData.append(data[0]), - data[1], - data[0])) + % (ianaIdData.append(pair[0]), pair[1], pair[0])) newTempFile.write(" { 0, 0 } // Trailing zeroes\n") newTempFile.write("};\n\n")