Deprecate old aliases for two countries and several languages
[ChangeLog][QtCore][QLocale] Deprecated several Language and Country aliases, ready for removal in Qt 6.0, in favor of their newer names. Task-number: QTBUG-84669 Pick-to: 5.15 5.15.2 Change-Id: Iebaa0a5a77bfa12f7014de53fab4a25b5f1cc92c Reviewed-by: Lars Knoll <lars.knoll@qt.io>bb10
parent
2575a8ced3
commit
2c4874be40
|
|
@ -115,22 +115,14 @@ QLocale::Language QLocalePrivate::codeToLanguage(QStringView code) noexcept
|
|||
|
||||
if (uc3 == 0) {
|
||||
// legacy codes
|
||||
if (uc1 == 'n' && uc2 == 'o') { // no -> nb
|
||||
static_assert(QLocale::Norwegian == QLocale::NorwegianBokmal);
|
||||
return QLocale::Norwegian;
|
||||
}
|
||||
if (uc1 == 't' && uc2 == 'l') { // tl -> fil
|
||||
static_assert(QLocale::Tagalog == QLocale::Filipino);
|
||||
return QLocale::Tagalog;
|
||||
}
|
||||
if (uc1 == 's' && uc2 == 'h') { // sh -> sr[_Latn]
|
||||
static_assert(QLocale::SerboCroatian == QLocale::Serbian);
|
||||
return QLocale::SerboCroatian;
|
||||
}
|
||||
if (uc1 == 'm' && uc2 == 'o') { // mo -> ro
|
||||
static_assert(QLocale::Moldavian == QLocale::Romanian);
|
||||
return QLocale::Moldavian;
|
||||
}
|
||||
if (uc1 == 'n' && uc2 == 'o') // no -> nb
|
||||
return QLocale::NorwegianBokmal;
|
||||
if (uc1 == 't' && uc2 == 'l') // tl -> fil
|
||||
return QLocale::Filipino;
|
||||
if (uc1 == 's' && uc2 == 'h') // sh -> sr[_Latn]
|
||||
return QLocale::Serbian;
|
||||
if (uc1 == 'm' && uc2 == 'o') // mo -> ro
|
||||
return QLocale::Romanian;
|
||||
// Android uses the following deprecated codes
|
||||
if (uc1 == 'i' && uc2 == 'w') // iw -> he
|
||||
return QLocale::Hebrew;
|
||||
|
|
|
|||
|
|
@ -500,12 +500,16 @@ public:
|
|||
Chewa = Nyanja,
|
||||
Frisian = WesternFrisian,
|
||||
Kurundi = Rundi,
|
||||
Moldavian = Romanian,
|
||||
Norwegian = NorwegianBokmal,
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
Moldavian Q_DECL_ENUMERATOR_DEPRECATED_X("Obsolete name, use Romanian") = Romanian,
|
||||
Norwegian Q_DECL_ENUMERATOR_DEPRECATED_X("Obsolete name, use NorwegianBokmal") = NorwegianBokmal,
|
||||
#endif
|
||||
RhaetoRomance = Romansh,
|
||||
SerboCroatian = Serbian,
|
||||
Tagalog = Filipino,
|
||||
Twi = Akan,
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
SerboCroatian Q_DECL_ENUMERATOR_DEPRECATED_X("Obsolete name, use Serbian") = Serbian,
|
||||
Tagalog Q_DECL_ENUMERATOR_DEPRECATED_X("Obsolete name, use Filipino") = Filipino,
|
||||
Twi Q_DECL_ENUMERATOR_DEPRECATED_X("Obsolete name, use Akan") = Akan,
|
||||
#endif
|
||||
Uigur = Uighur,
|
||||
|
||||
LastLanguage = NigerianPidgin
|
||||
|
|
@ -932,8 +936,10 @@ public:
|
|||
RepublicOfKorea = SouthKorea,
|
||||
RussianFederation = Russia,
|
||||
SyrianArabRepublic = Syria,
|
||||
Tokelau = TokelauCountry,
|
||||
Tuvalu = TuvaluCountry,
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
Tokelau Q_DECL_ENUMERATOR_DEPRECATED_X("Obsolete name, use TokelauCountry") = TokelauCountry,
|
||||
Tuvalu Q_DECL_ENUMERATOR_DEPRECATED_X("Obsolete name, use TuvaluCountry") = TuvaluCountry,
|
||||
#endif
|
||||
|
||||
LastCountry = Europe
|
||||
};
|
||||
|
|
|
|||
|
|
@ -349,9 +349,9 @@
|
|||
\value NorthernSotho
|
||||
\value NorthernThai Obsolete, no locale data available
|
||||
\value NorthNdebele
|
||||
\value NorwegianBokmal same as Norwegian
|
||||
\value NorwegianBokmal
|
||||
\value NorwegianNynorsk
|
||||
\value Norwegian same as NorwegianBokmal
|
||||
\value Norwegian Obsolete, please use NorwegianBokmal
|
||||
\value Nuer
|
||||
\value Nyanja
|
||||
\value Nyankole
|
||||
|
|
|
|||
|
|
@ -233,12 +233,12 @@ void tst_QCollator::state()
|
|||
c.setLocale(QLocale::French);
|
||||
c.setNumericMode(true);
|
||||
c.setIgnorePunctuation(true);
|
||||
c.setLocale(QLocale::Norwegian);
|
||||
c.setLocale(QLocale::NorwegianBokmal);
|
||||
|
||||
QCOMPARE(c.caseSensitivity(), Qt::CaseInsensitive);
|
||||
QCOMPARE(c.numericMode(), true);
|
||||
QCOMPARE(c.ignorePunctuation(), true);
|
||||
QCOMPARE(c.locale(), QLocale(QLocale::Norwegian));
|
||||
QCOMPARE(c.locale(), QLocale(QLocale::NorwegianBokmal));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -454,12 +454,11 @@ void tst_QLocale::defaulted_ctor()
|
|||
TEST_CTOR("eo", Esperanto, World)
|
||||
TEST_CTOR("yi", Yiddish, World)
|
||||
|
||||
QVERIFY(QLocale::Norwegian == QLocale::NorwegianBokmal);
|
||||
TEST_CTOR("no", Norwegian, Norway)
|
||||
TEST_CTOR("nb", Norwegian, Norway)
|
||||
TEST_CTOR("no", NorwegianBokmal, Norway)
|
||||
TEST_CTOR("nb", NorwegianBokmal, Norway)
|
||||
TEST_CTOR("nn", NorwegianNynorsk, Norway)
|
||||
TEST_CTOR("no_NO", Norwegian, Norway)
|
||||
TEST_CTOR("nb_NO", Norwegian, Norway)
|
||||
TEST_CTOR("no_NO", NorwegianBokmal, Norway)
|
||||
TEST_CTOR("nb_NO", NorwegianBokmal, Norway)
|
||||
TEST_CTOR("nn_NO", NorwegianNynorsk, Norway)
|
||||
TEST_CTOR("es_ES", Spanish, Spain)
|
||||
TEST_CTOR("es_419", Spanish, LatinAmerica)
|
||||
|
|
@ -645,9 +644,9 @@ void tst_QLocale::emptyCtor()
|
|||
|
||||
void tst_QLocale::legacyNames()
|
||||
{
|
||||
QVERIFY(QLocale::Norwegian == QLocale::NorwegianBokmal);
|
||||
QLocale::setDefault(QLocale(QLocale::C));
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
#define TEST_CTOR(req_lang, req_country, exp_lang, exp_country) \
|
||||
{ \
|
||||
QLocale l(QLocale::req_lang, QLocale::req_country); \
|
||||
|
|
@ -661,6 +660,7 @@ void tst_QLocale::legacyNames()
|
|||
TEST_CTOR(Tagalog, AnyCountry, Filipino, Philippines)
|
||||
|
||||
#undef TEST_CTOR
|
||||
#endif
|
||||
|
||||
#define TEST_CTOR(req_lc, exp_lang, exp_country) \
|
||||
{ \
|
||||
|
|
@ -674,7 +674,7 @@ void tst_QLocale::legacyNames()
|
|||
}
|
||||
|
||||
TEST_CTOR("mo_MD", Romanian, Moldova)
|
||||
TEST_CTOR("no", Norwegian, Norway)
|
||||
TEST_CTOR("no", NorwegianBokmal, Norway)
|
||||
TEST_CTOR("sh_ME", Serbian, Montenegro)
|
||||
TEST_CTOR("tl", Filipino, Philippines)
|
||||
TEST_CTOR("iw", Hebrew, Israel)
|
||||
|
|
|
|||
|
|
@ -779,17 +779,17 @@ void tst_QDoubleSpinBox::valueFromTextAndValidate_data()
|
|||
QTest::newRow("data1") << QString() << Intermediate << 0.0 << 100.0 << (int)QLocale::C << QString();
|
||||
QTest::newRow("data2") << QString("asd") << Invalid << 0.0 << 100.0 << (int)QLocale::C << QString();
|
||||
QTest::newRow("data3") << QString("2.2") << Acceptable << 0.0 << 100.0 << (int)QLocale::C << QString();
|
||||
QTest::newRow("data4") << QString(" ") << Intermediate << 0.0 << 100.0 << (int)QLocale::Norwegian << QString();
|
||||
QTest::newRow("data4") << QString(" ") << Intermediate << 0.0 << 100.0 << (int)QLocale::NorwegianBokmal << QString();
|
||||
QTest::newRow("data5") << QString(" ") << Intermediate << 0.0 << 100.0 << (int)QLocale::C << QString();
|
||||
QTest::newRow("data6") << QString(",") << Intermediate << 0.0 << 100.0 << (int)QLocale::Norwegian << QString();
|
||||
QTest::newRow("data6") << QString(",") << Intermediate << 0.0 << 100.0 << (int)QLocale::NorwegianBokmal << QString();
|
||||
QTest::newRow("data7") << QString(",") << Invalid << 0.0 << 100.0 << (int)QLocale::C << QString();
|
||||
QTest::newRow("data8") << QString("1 ") << Acceptable << 0.0 << 1000.0 << (int)QLocale::Norwegian << QString("1");
|
||||
QTest::newRow("data8") << QString("1 ") << Acceptable << 0.0 << 1000.0 << (int)QLocale::NorwegianBokmal << QString("1");
|
||||
QTest::newRow("data9") << QString("1 ") << Acceptable << 0.0 << 100.0 << (int)QLocale::C << QString("1");
|
||||
QTest::newRow("data10") << QString(" 1") << Acceptable << 0.0 << 100.0 << (int)QLocale::Norwegian << QString("1");
|
||||
QTest::newRow("data10") << QString(" 1") << Acceptable << 0.0 << 100.0 << (int)QLocale::NorwegianBokmal << QString("1");
|
||||
QTest::newRow("data11") << QString(" 1") << Acceptable << 0.0 << 100.0 << (int)QLocale::C << QString("1");
|
||||
QTest::newRow("data12") << QString("1,") << Acceptable << 0.0 << 100.0 << (int)QLocale::Norwegian << QString();
|
||||
QTest::newRow("data12") << QString("1,") << Acceptable << 0.0 << 100.0 << (int)QLocale::NorwegianBokmal << QString();
|
||||
QTest::newRow("data13") << QString("1,") << Acceptable << 0.0 << 1000.0 << (int)QLocale::C << QString();
|
||||
QTest::newRow("data14") << QString("1, ") << Acceptable << 0.0 << 100.0 << (int)QLocale::Norwegian << QString("1,");
|
||||
QTest::newRow("data14") << QString("1, ") << Acceptable << 0.0 << 100.0 << (int)QLocale::NorwegianBokmal << QString("1,");
|
||||
QTest::newRow("data15") << QString("1, ") << Invalid << 0.0 << 100.0 << (int)QLocale::C << QString();
|
||||
QTest::newRow("data16") << QString("2") << Intermediate << 100.0 << 102.0 << (int)QLocale::C << QString();
|
||||
QTest::newRow("data17") << QString("22.0") << Intermediate << 100.0 << 102.0 << (int)QLocale::C << QString();
|
||||
|
|
@ -828,7 +828,7 @@ void tst_QDoubleSpinBox::valueFromTextAndValidate_data()
|
|||
QTest::newRow("data50") << QString("2.2") << Acceptable << 0.0 << 1000.0 << (int)QLocale::C << QString();
|
||||
QTest::newRow("data51") << QString("2.2,00") << Invalid << 0.0 << 1000.0 << (int)QLocale::C << QString();
|
||||
QTest::newRow("data52") << QString("2..2,00") << Invalid << 0.0 << 1000.0 << (int)QLocale::German << QString();
|
||||
QTest::newRow("data53") << QString("2.2") << Invalid << 0.0 << 1000.0 << (int)QLocale::Norwegian << QString();
|
||||
QTest::newRow("data53") << QString("2.2") << Invalid << 0.0 << 1000.0 << (int)QLocale::NorwegianBokmal << QString();
|
||||
QTest::newRow("data54") << QString(" 2.2") << Acceptable << 0.0 << 1000.0 << (int)QLocale::C << QString();
|
||||
QTest::newRow("data55") << QString("2.2 ") << Acceptable << 0.0 << 1000.0 << (int)QLocale::C << QString("2.2");
|
||||
QTest::newRow("data56") << QString(" 2.2 ") << Acceptable << 0.0 << 1000.0 << (int)QLocale::C << QString("2.2");
|
||||
|
|
|
|||
|
|
@ -879,7 +879,7 @@ void tst_QSpinBox::locale_data()
|
|||
QTest::addColumn<QString>("text");
|
||||
QTest::addColumn<int>("valFromText");
|
||||
|
||||
QTest::newRow("data0") << QLocale(QLocale::Norwegian, QLocale::Norway) << 1234 << QString("1234") << QString("2345") << 2345;
|
||||
QTest::newRow("data0") << QLocale(QLocale::NorwegianBokmal, QLocale::Norway) << 1234 << QString("1234") << QString("2345") << 2345;
|
||||
QTest::newRow("data1") << QLocale(QLocale::German, QLocale::Germany) << 1234 << QString("1234") << QString("2345") << 2345;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue