Skip to content

Commit

Permalink
Simplify QLocaleXmlWriter::enumData()
Browse files Browse the repository at this point in the history
Move the repeated List suffix to the __enumTable() helper, where half
the parameter's uses were having to snip it off anyway.

Change-Id: Ia396e87e59ceeb81fc4b0890a86934dc67da10cb
Reviewed-by: Mårten Nordheim <[email protected]>
Reviewed-by: Cristian Maureira-Fredes <[email protected]>
  • Loading branch information
ediosyncratic committed Nov 8, 2020
1 parent b83b990 commit ed853a6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions util/locale_database/qlocalexml.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,9 @@ def __init__(self, save = None, space = Spacer(4)):

# Output of various sections, in their usual order:
def enumData(self, languages, scripts, countries):
self.__enumTable('languageList', languages)
self.__enumTable('scriptList', scripts)
self.__enumTable('countryList', countries)
self.__enumTable('language', languages)
self.__enumTable('script', scripts)
self.__enumTable('country', countries)

def likelySubTags(self, entries):
self.__openTag('likelySubtags')
Expand Down Expand Up @@ -381,14 +381,14 @@ def __complain(text):
raise Error('Attempted to write data after closing :-(')

def __enumTable(self, tag, table):
self.__openTag(tag)
self.__openTag(tag + 'List')
for key, value in table.iteritems():
self.__openTag(tag[:-4])
self.__openTag(tag)
self.inTag('name', value[0])
self.inTag('id', key)
self.inTag('code', value[1])
self.__closeTag(tag[:-4])
self.__closeTag(tag)
self.__closeTag(tag)
self.__closeTag(tag + 'List')

def __likelySubTag(self, tag, likely):
self.__openTag(tag)
Expand Down

0 comments on commit ed853a6

Please sign in to comment.