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 <mate.barany@qt.io>
This commit is contained in:
Edward Welbourne 2024-07-02 19:35:36 +02:00
parent 6705728aba
commit 313688e9cf
2 changed files with 6 additions and 8 deletions

View File

@ -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')

View File

@ -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 {