From bbd64f64b235d04058ba5bd83886d76fa4ee7a0c Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 28 May 2019 18:16:54 +0200 Subject: [PATCH] cldr2qtimezone.py: report all missing zones, rather than just the first When scanning the CLDR data, the script raised an exception if it didn't recognize a zone ID. Instead, collect up such unrecognized IDs in a list and report them all at the end, so that whoever runs this can do them all in one go, rather than doing one, running the script, doing the next, running the script, ad nauseam. Change-Id: Ia659f1d1c7e1c1b4ccb87cc23828a0588a5bf958 Reviewed-by: Lars Knoll --- util/locale_database/cldr2qtimezone.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/util/locale_database/cldr2qtimezone.py b/util/locale_database/cldr2qtimezone.py index 1c82e1d58fd..809a35912bd 100755 --- a/util/locale_database/cldr2qtimezone.py +++ b/util/locale_database/cldr2qtimezone.py @@ -293,6 +293,7 @@ defaultDict = {} windowsIdDict = {} if mapTimezones: + badZones = set() for mapZone in mapTimezones: # [u'mapZone', [(u'territory', u'MH'), (u'other', u'UTC+12'), (u'type', u'Pacific/Majuro Pacific/Kwajalein')]] if mapZone[0] == u'mapZone': @@ -307,7 +308,7 @@ if mapTimezones: data['windowsKey'] = windowsIdToKey(data['windowsId']) if data['windowsKey'] <= 0: - raise xpathlite.Error("Unknown Windows ID, please add \"%s\"" % data['windowsId']) + badZones.add(data['windowsId']) countryId = 0 if data['countryCode'] == u'001': @@ -318,6 +319,10 @@ if mapTimezones: raise xpathlite.Error("Unknown Country Code \"%s\"" % data['countryCode']) data['country'] = enumdata.country_list[data['countryId']][0] windowsIdDict[data['windowsKey'], data['countryId']] = data + if badZones: + sys.stderr.write('\n\t'.join(["\nUnknown Windows ID, please add:"] + sorted(badZones)) + + "\nto the windowIdList in cldr2qtimezone.py\n\n") + raise xpathlite.Error("Unknown Windows IDs") print "Input file parsed, now writing data"