summaryrefslogtreecommitdiffstats
path: root/util/locale_database
Commit message (Collapse)AuthorAgeFilesLines
* Fix trivial typo in cldr.py doc-stringEdward Welbourne2022-09-141-1/+1
| | | | | Change-Id: I24b039f9256adb3dc7808cd04bd621226b1a5ed5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Core: make CLDR data constexprYuhang Zhao2022-05-272-12/+12
| | | | | | | Task-number: QTBUG-100485 Pick-to: 6.3 6.2 Change-Id: Ib8c5160ca0994662a5fdc2293dc734c1bdcac4f2 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-1616-434/+31
| | | | | | | | | | | | | 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>
* QLocale: Extend support for language codesIevgenii Meshcheriakov2021-12-092-4/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit extends functionality for QLocale::codeToLanguage() and QLocale::languageToCode() by adding an additional argument that allows selection of the ISO 639 code-set to consider for those operations. The following ISO 639 codes are supported: * Part 1 * Part 2 bibliographic * Part 2 terminological * Part 3 As a result of this change the codeToLanguage() overload without the additional argument now returns a Language value if it matches any know code. Previously a valid language was returned only if the function argument matched the first code defined for that language from the above list. [ChangeLog][QtCore][QLocale] Added overloads for codeToLanguage() and languageToCode() that support specifying which ISO 639 codes to consider. Fixes: QTBUG-98129 Change-Id: I4da8a89e2e68a673cf63a621359cded609873fa2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QLocale: Add support for Kaingang and Nheengatu languagesIevgenii Meshcheriakov2021-11-101-0/+2
| | | | | | | | | | Update the locale generation script to support Kaingang and Nheengatu languages. These are new in CLDR v40. Regenerate the locale data. Task-number: QTBUG-94358 Change-Id: I5195d5161d8c4d9f17129bbcfde39dfd3fcf1cd5 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* locale_database: Add entry for 'South Sudan Standard Time'Ievgenii Meshcheriakov2021-11-101-0/+1
| | | | | | | | | | | | This timezone is new in CLDR 40, Olson database calls it Africa/Juba. The offset is UTC+2. Reference: https://techcommunity.microsoft.com/t5/daylight-saving-time-time-zone/2021-time-zone-updates-for-republic-of-south-sudan-now-available/ba-p/2234981 Task-number: QTBUG-94358 Pick-to: 6.2 Change-Id: Ib70dbd9b472eb9cf8cb62a0eb5e241199148c077 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Use a HTTPS URL for the CLDR download linkIevgenii Meshcheriakov2021-11-051-1/+1
| | | | | | | | | FTP is insecure and is not supported by modern browsers anymore. See also: https://mywiki.wooledge.org/FtpMustDie Change-Id: Iad65d29912e79a4f3fadb9317bb5d9c5fe9b68d7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Remove trailing zero rows from qtimezoneprivate_data_p.h's tablesEdward Welbourne2021-09-101-4/+1
| | | | | | | | | | They are not needed. Iterations over the table track their sizes. The size-of-table constants just needed their -1s removed. Incidentally use std::size() rather than sizeof(array)/sizeof(element). Change-Id: Ie20eef9f6f5786d93c10b830a87e006d3c5bcc1a Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* locale_database: Use context manager interface to update source filesIevgenii Meshcheriakov2021-07-203-129/+134
| | | | | | | | | | | | 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-195-65/+76
| | | | | | | | | | | 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 argparse module to parse command line argumentsIevgenii Meshcheriakov2021-07-163-72/+71
| | | | | | | | | | | arparse is the standard way to parse command line arguments in Python. It provides help and usage information for free and is easier to extend than a custom argument parser. Task-number: QTBUG-83488 Pick-to: 6.2 Change-Id: I1e4c9cd914449e083d01932bc871ef10d26f0bc2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* locale_database: Use f-strings in Python codeIevgenii Meshcheriakov2021-07-166-140/+131
| | | | | | | | | | | Replace most uses of str.format() and string arithmetic by f-strings. This results in more compact code and the code is easier to read when using an appropriate editor. Task-number: QTBUG-83488 Pick-to: 6.2 Change-Id: I3409f745b5d0324985cbd5690f5eda8d09b869ca Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* locale_database: Add schema for intermediate locale data filesIevgenii Meshcheriakov2021-07-162-0/+151
| | | | | | | | | The schema is in RelaxNG Compact syntax. It can be used to validate files produced by the cldr2qlocalexml.py script and also gives an overview of the file format. Change-Id: I344978f2201c5e67e236ab580a12ad33262f33cb Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* locale_database: Use super() to call base class methodsIevgenii Meshcheriakov2021-07-152-10/+5
| | | | | | | | | | | 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>
* locale_database: Don't use u prefix for strings in python filesIevgenii Meshcheriakov2021-07-154-188/+188
| | | | | | | | | | This prefix is useless with Python 3. Task-number: QTBUG-83488 Pick-to: 6.2 Change-Id: Ic008d53fe506865759e9a5003f439f7ac107b9e6 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-158-30/+23
| | | | | | | | | | | 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>
* Convert python comparison function to key functionEdward Welbourne2021-07-141-40/+17
| | | | | | | | | | | | | | | | | | | | | Instead of implementing all the intricacies of a cmp for the python sort-function, support for which is due to be dropped at Python 3 in any case, implement a much simpler key function that achieves the same result. In the process, eliminate the ugly kludge of setting an attribute on a function to, in effect, communicate with it via a global. Instead, instantiate a class, that wraps the value previously given to the attribute and whose instance provides the key-function. Thanks to Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> for pointing out that a key function is the way of the future - and sorted() is a nicer way to sort. Pick-to: 6.2 Change-Id: Icf1ed5597fedf420d054fbc860e3e7fc6615875c Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Make locale ordering transitiveEdward Welbourne2021-07-141-27/+36
| | | | | | | | | | | | | | | | | | | | | | | The ordering function used to sort the locale data generated for QLocale attempted to sort the default territory for a given language and script before other territories, but was too tangled for it to be obvious this is what it was doing. The result turned out to be non-transitive. Replace with code that implements the same preference but only applies it where the result is compatible with transitivity. This leads to a shuffling of the order of the Serbian-language locales, which sorts the Cyrillic ones before the Latin ones. This is consistent with my reading of the CLDR data, which fills in Cyrillic and Serbia for Serbian; Serbian/Cyrillic/Serbia did previously sort before all other Serbian variants. Thanks to Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> for discovering the non-transitivity. Pick-to: 6.2 Change-Id: I0ce9f78e620e714f980f32b85b7100ed0f92ad74 Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* cldr.py: Avoid raising StopIteration from generatorsIevgenii Meshcheriakov2021-07-091-5/+10
| | | | | | | | | | | | The behavior of StopIteration in generators was changed in Python 3 (see https://www.python.org/dev/peps/pep-0479/). Not raising that exception makes it easier to port the code to Python 3. Task-number: QTBUG-83488 Pick-to: 6.2 Change-Id: Iac6e3f6f1e1e8ef3a1a0d89b19d2ac2d186434f5 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* locale_database: Don't attempt to access property 'message' of IOErrorIevgenii Meshcheriakov2021-07-072-6/+6
| | | | | | | | | | | | IOError does not have property 'message' in Python 3. Instead of attempting to access it, just use the string representation of the exception object. This produces the error message possibly combined with additional arguments in both Python 2 and Python 3. Task-number: QTBUG-83488 Pick-to: 6.2 Change-Id: Icb198a409e7f80b832e474d8390b770fdeacc6c2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* qlocalexml2cpp.py: Remove undefined name inside error processing codeIevgenii Meshcheriakov2021-07-061-1/+1
| | | | | | | | | | Name 'stem' is undefined inside CalendarDataWriter.write(). The error was repoted by flake8. Task-number: QTBUG-83488 Pick-to: 6.2 Change-Id: Ib816b40d0bde2afd3112da76deee0ce39985693a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* locale_database: Sort lists of unused tags before printingIevgenii Meshcheriakov2021-07-061-1/+1
| | | | | | | | | This way the output is easier to compare between versions. Task-number: QTBUG-83488 Pick-to: 6.2 Change-Id: If4053c574c4ad200a179b06276bd889f2cb9e1c6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* locale_data: Add new line at the end of script outputIevgenii Meshcheriakov2021-07-061-1/+1
| | | | | | | | | Output of cldr2qlocalexml.py looks weird without the final new line. Task-number: QTBUG-83488 Pick-to: 6.2 Change-Id: I5d675e475c57cdc8101887c39052007ba0a19857 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* dateconverter.py: Remove shebang and executable attributeIevgenii Meshcheriakov2021-07-051-1/+0
| | | | | | | | | | | This is not a script that can be run independently. Task-number: QTBUG-83488 Pick-to: 6.2 Change-Id: I82a93b9ab37ae759b789058d48e94298ecd29b6f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Report unused enum members after CLDR data scanEdward Welbourne2021-06-072-4/+31
| | | | | | | | We should at least know when members of QLocale's enums aren't adding any value, and it may make sense to deprecate the unused ones. Change-Id: Icf202f81d2a35904c13ccdc202d41985bcb3f2e6 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Nomenclature change: s/countr/territor/g in locale scriptsEdward Welbourne2021-05-267-103/+103
| | | | | | | | | | Change the nomenclature used in the scripts and the QLocaleXML data format to use "territory" and "territories" in place of "country" and "countries". Does not change the generated source files. Change-Id: I4b208d8d01ad2bfc70d289fa6551f7e0355df5ef Reviewed-by: JiDe Zhang <zhangjide@uniontech.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Rename util/locale_database/enumdata.py's various *_list to *_mapEdward Welbourne2021-05-263-17/+17
| | | | | | | | | These variables provide mappings, not lists, so name them non-deceptively. Change-Id: Idf15e78ad73790bc86dd8b9d4f248d1c4f73993c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* QLocaleXmlWriter.enumData(): move enumdata import to method from callerEdward Welbourne2021-05-262-8/+8
| | | | | | | | | The only reason cldr.py imported enumdata was so as to pass what it imported to writer.enumData(); that method might as well do the import itself. Change-Id: Ie77dcd29058f926b8cca4deef35837f30505859f Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Remove unused functions from enumdata.pyEdward Welbourne2021-05-181-24/+0
| | | | | | | | | | It's now a data-only module. The callers of its code-to-ID functions have, for some time now, been rearranging its mappings to get at data efficiently. Change-Id: Ia16dcaa767203cdf3b81a96bd51793491ad41563 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Add the "Territory" enumerated type for QLocaleJiDe Zhang2021-04-155-16/+34
| | | | | | | | | | | | | | | | | | | The use of "Country" is misleading as some entries in the enumeration are not countries (eg, HongKong), for all that most are. The Unicode Consortium's Common Locale Data Repository (CLDR, from which QLocale's data is taken) calls these territories, so introduce territory-based names and prepare to deprecate the country-based ones in due course. [ChangeLog][QtCore][QLocale] QLocale now has Territory as an alias for its Country enumeration, and associated territory-based names to match its country-named methods, to better match the usage in relevant standards. The country-based names shall in due course be deprecated in favor of the territory-based names. Fixes: QTBUG-91686 Change-Id: Ia1ae1ad7323867016186fb775c9600cd5113aa42 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update to CLDR v38.1, adding Yukon Standard TimeEdward Welbourne2021-01-272-1/+2
| | | | | | | | | | | No change to QLocale's data, one addition to the Windows time-zone data. What was formerly "Us Mountain Standard time / Canada" is now Yukon Standard Time. Fixes: QTBUG-89784 Pick-to: 6.0 5.15 Change-Id: I4c9a23620e74ea379be8a4c5ba0896d35fe9b594 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add a note explaining what a macrolanguage isEdward Welbourne2020-11-241-0/+5
| | | | | | | | | The comments in enumdata.py indicating macrolanguages meant nothing to me, until I stumbled on a reference that lead me to ISO 639's usage of the term. Add a minimal explanation to save such confusion for others. Change-Id: Ia1d849d93a1d94c04c8c461debdecf879e9a7db5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLocale: simplify currency display name lookupEdward Welbourne2020-11-171-7/+13
| | | | | | | | | | | | | | | We were extracting several candidate display names from CLDR for each currency, joining them with semicolons, storing in a table, then using only the first entry from the list - where we should probably have used the first non-empty entry in any case. So instead extract the first non-empty candidate name from CLDR and store that simply, saving the need for semicolon-joining or parsing out the first entry from the thus-joined list. This significantly reduces the size of the currency name data table. Change-Id: I201d0528348d5fcb9eceb5df86211b9c77de3485 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Implement binary search in QLocale's likely sub-tag lookupEdward Welbourne2020-11-082-5/+19
| | | | | | | | | | | | | | Follow through on a comment from 2012: sort the likely subtag array (in the CLDR update script) and use bsearch to find entries in it. This simplifies QLocaleXmlReader.likelyMap() slightly, moving the detection of last entry to LocaleDataWriter.likelySubtags(), but requires collecting all likely sub-tag mapping pairs (rather than just passing them through from read to write via generators) in order to sort them. Change-Id: Ieb6875ccde1ddbd475ae68c0766a666ec32b7005 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Reorder locale enums alphabeticallyEdward Welbourne2020-11-082-734/+741
| | | | | | | | | | | | | Binary-incompatible change: change the numeric values of QLocale's Language, Script and Country enums, as encouraged by a comment in the generator script enumdata.py and clarify documentation around that. In the process (since I was changing almost every line anyway), convert the dictionary values from (mutable) lists of length two to tuples, since they are (and should be) immutable data. Change-Id: I26222bce45b9f5074b1d81ed70015a75ac34adcd Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Use newer names for various languages, territories and scriptsEdward Welbourne2020-11-082-33/+65
| | | | | | | | | | Our enumdata.py namings of countries had fallen somewhat out of sync with CLDR's names. In the process, support including hyphenation in the unsquashed name, along with spacing. Distinguish, in comments, between older renamings and those first seen in Qt6. Change-Id: I91ec444bf35222ab6a9332e389ace19cca0e4fdf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Simplify QLocaleXmlWriter::enumData()Edward Welbourne2020-11-081-7/+7
| | | | | | | | | Move the repeated List suffix to the __enumTable() helper, where half the parameter's uses were having to snip it off anyway. Change-Id: Ia396e87e59ceeb81fc4b0890a86934dc67da10cb Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Check our enumdata.py tables are consistent with CLDREdward Welbourne2020-11-081-3/+68
| | | | | | | | | | Compare the code->name mappings we're using to the ones CLDR's common/main/en.xml provides; report discrepancies. Tolerate tags missing from en.xml if they're known to the locale-inheritance machinery. Change-Id: Ibe96c18bf55984a35de3b3644f3586a9f30720b2 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Purge deprecated language and country codes from QLocaleEdward Welbourne2020-10-291-52/+0
| | | | | | | | | | | | | | | | | | | | Requires subsequent re-numbering of the enum tables to eliminate gaps, before locale data can be regenerated. However, it will work with the present locale data, since it merely loses the means to use some names for which the available data was just the name and code. This implies a transient issue of recognising some codes for which there is no actual enum member; but relevant code will work as before, finding nothing but the code and its name. This shall be resolved by a coming BiC change to resort the language, country and script codes, changing the numbering (almost) completely. [ChangeLog][QtCore][QLocale] Various obsolete language and country codes have been removed. Some lacked locale data, others were obsolete aliases. All have been deprecated in 5.15. Task-number: QTBUG-84669 Change-Id: I45fc76a5f2f6c3b0ea3c1bb61e917da984183783 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Update CLDR to v37, adding Nigerian Pidgin as a new languageEdward Welbourne2020-10-262-1/+15
| | | | | | | | | | | | | | | | Routine update by running scripts, ignoring clang-format's extensive grumbles. Added notes to util/locale_database/'s README, on the need for that, and enumdata.py, on when to add entries. As usual, several new locales are also added, for existing languages, territories and scripts. [ChangeLog][QtCore][QLocale] Updated to new version of CLDR (the Unicode Consortium's Common Locale Data Repository) v37. Fixes: QTBUG-84669 Pick-to: 5.15 Change-Id: Ib76848bf4bd1219180faf46820077e8d8049a4e3 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Mark QLocale's Language, Country and Script enums as ushortEdward Welbourne2020-10-121-1/+1
| | | | | | | | | | The code pervasively presumes their values can be held in a ushort, so make sure the compiler knows we expect that to work (and doesn't complain about narrowing when we do convert them to ushort). Change-Id: Idde7be6cceee8a6dae333c5b1d5a0120fec32e4a Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Update util/locale_database/'s README and timezone script instructionsEdward Welbourne2020-10-092-7/+10
| | | | | | | | | | | | The script told me the wrong path to pass as first argument, so correct that; and the README didn't mention the need to run it. CLDR v37 makes no change to the actual generated data, though. Tweaked wording of a comment in the script. Task-number: QTBUG-84669 Change-Id: I56b510c666f414d9719cef650aeec6192c4fde6e Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Another round of replacing 0 with nullptrAllan Sandfeld Jensen2020-10-072-2/+2
| | | | | | | | | This time based on grepping to also include documentation, tests and examples previously missed by the automatic tool. Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix handling of Suzhou numbering systemEdward Welbourne2020-07-171-2/+4
| | | | | | | | | | | | | | | | This only arises when the system locale tells us to use its zero as our zero digit, since no CLDR locale uses it by default. Adapt an MS-specific QLocale::system() test to use Suzhou numbering, so as to test this. While updating the locale-restoration code to also restore the digits being set in that test, add restore code for the long time format, where previously only the short time format was restored. Add a comment to make it less likely one of those shall be missed in future. Fixes: QTBUG-85409 Change-Id: I343324bb563ee0e455dfe77d4825bf8c3082ca30 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Support digit-grouping correctlyEdward Welbourne2020-07-143-6/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Read three more values from CLDR and add a byte to the bit-fields at the end of QLocaleData, indicating the three group sizes. This adds three new parameters to various low-level formatting functions. At the same time, rename ThousandsGroup to GroupDigits, more faithfully expressing what this (internal) option means. This replaces commit 27d139128013c969a939779536485c1a80be977e with a fuller implementation that handles digit-grouping in any of the ways that CLDR supports. The formerly "Indian" formatting now also applies to at least some locales for Bangladesh, Bhutan and Sri Lanka. Fixed Costa Rica currency formatting test that wrongly put a separator after the first digit; the locale (in common with several Spanish locales) requires at least two digits before the first separator. [ChangeLog][QtCore][Important Behavior Changes] Some locales require more than one digit before the first grouping separator; others use group sizes other than three. The latter was partially supported (only for India) at 5.15 but is now systematically supported; the former is now also supported. Task-number: QTBUG-24301 Fixes: QTBUG-81050 Change-Id: I4ea4e331f3254d1f34801cddf51f3c65d3815573 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove unused importsDimitrios Apostolou2020-07-103-3/+0
| | | | | | | As found by LGTM.com. Change-Id: I1704f10f9bab1b11ab22824aca0cfcdcb47fef2f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-04-088-1942/+2511
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/opengl/doc/src/cube.qdoc src/corelib/global/qlibraryinfo.cpp src/corelib/text/qbytearray_p.h src/corelib/text/qlocale_data_p.h src/corelib/time/qhijricalendar_data_p.h src/corelib/time/qjalalicalendar_data_p.h src/corelib/time/qromancalendar_data_p.h src/network/ssl/qsslcertificate.h src/widgets/doc/src/graphicsview.qdoc src/widgets/widgets/qcombobox.cpp src/widgets/widgets/qcombobox.h tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro tests/manual/diaglib/debugproxystyle.cpp tests/manual/diaglib/qwidgetdump.cpp tests/manual/diaglib/qwindowdump.cpp tests/manual/diaglib/textdump.cpp util/locale_database/cldr2qlocalexml.py util/locale_database/qlocalexml.py util/locale_database/qlocalexml2cpp.py Resolution of util/locale_database/ are based on: https://codereview.qt-project.org/c/qt/qtbase/+/294250 and src/corelib/{text,time}/*_data_p.h were then regenerated by running those scripts. Updated CMakeLists.txt in each of tests/auto/corelib/serialization/qcborstreamreader/ tests/auto/corelib/serialization/qcborvalue/ tests/auto/gui/kernel/ and generated new ones in each of tests/auto/gui/kernel/qaddpostroutine/ tests/auto/gui/kernel/qhighdpiscaling/ tests/libfuzzer/corelib/text/qregularexpression/optimize/ tests/libfuzzer/gui/painting/qcolorspace/fromiccprofile/ tests/libfuzzer/gui/text/qtextdocument/sethtml/ tests/libfuzzer/gui/text/qtextdocument/setmarkdown/ tests/libfuzzer/gui/text/qtextlayout/beginlayout/ by running util/cmake/pro2cmake.py on their changed .pro files. Changed target name in tests/auto/gui/kernel/qaction/qaction.pro tests/auto/gui/kernel/qaction/qactiongroup.pro tests/auto/gui/kernel/qshortcut/qshortcut.pro to ensure unique target names for CMake Changed tst_QComboBox::currentIndex to not test the currentIndexChanged(QString), as that one does not exist in Qt 6 anymore. Change-Id: I9a85705484855ae1dc874a81f49d27a50b0dcff7
| * Fix parameter order in cldr2qlocalexml.py's usage()Edward Welbourne2020-04-061-1/+1
| | | | | | | | | | | | | | Callers and definition were out of sync. Change-Id: Icda26887cb64c61c7e373766f25559b0d450d112 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
| * Ensure we use UTF-8 for the emitted QLocaleXML data fileEdward Welbourne2020-04-021-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Python helpfully uses a sensible locale when stdout is a tty but uses the system (not the filesystem) default encoding, which may be ascii and unable to encode some of the data we need to save. So brute force kludge it to ensure emit.encoding is UTF-8 when writing the output we'll read as UTF-8 anyway. (This matches dev's commit 0ef79d94f6dcf276ca55b084d27f980b1f260473 for the reworked version of the script.) Task-number: QTBUG-79902 Change-Id: I60ddc896a308c06e01fa87e8e18e112faa17d601 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>