Extract a large format string as a module constant value

The template for the "This is a generated file" notice made a clumsy
intrusion in the code in which it appeared, so split it out as a
constant of the module and access it by name where it's used.

Change-Id: Ic4dfb8e873078c54410b191654d6c21d082c9016
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Soroush Rabiei 2019-07-26 15:42:04 +02:00 committed by Edward Welbourne
parent ee8509d6cb
commit c595878aa3

View File

@ -42,6 +42,20 @@ from enumdata import language_aliases, country_aliases, script_aliases
from localexml import Locale
generated_template = """
/*
This part of the file was generated on %s from the
Common Locale Data Repository v%s
http://www.unicode.org/cldr/
Do not edit this section: instead regenerate it using
cldr2qlocalexml.py and qlocalexml2cpp.py on updated (or
edited) CLDR data; see qtbase/util/locale_database/.
*/
"""
class Error:
def __init__(self, msg):
self.msg = msg
@ -360,20 +374,7 @@ def main():
dupes = findDupes(language_map, country_map)
cldr_version = firstChildText(doc.documentElement, "version")
data_temp_file.write("""
/*
This part of the file was generated on %s from the
Common Locale Data Repository v%s
http://www.unicode.org/cldr/
Do not edit this section: instead regenerate it using
cldr2qlocalexml.py and qlocalexml2cpp.py on updated (or
edited) CLDR data; see qtbase/util/locale_database/.
*/
""" % (str(datetime.date.today()), cldr_version) )
data_temp_file.write(generated_template % (datetime.date.today(), cldr_version))
# Likely subtags map
data_temp_file.write("static const QLocaleId likely_subtags[] = {\n")