From 313688e9cfac45f46d19cc81baf6551c45a0d2c1 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 2 Jul 2024 19:35:36 +0200 Subject: [PATCH] QLocaleXML: use attributes in the zone alias table Replacing elements for the alias and IANA ID with attribute makes the table more compact, albeit the ComodRivadavia like is a little long. (Some existing msLandZones/ianaids lines are longer, though.) Change-Id: Iab2b55a21857402ad7c863ef33abd241f1d58a8d Reviewed-by: Mate Barany --- util/locale_database/qlocalexml.py | 10 ++++------ util/locale_database/qlocalexml.rnc | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/util/locale_database/qlocalexml.py b/util/locale_database/qlocalexml.py index ae1748fba64..73bc6dd526d 100644 --- a/util/locale_database/qlocalexml.py +++ b/util/locale_database/qlocalexml.py @@ -111,9 +111,10 @@ class QLocaleXmlReader (object): yield (language, script, territory), locale def aliasToIana(self): - kid = self.__firstChildText + def attr(elt, key): + return elt.attributes[key].nodeValue for elt in self.__eachEltInGroup(self.root, 'zoneAliases', 'zoneAlias'): - yield kid(elt, 'alias'), kid(elt, 'iana') + yield attr(elt, 'alias'), attr(elt, 'iana') def msToIana(self): kid = self.__firstChildText @@ -421,10 +422,7 @@ class QLocaleXmlWriter (object): for name, iana in sorted(alias.items()): if name == iana: continue - self.__openTag('zoneAlias') - self.inTag('alias', name) - self.inTag('iana', iana) - self.__closeTag('zoneAlias') + self.asTag('zoneAlias', alias = name, iana = iana) self.__closeTag('zoneAliases') self.__openTag('windowsZone') diff --git a/util/locale_database/qlocalexml.rnc b/util/locale_database/qlocalexml.rnc index 123fe3fd04c..996540171d4 100644 --- a/util/locale_database/qlocalexml.rnc +++ b/util/locale_database/qlocalexml.rnc @@ -41,8 +41,8 @@ LocaleTriplet = ( # TODO: xsd patterns for IANA IDs and space-joined lists of them ZoneAlias = element zoneAlias { - element alias { text }, - element iana { text } + attribute alias { text }, + attribute iana { text } } MsLandZones = element msLandZones {