From 9de6023224f0b5960a19f93dc9e85c94174e3ce9 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Tue, 7 May 2024 13:37:39 +0000 Subject: [PATCH] Removed no longer needed pseudo-languages --- config/schemas/settings.json | 2 +- launcher/languages.cpp | 14 +------ launcher/modManager/cmodlistview_moc.cpp | 3 -- lib/Languages.h | 48 +++++++++--------------- lib/modding/CModHandler.cpp | 3 -- 5 files changed, 20 insertions(+), 50 deletions(-) diff --git a/config/schemas/settings.json b/config/schemas/settings.json index 386c5aeab..f1f69e695 100644 --- a/config/schemas/settings.json +++ b/config/schemas/settings.json @@ -71,7 +71,7 @@ }, "gameDataLanguage" : { "type" : "string", - "enum" : [ "auto", "english", "czech", "chinese", "finnish", "french", "german", "hungarian", "italian", "korean", "polish", "portuguese", "russian", "spanish", "swedish", "turkish", "ukrainian", "vietnamese", "other_cp1250", "other_cp1251", "other_cp1252" ], + "enum" : [ "auto", "english", "czech", "chinese", "finnish", "french", "german", "hungarian", "italian", "korean", "polish", "portuguese", "russian", "spanish", "swedish", "turkish", "ukrainian", "vietnamese" ], "default" : "auto" }, "lastSave" : { diff --git a/launcher/languages.cpp b/launcher/languages.cpp index 8dcd86d39..d035c4fb1 100644 --- a/launcher/languages.cpp +++ b/launcher/languages.cpp @@ -18,7 +18,7 @@ #include // list of language names, for generation of translations. Do not use directly, use Languages namespace instead -static const std::array languageTranslatedNamesGenerator = { +static const std::array languageTranslatedNamesGenerator = { { QT_TRANSLATE_NOOP("Language", "Czech"), QT_TRANSLATE_NOOP("Language", "Chinese"), @@ -37,9 +37,6 @@ static const std::array languageTranslatedNamesGenerator = { QT_TRANSLATE_NOOP("Language", "Turkish"), QT_TRANSLATE_NOOP("Language", "Ukrainian"), QT_TRANSLATE_NOOP("Language", "Vietnamese"), - QT_TRANSLATE_NOOP("Language", "Other (East European)"), - QT_TRANSLATE_NOOP("Language", "Other (Cyrillic Script)"), - QT_TRANSLATE_NOOP("Language", "Other (West European)"), } }; @@ -73,9 +70,6 @@ QString Languages::generateLanguageName(const Languages::Options & language) QString localizedName = QApplication::translate("Language", language.nameEnglish.c_str()); QString nativeName = language.nameNative.c_str(); - if(!language.hasTranslation) - return localizedName; - if(activeLanguage == language.identifier) return nativeName; @@ -105,9 +99,6 @@ void Languages::fillLanguages(QComboBox * widget, bool includeAll) for(const auto & language : Languages::getLanguageList()) { - if (!language.hasTranslation && !includeAll) - continue; - QString displayName = generateLanguageName(language); QVariant userData = QString::fromStdString(language.identifier); @@ -141,9 +132,6 @@ void Languages::fillLanguages(QListWidget * widget, bool includeAll) for(const auto & language : Languages::getLanguageList()) { - if (!language.hasTranslation && !includeAll) - continue; - QString displayName = generateLanguageName(language); QVariant userData = QString::fromStdString(language.identifier); diff --git a/launcher/modManager/cmodlistview_moc.cpp b/launcher/modManager/cmodlistview_moc.cpp index 02d72c240..5e0af55b5 100644 --- a/launcher/modManager/cmodlistview_moc.cpp +++ b/launcher/modManager/cmodlistview_moc.cpp @@ -331,9 +331,6 @@ QString CModListView::genModInfoText(CModEntry & mod) for(const auto & language : Languages::getLanguageList()) { - if (!language.hasTranslation) - continue; - QString languageID = QString::fromStdString(language.identifier); if (languageID != baseLanguageID && !mod.getValue(languageID).isValid()) diff --git a/lib/Languages.h b/lib/Languages.h index f762d6e20..52dd1f96f 100644 --- a/lib/Languages.h +++ b/lib/Languages.h @@ -43,11 +43,6 @@ enum class ELanguages UKRAINIAN, VIETNAMESE, - // Pseudo-languages, that have no translations but can define H3 encoding to use - OTHER_CP1250, - OTHER_CP1251, - OTHER_CP1252, - COUNT }; @@ -73,36 +68,29 @@ struct Options /// Ruleset for plural forms in this language EPluralForms pluralForms = EPluralForms::NONE; - - /// VCMI supports translations into this language - bool hasTranslation = false; }; inline const auto & getLanguageList() { - static const std::array languages + static const std::array languages { { - { "czech", "Czech", "Čeština", "CP1250", "cs", "%d.%m.%Y %T", EPluralForms::CZ_3, true }, - { "chinese", "Chinese", "简体中文", "GBK", "zh", "%F %T", EPluralForms::VI_1, true }, // Note: actually Simplified Chinese - { "english", "English", "English", "CP1252", "en", "%F %T", EPluralForms::EN_2, true }, // English uses international date/time format here - { "finnish", "Finnish", "Suomi", "CP1252", "fi", "%d.%m.%Y %T", EPluralForms::EN_2, true }, - { "french", "French", "Français", "CP1252", "fr", "%d/%m/%Y %T", EPluralForms::FR_2, true }, - { "german", "German", "Deutsch", "CP1252", "de", "%d.%m.%Y %T", EPluralForms::EN_2, true }, - { "hungarian", "Hungarian", "Magyar", "CP1250", "hu", "%Y. %m. %d. %T", EPluralForms::EN_2, true }, - { "italian", "Italian", "Italiano", "CP1250", "it", "%d/%m/%Y %T", EPluralForms::EN_2, true }, - { "korean", "Korean", "한국어", "CP949", "ko", "%F %T", EPluralForms::VI_1, true }, - { "polish", "Polish", "Polski", "CP1250", "pl", "%d.%m.%Y %T", EPluralForms::PL_3, true }, - { "portuguese", "Portuguese", "Português", "CP1252", "pt", "%d/%m/%Y %T", EPluralForms::EN_2, true }, // Note: actually Brazilian Portuguese - { "russian", "Russian", "Русский", "CP1251", "ru", "%d.%m.%Y %T", EPluralForms::UK_3, true }, - { "spanish", "Spanish", "Español", "CP1252", "es", "%d/%m/%Y %T", EPluralForms::EN_2, true }, - { "swedish", "Swedish", "Svenska", "CP1252", "sv", "%F %T", EPluralForms::EN_2, true }, - { "turkish", "Turkish", "Türkçe", "CP1254", "tr", "%d.%m.%Y %T", EPluralForms::EN_2, true }, - { "ukrainian", "Ukrainian", "Українська", "CP1251", "uk", "%d.%m.%Y %T", EPluralForms::UK_3, true }, - { "vietnamese", "Vietnamese", "Tiếng Việt", "UTF-8", "vi", "%d/%m/%Y %T", EPluralForms::VI_1, true }, // Fan translation uses special encoding - - { "other_cp1250", "Other (East European)", "", "CP1250", "", "", EPluralForms::NONE, false }, - { "other_cp1251", "Other (Cyrillic Script)", "", "CP1251", "", "", EPluralForms::NONE, false }, - { "other_cp1252", "Other (West European)", "", "CP1252", "", "", EPluralForms::NONE, false } + { "czech", "Czech", "Čeština", "CP1250", "cs", "%d.%m.%Y %T", EPluralForms::CZ_3 }, + { "chinese", "Chinese", "简体中文", "GBK", "zh", "%F %T", EPluralForms::VI_1 }, // Note: actually Simplified Chinese + { "english", "English", "English", "CP1252", "en", "%F %T", EPluralForms::EN_2 }, // English uses international date/time format here + { "finnish", "Finnish", "Suomi", "CP1252", "fi", "%d.%m.%Y %T", EPluralForms::EN_2 }, + { "french", "French", "Français", "CP1252", "fr", "%d/%m/%Y %T", EPluralForms::FR_2 }, + { "german", "German", "Deutsch", "CP1252", "de", "%d.%m.%Y %T", EPluralForms::EN_2 }, + { "hungarian", "Hungarian", "Magyar", "CP1250", "hu", "%Y. %m. %d. %T", EPluralForms::EN_2 }, + { "italian", "Italian", "Italiano", "CP1250", "it", "%d/%m/%Y %T", EPluralForms::EN_2 }, + { "korean", "Korean", "한국어", "CP949", "ko", "%F %T", EPluralForms::VI_1 }, + { "polish", "Polish", "Polski", "CP1250", "pl", "%d.%m.%Y %T", EPluralForms::PL_3 }, + { "portuguese", "Portuguese", "Português", "CP1252", "pt", "%d/%m/%Y %T", EPluralForms::EN_2 }, // Note: actually Brazilian Portuguese + { "russian", "Russian", "Русский", "CP1251", "ru", "%d.%m.%Y %T", EPluralForms::UK_3 }, + { "spanish", "Spanish", "Español", "CP1252", "es", "%d/%m/%Y %T", EPluralForms::EN_2 }, + { "swedish", "Swedish", "Svenska", "CP1252", "sv", "%F %T", EPluralForms::EN_2 }, + { "turkish", "Turkish", "Türkçe", "CP1254", "tr", "%d.%m.%Y %T", EPluralForms::EN_2 }, + { "ukrainian", "Ukrainian", "Українська", "CP1251", "uk", "%d.%m.%Y %T", EPluralForms::UK_3 }, + { "vietnamese", "Vietnamese", "Tiếng Việt", "UTF-8", "vi", "%d/%m/%Y %T", EPluralForms::VI_1 }, // Fan translation uses special encoding } }; static_assert(languages.size() == static_cast(ELanguages::COUNT), "Languages array is missing a value!"); diff --git a/lib/modding/CModHandler.cpp b/lib/modding/CModHandler.cpp index 6bbec82ca..173fd921a 100644 --- a/lib/modding/CModHandler.cpp +++ b/lib/modding/CModHandler.cpp @@ -417,9 +417,6 @@ bool CModHandler::validateTranslations(TModID modName) const for(const auto & language : Languages::getLanguageList()) { - if (!language.hasTranslation) - continue; - if (mod.config[language.identifier].isNull()) continue;