QLocaleXml: use tabs for indentation

One character instead of four adds up to a lot of saved bytes when a
file has many lines: and the timezone name L10n data is going to add a
lot of lines.

Task-number: QTBUG-115158
Change-Id: I856f3771266a70b7a9ef4078a9b4aecf42315831
Reviewed-by: Mate Barany <mate.barany@qt.io>
This commit is contained in:
Edward Welbourne 2024-06-03 17:11:47 +02:00
parent 15019f8667
commit 9c8df22147

View File

@ -296,7 +296,7 @@ class QLocaleXmlWriter (object):
The output saved by this should conform to qlocalexml.rnc's The output saved by this should conform to qlocalexml.rnc's
schema.""" schema."""
def __init__(self, cldrVersion, save = None, space = Spacer(4)): def __init__(self, cldrVersion, save = None, space = Spacer('\t')):
"""Set up to write digested CLDR data as QLocale XML. """Set up to write digested CLDR data as QLocale XML.
First argument is the version of CLDR whose data we'll be First argument is the version of CLDR whose data we'll be
@ -310,13 +310,15 @@ class QLocaleXmlWriter (object):
Third argument, space, is an object to call on each text output to Third argument, space, is an object to call on each text output to
prepend indentation and append newlines, or not as the case may be. The prepend indentation and append newlines, or not as the case may be. The
default is a Spacer(4), which grows indent by four spaces after each default is a Spacer('\t'), which grows indent by a tab after each
unmatched new tag and shrinks back on a close-tag (its parsing is unmatched new tag and shrinks back on a close-tag (its parsing is
naive, but adequate to how this class uses it), while adding a newline naive, but adequate to how this class uses it), while adding a newline
to each line.""" to each line."""
self.__rawOutput = self.__printit if save is None else save self.__rawOutput = self.__printit if save is None else save
self.__wrap = space self.__wrap = space
self.__write('<?xml version="1.0" encoding="UTF-8" ?>') self.__write('<?xml version="1.0" encoding="UTF-8" ?>'
# A hint to emacs to make display nicer:
'<!--*- tab-width: 4 -*-->')
self.__openTag('localeDatabase', versionCldr = cldrVersion, self.__openTag('localeDatabase', versionCldr = cldrVersion,
versionQt = qtVersion) versionQt = qtVersion)