This amends c1141ed729b84f2c413975d37c1a91fb235fb14a; I failed to
update the doc-string after some design changes part-way through
developing the function.
Change-Id: Ifb83107153d1c3b5a9dbd0536a3d6ee1fe32922d
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
A few patterns accounted for a substantial majority of the output, so
report these in summarised (and somewhat tidly formatted) form.
Change-Id: I57f8e41d5e68774fe57b01bb295534aa84a2df15
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
We were missing a few languages CLDR knew about; so add them to the
list in enumdata.py (and add trailing commas to lists to make future
additions not need to change the prior last line; python is perfectly
happy with this).
[ChangeLog][QtCore][QLocale] Added support for Western Balochi, Ido,
Lojban, Sicilian and Souther Kurdish.
Change-Id: I0d24cff46a0ae8db48ec1db8762088f877319982
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
We iterate theoretically many sources (albeit there's only really ever
one) for this data, so accumulate instead of only keeping the last
(and initialize it as the list it always ended up being, not a
dictionary, so that this can work).
The form of each token is a locale name, so it may be lang_Script just
as readily as lang_LAND; so parse (and validate) the tags more
faithfully to catch both cases. Abstract that parsing into a function
and use it in both places that need it.
Change-Id: Ibdbc4eafefab6a5ef70646d9fea150f2cb408d05
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
PEP 8 wisely advises against the use of naked except: (unless
re-raising the error).
Change-Id: Ia0dfdb48b330d33ad370bdb9f6b205046aa919da
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Neglected in 44b6757fe5
Noted the need for this in a relevant script's instructions.
Change-Id: If69666f1799acebd434034c80b91056cb8777488
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Replace lines of formatted output with dictionaries from which that
output can be generated efficiently (in sorted order). Tidy up the
python code, in the process.
Change-Id: Ifb74eb69342646c5dbabc3247b3a8ddef602e934
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The scripts that generate the C++ enum names clean out spaces, so
there's no need for enumdata.py to use the squished names; instead,
include spaces where they belong and use them in the relevant names
where they show up.
Change-Id: I7261c87d69e654bc2e89f44d7ebbc06bfb403c58
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The CLDR data contains eight locales with numeric territory codes, 001
for World, 150 for Europe and 419 for Latin America. The last was
already known in our enumdata.py, but as "Latin America and The
Caribbean", which is not supported by the CLDR, so I've amended it
while adding the other two. This gives us support for Esperanto and
Yiddish (among others).
[ChangeLog][QtCore][QLocale] Added support for World and Europe as
(numeric) "country" codes ("territory" in CLDR terms), thereby
enabling support for Yiddish and Esperanto, among other locales using
such codes.
Task-number: QTBUG-57802
Change-Id: Ibb1180fb720743a3a0589527649d10f3c9cd123d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
In the process, also have it only scan number systems once, caching
the result, rather than scanning all of them for each locale. This
means we only see the new warning messages once, too.
Task-number: QTBUG-69324
Change-Id: Ia0695a0ba6159b50748a61e9949ad5bd07e4c4c3
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Scan CLDR for {,kilo,mega,giga,tera,peta,exa}byte forms and their IEC
equivalents, providing SI and IEC defaults when missing (which all of
IEC are) in addition to the usual numeric data. Extrapolate from any
present data (e.g. French's ko, Mo, Go, To imply Po, Eo and, for IEC,
Kio, Mio, etc.), since CLDR only goes up to tera. Propagate this data
to QLocale's database ready for use by QLocale::formattedDataSize().
Change-Id: Ie6ee978948c68be9f71ab784a128cbfae3d80ee1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Use python more fluently; DRY - use functions to avoid repetition; use
dict-comprehensions; use os.path.join() in preference to arithmetic
with path strings; use elsif to avoid the need for a local variable;
set() can take a generator directly, no need to go via a list; don't
end lines in semicolon (this is python). Test isdir() once instead of
exists() twice on the same name.
Just, generally, use python's feature-set.
Change-Id: Ib114aa016f70b3be09e968d9cfc069b057f49d41
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
load{Language,Script,Country}Map() were all structurally very similar,
so replace them with a single loadMap() that takes a second argument
to say *which* map to load. At the same time, use a dict
comprehension to simplify constructing the result.
Change-Id: Ie43a71156010277200543a8937056efd35251955
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This simplifies a duplicated iteration pattern in the calling code.
It also frees the first-node function to raise an Error (which the
iterator now catches) if it finds no node, where it used to return
False (instead of a node, so other code using it would raise confusing
errors from trying to use False as a node, where now it'll get a clear
Error about a missing node). There were also no callers passing an
empty name, so the test for matching nodes (here moved to its own
short function) didn't need to handle that as a special case.
Change-Id: Ife6cad8943cf5dc2c6ed68429d4a217cb9bea446
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
It had a separate variable for each of three lists for each day of the
week; and used each list only once. Iterate the days of the week for
each lookup, discarding it once used.
Change-Id: I32c8bd5bfcbb99f0a8697d374e63112761f18dbb
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Each StringData object got its own block, of common form, to output
its C array; give each object a name so that we can automate this as
an iteration over StringData objects. One (endonyms_data) gains a
blank line that the others all had but it lacked.
Change-Id: I96c014728a58343c82304c5117b474fee980d9c7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
... because copy-and-paste is worth discouraging. Moved code that
writes and digests our Q Local XML form of the data into a common
class, localexml.Locale, for use by the scripts that write and read
it. Hopefully, it'll be easier to keep what's written and read in
sync hereafter.
Inlined some trivial functions in the process; and only create a
day-number mapping dictionary once, instead of once per use. Also
made it easier to see which attributes get which special handling (and
documented this); and revised an assertion to be more helpful.
Change-Id: I711b6a193a4ad94b5ff714c025f2732cd1a965a7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Include headers for all fields (several were missing).
Make field widths explicit to headers can line up with content.
Use the same format for the (common part of the) all-zeros line.
Document and lay-out headers and format string, to make them easier to
keep in sync. Make a pair of comments clearer.
Re-ran the script to regenerate the table: the result is best viewed
with git show -w, to ignore the spacing changes (or git show -b to
notice only the one harmless discrepancy exposed in old all-zeros
data). Aside from spacing, locale_data[] has gained some missing
columns in its header comment, which now lines headings up properly
above actual data.
Change-Id: I44242f38391353f2ec8e144cb7e8b54b0a359341
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Say where to find the scripts and make clear what to update to get
changes.
Change-Id: I424b7fdf846f7141c6df81eef90eb1ca0378bcf8
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Make the python2 dependency explicit (sooner or later, python3 shall
be the default /bin/env python), make time-zone script executable (it
had a shebang). Use triple-quoted strings, or single quotes, to avoid
extra backslashes, remove some simply spurious backslashes. Use
generators rather than map or filter with lambdas and iterate rather
than duplicating code. Clarify some comments.
Regenerated headers: this upates the date of generation, cuts back a
double-blank-line to single and skips a spurious trailing
comma-newline on an array's data.
Change-Id: I54439f0dec132865991fe5147d509cea0f9419a0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
We were using "Han With Bopomofo" (capitalized With) so that an enum
member in qlocale.h would be suitably camel-case; however, this lead
to spurious changes in qlocale_data_p.h where it names the script.
Use the correct (lower-case with) form and arrange for the enum
members to be generated with first letter of each word upper-case (but
not with each word capitalize()d; some words in there are already
camel-case, so .capitalize()ing would lower-case the later sub-words
in these).
Change-Id: I974c89dd40814eaf3bd538f06b9b4ebf17492f20
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Say where to find the data, how to unpack it and how to run the
scripts to update our source tree from it.
Change-Id: I5b680090bb5850f29c1e7d61efd1d450856b9949
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* A bunch of fixes and additions to the locale data
* Add new scripts from Unicode 8.0 and 9.0
* Map some potentially useful languages and territories
[ChangeLog][QtCore] QLocale data updated to CLDR v29
Change-Id: I759ccb27fe19be2722be913c5c2e6aa5f36e5c14
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some
exceptions, see
http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/
Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one
(in those files which will be under GPL 3 with exceptions)
Change-Id: I42a473ddc97101492a60b9287d90979d9eb35ae1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
[ChangeLog][QtCore] QTimeZone data updated to CLDR v.27
Change-Id: Ic25229d86ac4752ed70f5a729fd33c1a837241dc
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
They are in UTC-03:00, not in UTC+03:00 (just a C&P typo).
Change-Id: Ib342b65967404b8756c62953258b17421b9245af
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
+ A bunch of fixes in the locale data
+ New scripts from Unicode 7.0
+ New locales
- Some locales disappeared (aa_DJ, aa_ER, st_LS, ss_SZ, swc_CD, tn_BW)
- Some locales lost their contents (i.e. en_Dsrt_US)
[ChangeLog][QtCore] QLocale data updated to CLDR v.27
Change-Id: Iba8c7884f8087e577cbb25a8fc106dd7bd3ebb5d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Locales with an explicit parent locale should not inherit
the language-default locale.
For example, a correct chain for zh_Hant_MO is:
zh_Hant_MO -> zh_Hant_HK -> zh_Hant -> root
(two fixups: zh_Hant_HK and root, so that do not inherit zh)
Fortunately, this didn't do any difference in a generated data.
Change-Id: I92e09a95bd86f8723d8fe993f57d99af6f50db5e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Qt copyrights are now in The Qt Company, so we could update the source
code headers accordingly. In the same go we should also fix the links to
point to qt.io.
Outdated header.LGPL removed (use header.LGPL21 instead)
Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing
combination. New header.LGPL-COMM taken in the use file which were
using old header.LGPL3 (src/plugins/platforms/android/extract.cpp)
Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license
combination
Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe
Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
Change-Id: I9c0b110e36dd80c6a0b7275aa13bc548419aca9c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: John Layt <jlayt@kde.org>
Reviewed-by: Mehdi Fekari <mfekari@blackberry.com>
Complete changes from using Olsen/Olson in the code to IANA. Completes
a change started in 5.2 release branch on the public occurrences.
Change-Id: Ib077fcda2c77eef6f04ec28901d8d2d7210b8c72
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Implement the new QTimeZone class based on the Olsen Time Zone ID's.
This is the base implementation and does not include the Platform
backends which are implemented separately.
This change does include a default UTC backed to be used if no Platform
backend is available, i.e. if QT_NO_SYSTEMLOCALE is set and ICU is not
configured. This backend also provides a default set of time zones in
the standard "UTC+00:00" offset format that are guaranteed to always
exist regardless of the Platform backend.
This change includes conversion functions between the Olsen ID's and
Windows ID's using a conversion table based on Unicode CLDR data.
This is implemented for all platforms for scenarios such as a Linux
program needing to communicate with a Windows Exchange Server using
the Windows ID.
The CLDR conversion table is included under the UNICODE license, see
http://unicode.org/copyright.html for details.
[ChangeLog][QtCore][QTimeZone] Added new QTimeZone class to support
time tone calculations using the host platform time zone database
and the Olsen time zone ID's.
Change-Id: Ibb417d08cf2663a0979d2be855d2c6ad6ad01509
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This only added Kosovo [XK] territory and few valid locales for it.
Change-Id: Ia0b47041ed5cd1303b5bc233f2502a3725c74da9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Say hello to Interlingua and Mongolian once again.
Change-Id: I735fbc5793f34620be1f6932a251224b9ded02e3
Reviewed-by: Denis Dzyubenko <denis@ddenis.info>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Some of them were incorrectly spelled (for a while)
Change-Id: I871968e3bbdd2172f4c4dfb6e74729c05e7e8e01
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>