summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSoroush Rabiei <soroush@ametisco.ir>2019-07-26 15:42:04 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2019-08-08 18:04:05 +0200
commitc595878aa34c5861b00f0c59bc4b0b6c02a54543 (patch)
tree3f02b9485ba9cf3d2282bf27fa672110beedc8bd
parentee8509d6cbc8f54fe3aff60168cc6aafb095d8ab (diff)
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>
-rwxr-xr-xutil/locale_database/qlocalexml2cpp.py29
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")