[libcalamares] Prepare for ie (Interlingue) support in Qt

This commit is contained in:
Adriaan de Groot 2024-07-20 22:32:46 +02:00
parent c34d401cc3
commit ec5272ad65
3 changed files with 13 additions and 2 deletions

View File

@ -122,9 +122,15 @@ LocaleTests::testEsperanto()
void void
LocaleTests::testInterlingue() LocaleTests::testInterlingue()
{ {
#if CALAMARES_QT_SUPPORT_INTERLINGUE
// ie was fixed in version ... of Qt
QCOMPARE( QLocale( "ie" ).language(), QLocale::Interlingue );
QCOMPARE( QLocale( QLocale::Interlingue ).language(), QLocale::Interlingue );
#else
// ie / Interlingue is borked (is "ie" even the right name?) // ie / Interlingue is borked (is "ie" even the right name?)
QCOMPARE( QLocale( "ie" ).language(), QLocale::C ); QCOMPARE( QLocale( "ie" ).language(), QLocale::C );
QCOMPARE( QLocale( QLocale::Interlingue ).language(), QLocale::English ); QCOMPARE( QLocale( QLocale::Interlingue ).language(), QLocale::English );
#endif
// "ia" exists (post-war variant of Interlingue) // "ia" exists (post-war variant of Interlingue)
QCOMPARE( QLocale( "ia" ).language(), QLocale::Interlingua ); QCOMPARE( QLocale( "ia" ).language(), QLocale::Interlingua );

View File

@ -94,11 +94,11 @@ static constexpr const TranslationSpecialCase special_cases[] = {
QLocale::Script::AnyScript, QLocale::Script::AnyScript,
QLocale::Country::AnyCountry, QLocale::Country::AnyCountry,
nullptr }, nullptr },
// Interlingue is mapped to interlingu*a* because // Interlingue is mapped to interlingu*a* (up until Qt version ...) because
// the real Language::Interlingue acts like C locale. // the real Language::Interlingue acts like C locale.
{ "ie", { "ie",
nullptr, nullptr,
QLocale::Language::Interlingua, CALAMARES_QT_SUPPORT_INTERLINGUE ? QLocale::Language::Interlingue : QLocale::Language::Interlingua,
QLocale::Script::AnyScript, QLocale::Script::AnyScript,
QLocale::Country::AnyCountry, QLocale::Country::AnyCountry,
"Interlingue" }, "Interlingue" },

View File

@ -18,6 +18,9 @@
#include <QObject> #include <QObject>
#include <QString> #include <QString>
///@brief Define to 1 if the Qt version being used supports Interlingue fully
#define CALAMARES_QT_SUPPORT_INTERLINGUE 0
namespace Calamares namespace Calamares
{ {
namespace Locale namespace Locale
@ -35,6 +38,8 @@ namespace Locale
* Serbian written with Latin characters (not Cyrillic). * Serbian written with Latin characters (not Cyrillic).
* - `ca@valencia` is the Catalan dialect spoken in Valencia. * - `ca@valencia` is the Catalan dialect spoken in Valencia.
* There is no Qt code for it. * There is no Qt code for it.
*
* (There are more special cases, not documented here)
*/ */
class DLLEXPORT Translation : public QObject class DLLEXPORT Translation : public QObject
{ {