Prepare to support taking CLDR data from its github upstream
We've previously used the zip-file form, but that's not been published for CLDR v44.1 - the advice on the list was to use github instead. That, however, has ↑↑↑ as a special value for fields, meaning to inherit from a prent locale. So special-case that value. I have verified that v44 from the zip file produces identical results to v44 from github, with this minor fix. As it happens v44.1 also produces identical results. Pick-to: 6.5 Change-Id: I6eb0aedda7556753cdc83bb9d76652fbb68dc669 Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> (cherry picked from commit bcdd51cfae24731a73d008add23d3c1e85bbd8d0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit c112981789f5885e5db0daa4a081fa26708bafb0)
This commit is contained in:
parent
652ee1562f
commit
ed6fe4d06a
@ -3,16 +3,21 @@
|
||||
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
"""Convert CLDR data to QLocaleXML
|
||||
|
||||
The CLDR data can be downloaded from CLDR_, which has a sub-directory
|
||||
for each version; you need the ``core.zip`` file for your version of
|
||||
choice (typically the latest). This script has had updates to cope up
|
||||
to v38.1; for later versions, we may need adaptations. Unpack the
|
||||
downloaded ``core.zip`` and check it has a common/main/ sub-directory:
|
||||
pass the path of that root of the download to this script as its first
|
||||
command-line argument. Pass the name of the file in which to write
|
||||
output as the second argument; either omit it or use '-' to select the
|
||||
standard output. This file is the input needed by
|
||||
``./qlocalexml2cpp.py``
|
||||
The CLDR data can be downloaded as a zip-file from CLDR_, which has a
|
||||
sub-directory for each version; you need the ``core.zip`` file for
|
||||
your version of choice (typically the latest), which you should then
|
||||
unpack. Alternatively, you can clone the git repo from github_, which
|
||||
has a tag for each release and a maint/maint-$ver branch for each
|
||||
major version. Either way, the CLDR top-level directory should have a
|
||||
subdirectory called common/ which contains (among other things)
|
||||
subdirectories main/ and supplemental/.
|
||||
|
||||
This script has had updates to cope up to v44.1; for later versions,
|
||||
we may need adaptations. Pass the path of the CLDR top-level directory
|
||||
to this script as its first command-line argument. Pass the name of
|
||||
the file in which to write output as the second argument; either omit
|
||||
it or use '-' to select the standard output. This file is the input
|
||||
needed by ``./qlocalexml2cpp.py``
|
||||
|
||||
When you update the CLDR data, be sure to also update
|
||||
src/corelib/text/qt_attribution.json's entry for unicode-cldr. Check
|
||||
@ -28,6 +33,7 @@ time zone names; see cldr2qtimezone.py for details.
|
||||
All the scripts mentioned support --help to tell you how to use them.
|
||||
|
||||
.. _CLDR: https://unicode.org/Public/cldr/
|
||||
.. _github: https://github.com/unicode-org/cldr
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
|
@ -204,7 +204,10 @@ class LocaleScanner (object):
|
||||
for elt in self.__find(xpath):
|
||||
try:
|
||||
if draft is None or elt.draft <= draft:
|
||||
return elt.dom.firstChild.nodeValue
|
||||
value = elt.dom.firstChild.nodeValue
|
||||
# The github version of CLDR uses '↑↑↑' to indicate "inherit"
|
||||
if value != '↑↑↑':
|
||||
return value
|
||||
except (AttributeError, KeyError):
|
||||
pass
|
||||
except Error as e:
|
||||
|
Loading…
x
Reference in New Issue
Block a user