diff options
Diffstat (limited to 'src/linguist/shared/numerus.cpp')
-rw-r--r-- | src/linguist/shared/numerus.cpp | 70 |
1 files changed, 21 insertions, 49 deletions
diff --git a/src/linguist/shared/numerus.cpp b/src/linguist/shared/numerus.cpp index 6a1ca8130..ef52bcdb6 100644 --- a/src/linguist/shared/numerus.cpp +++ b/src/linguist/shared/numerus.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Linguist of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "translator.h" @@ -162,7 +137,6 @@ static const QLocale::Language englishStyleLanguages[] = { QLocale::Bashkir, QLocale::Basque, QLocale::Bengali, - QLocale::Bihari, QLocale::Bulgarian, QLocale::Catalan, QLocale::Cornish, @@ -206,7 +180,7 @@ static const QLocale::Language englishStyleLanguages[] = { // Missing: Nahuatl, QLocale::Nepali, QLocale::NorthernSotho, - QLocale::NorwegianBokmal, // same as Norwegian + QLocale::NorwegianBokmal, QLocale::NorwegianNynorsk, QLocale::Occitan, QLocale::Oriya, @@ -232,7 +206,6 @@ static const QLocale::Language englishStyleLanguages[] = { QLocale::Tsonga, QLocale::Tswana, QLocale::Turkmen, - // QLocale::Twi, // mapped to Akan QLocale::Uigur, QLocale::Urdu, QLocale::Uzbek, @@ -278,13 +251,11 @@ static const QLocale::Language russianStyleLanguages[] = { QLocale::Croatian, QLocale::Russian, QLocale::Serbian, - // QLocale::SerboCroatian, // deprecated, mapped to Serbian QLocale::Ukrainian, EOL }; static const QLocale::Language polishLanguage[] = { QLocale::Polish, EOL }; static const QLocale::Language romanianLanguages[] = { - // QLocale::Moldavian, // deprecated, mapped to Romanian QLocale::Romanian, EOL }; @@ -292,24 +263,24 @@ static const QLocale::Language slovenianLanguage[] = { QLocale::Slovenian, EOL } static const QLocale::Language malteseLanguage[] = { QLocale::Maltese, EOL }; static const QLocale::Language welshLanguage[] = { QLocale::Welsh, EOL }; static const QLocale::Language arabicLanguage[] = { QLocale::Arabic, EOL }; -static const QLocale::Language tagalogLanguage[] = { QLocale::Tagalog, EOL }; +static const QLocale::Language tagalogLanguage[] = { QLocale::Filipino, EOL }; -static const QLocale::Country frenchStyleCountries[] = { +static const QLocale::Territory frenchStyleCountries[] = { // keep synchronized with frenchStyleLanguages - QLocale::AnyCountry, - QLocale::AnyCountry, - QLocale::AnyCountry, + QLocale::AnyTerritory, + QLocale::AnyTerritory, + QLocale::AnyTerritory, QLocale::Brazil, - QLocale::AnyCountry, - QLocale::AnyCountry, - QLocale::AnyCountry + QLocale::AnyTerritory, + QLocale::AnyTerritory, + QLocale::AnyTerritory }; struct NumerusTableEntry { const uchar *rules; int rulesSize; const char * const *forms; const QLocale::Language *languages; - const QLocale::Country *countries; + const QLocale::Territory *countries; const char * const gettextRules; }; @@ -353,7 +324,7 @@ static const NumerusTableEntry numerusTable[] = { static const int NumerusTableSize = sizeof(numerusTable) / sizeof(numerusTable[0]); -bool getNumerusInfo(QLocale::Language language, QLocale::Country country, +bool getNumerusInfo(QLocale::Language language, QLocale::Territory country, QByteArray *rules, QStringList *forms, const char **gettextRules) { while (true) { @@ -361,7 +332,7 @@ bool getNumerusInfo(QLocale::Language language, QLocale::Country country, const NumerusTableEntry &entry = numerusTable[i]; for (int j = 0; entry.languages[j] != EOL; ++j) { if (entry.languages[j] == language - && ((!entry.countries && country == QLocale::AnyCountry) + && ((!entry.countries && country == QLocale::AnyTerritory) || (entry.countries && entry.countries[j] == country))) { if (rules) { *rules = QByteArray::fromRawData(reinterpret_cast<const char *>(entry.rules), @@ -379,9 +350,9 @@ bool getNumerusInfo(QLocale::Language language, QLocale::Country country, } } - if (country == QLocale::AnyCountry) + if (country == QLocale::AnyTerritory) break; - country = QLocale::AnyCountry; + country = QLocale::AnyTerritory; } return false; } @@ -393,14 +364,15 @@ QString getNumerusInfoString() for (int i = 0; i < NumerusTableSize; ++i) { const NumerusTableEntry &entry = numerusTable[i]; for (int j = 0; entry.languages[j] != EOL; ++j) { - QLocale loc(entry.languages[j], entry.countries ? entry.countries[j] : QLocale::AnyCountry); + QLocale loc(entry.languages[j], entry.countries ? entry.countries[j] + : QLocale::AnyTerritory); QString lang = QLocale::languageToString(entry.languages[j]); if (loc.language() == QLocale::C) lang += QLatin1String(" (!!!)"); - else if (entry.countries && entry.countries[j] != QLocale::AnyCountry) - lang += QLatin1String(" (") + QLocale::countryToString(loc.country()) + QLatin1Char(')'); + else if (entry.countries && entry.countries[j] != QLocale::AnyTerritory) + lang += QLatin1String(" (%1)").arg(QLocale::territoryToString(loc.territory())); else - lang += QLatin1String(" [") + QLocale::countryToString(loc.country()) + QLatin1Char(']'); + lang += QLatin1String(" [%1]").arg(QLocale::territoryToString(loc.territory())); langs << QString::fromLatin1("%1 %2 %3\n").arg(lang, -40).arg(loc.name(), -8) .arg(QString::fromLatin1(entry.gettextRules)); } |