summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorQt CI Bot <qt_ci_bot@qt-project.org>2021-04-15 21:27:52 +0000
committerQt CI Bot <qt_ci_bot@qt-project.org>2021-04-15 21:27:52 +0000
commit8f6c93b645bd5c6975b93a172ad459f4e3a1dea0 (patch)
treea1df765182dfdd7ca51f8965b15af402e2cb90a3 /util
parent92d351089bf7e285c9800342ff72205c04984f6c (diff)
parent6cefc83875feea4fd795afebef158fc3f30c27c7 (diff)
Merge integration refs/builds/qtci/dev/1618489823
Diffstat (limited to 'util')
-rw-r--r--util/locale_database/cldr.py4
-rw-r--r--util/locale_database/enumdata.py8
-rw-r--r--util/locale_database/qlocalexml.py6
-rwxr-xr-xutil/locale_database/qlocalexml2cpp.py24
-rw-r--r--util/locale_database/testlocales/localemodel.cpp8
-rw-r--r--util/xkbdatagen/main.cpp4
6 files changed, 36 insertions, 18 deletions
diff --git a/util/locale_database/cldr.py b/util/locale_database/cldr.py
index f2b6616fce..9b08d8a652 100644
--- a/util/locale_database/cldr.py
+++ b/util/locale_database/cldr.py
@@ -87,7 +87,7 @@ class CldrReader (object):
give = (give[0],
# Substitute according to http://www.unicode.org/reports/tr35/#Likely_Subtags
have[1] if give[1] == 'AnyScript' else give[1],
- have[2] if give[2] == 'AnyCountry' else give[2],
+ have[2] if give[2] == 'AnyTerritory' else give[2],
give[3]) # AnyVariant similarly ?
yield have, give
@@ -676,7 +676,7 @@ enumdata.py (keeping the old name as an alias):
from enumdata import language_list, script_list, country_list
for form, book, empty in (('language', language_list, 'AnyLanguage'),
('script', script_list, 'AnyScript'),
- ('country', country_list, 'AnyCountry')):
+ ('country', country_list, 'AnyTerritory')):
cache[form] = dict((pair[1], (num, pair[0]))
for num, pair in book.items() if pair[0] != 'C')
# (Have to filter out the C locale, as we give it the
diff --git a/util/locale_database/enumdata.py b/util/locale_database/enumdata.py
index ab0f4a3eae..4181e290ac 100644
--- a/util/locale_database/enumdata.py
+++ b/util/locale_database/enumdata.py
@@ -409,7 +409,7 @@ language_aliases = {
}
country_list = {
- 0: ("AnyCountry", "ZZ"),
+ 0: ("AnyTerritory", "ZZ"),
1: ("Afghanistan", "AF"),
2: ("Aland Islands", "AX"),
@@ -700,6 +700,12 @@ country_aliases = {
'UnitedStatesMinorOutlyingIslands': 'UnitedStatesOutlyingIslands',
'CuraSao': 'Curacao',
'CzechRepublic': 'Czechia',
+
+ # Backwards compatibility with old Country enum, prior to Qt 6.2:
+ 'AnyCountry': 'AnyTerritory',
+ 'NauruCountry': 'NauruTerritory',
+ 'TokelauCountry': 'TokelauTerritory',
+ 'TuvaluCountry': 'TuvaluTerritory',
}
script_list = {
diff --git a/util/locale_database/qlocalexml.py b/util/locale_database/qlocalexml.py
index e5aadba995..4fcfe32a43 100644
--- a/util/locale_database/qlocalexml.py
+++ b/util/locale_database/qlocalexml.py
@@ -155,7 +155,7 @@ class QLocaleXmlReader (object):
try:
to = likely[(locale.language, 'AnyScript', locale.country)]
except KeyError:
- to = likely[(locale.language, 'AnyScript', 'AnyCountry')]
+ to = likely[(locale.language, 'AnyScript', 'AnyTerritory')]
except KeyError:
pass
else:
@@ -196,7 +196,7 @@ class QLocaleXmlReader (object):
sub-tags mapping says language's default locale uses the given
script and country."""
for have, give in self.__likely:
- if have[1:] == ('AnyScript', 'AnyCountry') and give[2] != 'AnyCountry':
+ if have[1:] == ('AnyScript', 'AnyTerritory') and give[2] != 'AnyTerritory':
assert have[0] == give[0], (have, give)
yield ((self.__langByName[give[0]][0],
self.__textByName[give[1]][0]),
@@ -590,7 +590,7 @@ class Locale (object):
return cls(cls.__monthNames(calendars),
language='C', language_code='0', languageEndonym='',
script='AnyScript', script_code='0',
- country='AnyCountry', country_code='0', countryEndonym='',
+ country='AnyTerritory', country_code='0', countryEndonym='',
groupSizes=(3, 3, 1),
decimal='.', group=',', list=';', percent='%',
zero='0', minus='-', plus='+', exp='e',
diff --git a/util/locale_database/qlocalexml2cpp.py b/util/locale_database/qlocalexml2cpp.py
index 1483545ce7..c15d6d2f55 100755
--- a/util/locale_database/qlocalexml2cpp.py
+++ b/util/locale_database/qlocalexml2cpp.py
@@ -394,7 +394,7 @@ class LocaleDataWriter (LocaleSourceEditor):
self.__writeNameData(self.writer.write, scripts, 'script')
def countryNames(self, countries):
- self.__writeNameData(self.writer.write, countries, 'country')
+ self.__writeNameData(self.writer.write, countries, 'territory')
# TODO: unify these next three into the previous three; kept
# separate for now to verify we're not changing data.
@@ -406,7 +406,7 @@ class LocaleDataWriter (LocaleSourceEditor):
self.__writeCodeList(self.writer.write, scripts, 'script', 4)
def countryCodes(self, countries): # TODO: unify with countryNames()
- self.__writeCodeList(self.writer.write, countries, 'country', 3)
+ self.__writeCodeList(self.writer.write, countries, 'territory', 3)
class CalendarDataWriter (LocaleSourceEditor):
formatCalendar = (
@@ -469,7 +469,8 @@ class LocaleHeaderWriter (SourceFileEditor):
self.writer.write('\n')
def countries(self, countries):
- self.__enum('Country', countries, self.__country)
+ self.writer.write(" // ### Qt 7: Rename to Territory\n")
+ self.__enum('Country', countries, self.__country, 'Territory')
def scripts(self, scripts):
self.__enum('Script', scripts, self.__script)
@@ -480,8 +481,12 @@ class LocaleHeaderWriter (SourceFileEditor):
country_aliases as __country,
script_aliases as __script)
- def __enum(self, name, book, alias):
+ def __enum(self, name, book, alias, suffix = None):
assert book
+
+ if suffix is None:
+ suffix = name
+
out, dupes = self.writer.write, self.__dupes
out(' enum {} : ushort {{\n'.format(name))
for key, value in book.items():
@@ -495,13 +500,20 @@ class LocaleHeaderWriter (SourceFileEditor):
raise Error('The script name "{}" is messy'.format(member))
else:
member = ''.join(member.split())
- member = member + name if member in dupes else member
+ member = member + suffix if member in dupes else member
out(' {} = {},\n'.format(member, key))
out('\n '
+ ',\n '.join('{} = {}'.format(*pair)
for pair in sorted(alias.items()))
- + ',\n\n Last{} = {}\n }};\n'.format(name, member))
+ + ',\n\n Last{} = {}'.format(suffix, member))
+
+ # for "LastCountry = LastTerritory"
+ # ### Qt 7: Remove
+ if suffix != name:
+ out(',\n Last{} = Last{}'.format(name, suffix))
+
+ out('\n };\n')
def usage(name, err, message = ''):
err.write("""Usage: {} path/to/qlocale.xml root/of/qtbase
diff --git a/util/locale_database/testlocales/localemodel.cpp b/util/locale_database/testlocales/localemodel.cpp
index d380d01e09..d171bc9855 100644
--- a/util/locale_database/testlocales/localemodel.cpp
+++ b/util/locale_database/testlocales/localemodel.cpp
@@ -36,11 +36,11 @@ static const int g_model_cols = 6;
struct LocaleListItem
{
int language;
- int country;
+ int territory;
};
const LocaleListItem g_locale_list[] = {
- { 1, 0 }, // C/AnyCountry
+ { 1, 0 }, // C/AnyTerritory
{ 3, 69 }, // Afan/Ethiopia
{ 3, 111 }, // Afan/Kenya
{ 4, 59 }, // Afar/Djibouti
@@ -317,7 +317,7 @@ QVariant LocaleModel::data(const QModelIndex &index, int role) const
locale = QLocale::system();
} else {
LocaleListItem item = g_locale_list[index.row() - 2];
- locale = QLocale((QLocale::Language)item.language, (QLocale::Country)item.country);
+ locale = QLocale((QLocale::Language)item.language, (QLocale::Territory)item.territory);
}
switch (index.column()) {
@@ -386,7 +386,7 @@ QVariant LocaleModel::headerData(int section, Qt::Orientation orientation, int r
LocaleListItem item = g_locale_list[section - 2];
return QLocale::languageToString((QLocale::Language)item.language)
+ QLatin1Char('/')
- + QLocale::countryToString((QLocale::Country)item.country);
+ + QLocale::territoryToString((QLocale::Territory)item.territory);
}
}
diff --git a/util/xkbdatagen/main.cpp b/util/xkbdatagen/main.cpp
index 4eba2d8a54..d0b96b78d3 100644
--- a/util/xkbdatagen/main.cpp
+++ b/util/xkbdatagen/main.cpp
@@ -450,7 +450,7 @@ int main(int argc, char **argv)
" const char *variant; // 0 means any variant\n"
" Qt::LayoutDirection direction;\n"
" QLocale::Language language;\n"
- " QLocale::Country country;\n"
+ " QLocale::Territory territory;\n"
"} xkbLayoutData[] = {\n");
// contents
@@ -485,7 +485,7 @@ int main(int argc, char **argv)
}
// wrapping up
- printf(" { 0, 0, Qt::LeftToRight, QLocale::C, QLocale::AnyCountry }\n"
+ printf(" { 0, 0, Qt::LeftToRight, QLocale::C, QLocale::AnyTerritory }\n"
"};\n");
return 0;