summaryrefslogtreecommitdiffstats
path: root/util/locale_database/localetools.py
Commit message (Collapse)AuthorAgeFilesLines
* Use CLDR's names in QLocale::*ToName() for language, script, territoryEdward Welbourne2023-08-091-1/+1
| | | | | | | | | | | | | | | Various comments need to continue using the enumdata.py names, as they associate data with particular enum members, but we can now correctly use the en.xml versions of their names when we report them, rather than the enum-friendly names we use in the code. Since this now means the data may stray outside plain ASCII - it'll be UTF-8-encoded - this implies replacing the QLatin1StringView()s of the code that formerly read this data with QString::fromUtf8(). Fixes: QTBUG-94460 Change-Id: Id3b08875a46af58c0555c3e303b0e15a19441509 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Break clashing-names test function out of CldrAccess.__checkEnum()Edward Welbourne2023-08-091-0/+35
| | | | | | | | | | Moving it makes it easier to document what it's up to and why, while leaving __checkEnum() easier to read; and I'm going to need it elsewhere anyway. This makes no difference to generated data. Task-number: QTBUG-94460 Change-Id: I684375bc926d5d54928fbf5b5e08978528aef487 Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
* Wrap CLDR-derived time-zone ID tables to within a 100-column marginEdward Welbourne2023-08-071-2/+2
| | | | | | | Ugly display in code-review bugged me ... Change-Id: If9243907973cad49f1a5c8d78ff23c14fab2d4b4 Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
* LocaleDB: Make passing qtbase root dir on command-lines optionalEdward Welbourne2022-11-011-0/+3
| | | | | | | | We can easily enough obtain the root of the present source tree using the value of __file__, so might as well do so. Change-Id: If14773ac1127278b6018a090c0b376437b9c6eec Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-27/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* locale_database: Use context manager interface to update source filesIevgenii Meshcheriakov2021-07-201-51/+91
| | | | | | | | | | | | Use context manager interface (with statement) to atomically update source files. This ensures that all files are properly closed and the temporary file is removed even in case of errors. Task-number: QTBUG-83488 Pick-to: 6.2 Change-Id: I18cd96f1d03e467dea6212f6576a41e65f414ce1 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* locale_database: Use NamedTemporaryFile for temporary filesIevgenii Meshcheriakov2021-07-191-14/+7
| | | | | | | | | | | Using NamedTemporaryFile instead mkstemp + fdopen simplifies the code. It also makes it easier to switch to using context managers for handling source file modification. Task-number: QTBUG-83488 Pick-to: 6.2 Change-Id: Ibeae840ac6dde3d0b49cd7f985cfa6cd775b7f47 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* locale_database: Use pathlib to manipulate paths in Python codeIevgenii Meshcheriakov2021-07-191-13/+25
| | | | | | | | | | | pathlib's API is more modern and easier to use than os.path. It also allows to distinguish between paths and other strings in type annotations. Task-number: QTBUG-83488 Pick-to: 6.2 Change-Id: Ie6d9b4e35596f7f6befa4c9635f4a65ea3b20025 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* locale_database: Use super() to call base class methodsIevgenii Meshcheriakov2021-07-151-6/+3
| | | | | | | | | | | This is the standard way to call base class methods in Python 3 and it is shorter than the custom one used now. Task-number: QTBUG-83488 Pick-to: 6.2 Change-Id: Ifaff591a46e92148fbf514856109ff794a50c9f7 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Convert CLDR scripts to Python 3Ievgenii Meshcheriakov2021-07-151-2/+2
| | | | | | | | | | | The convertion is moslty done using 2to3 script with manual cleanup afterwards. Task-number: QTBUG-83488 Pick-to: 6.2 Change-Id: I4d33b04e7269c55a83ff2deb876a23a78a89f39d Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add tools to localetools to facilitate source file recreationEdward Welbourne2020-04-021-0/+99
| | | | | | | | | | For now unused; later commits shall put them to use. Transcriber -- base, takes care of tempfile and renaming. SourceFileEditor -- handles copying parts before and after a common delimiter. Task-number: QTBUG-81344 Change-Id: I28cf977d0a08825fbb873fb330da6823b88ad3ed Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Move some shared code to a localetools moduleEdward Welbourne2020-04-021-0/+65
The time-zone script was importing two functions from the locale data generation script. Move them to a separate module, to which I'll shortly add some more shared utilities. Cleaned up some imports in the process. Combined qlocalexml2cpp's and xpathlit's error classes into a new Error class in the new module and made it a bit more like a proper python error class. Task-number: QTBUG-81344 Change-Id: Idbe0139ba9aaa2f823b8f7216dee1d2539c18b75 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>