diff options
author | Soroush Rabiei <soroush@ametisco.ir> | 2019-07-26 15:42:04 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2019-08-08 18:04:05 +0200 |
commit | c595878aa34c5861b00f0c59bc4b0b6c02a54543 (patch) | |
tree | 3f02b9485ba9cf3d2282bf27fa672110beedc8bd /util/locale_database | |
parent | QMakeLocalFileName: remove mutable specifier from real_name (diff) | |
download | qtbase-c595878aa34c5861b00f0c59bc4b0b6c02a54543.tar.xz qtbase-c595878aa34c5861b00f0c59bc4b0b6c02a54543.zip |
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>
Diffstat (limited to 'util/locale_database')
-rwxr-xr-x | util/locale_database/qlocalexml2cpp.py | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/util/locale_database/qlocalexml2cpp.py b/util/locale_database/qlocalexml2cpp.py index ea89288b4f..c0797f111d 100755 --- a/util/locale_database/qlocalexml2cpp.py +++ b/util/locale_database/qlocalexml2cpp.py @@ -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") |