From 4b366e1fe88f1e685847acb2bc72b073db792eb7 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Thu, 29 Jun 2023 23:13:36 +0300 Subject: [PATCH] Added new languages: Czech, Italian, Korean --- config/schemas/mod.json | 11 ++++++++++- config/schemas/settings.json | 4 ++-- launcher/languages.cpp | 4 +++- lib/Languages.h | 35 ++++++++++++++++++----------------- 4 files changed, 33 insertions(+), 21 deletions(-) diff --git a/config/schemas/mod.json b/config/schemas/mod.json index a9bb2ecc5..1d677b38b 100644 --- a/config/schemas/mod.json +++ b/config/schemas/mod.json @@ -153,7 +153,10 @@ "language" : { "type" : "string", "description" : "Base language of the mod, before applying localizations. By default vcmi assumes English", - "enum" : [ "chinese", "english", "korean", "german", "polish", "russian", "spanish", "ukrainian" ] + "enum" : [ "czech, "chinese", "english", "french", "german", "italian", "korean", "polish", "russian", "spanish", "ukrainian" ] + }, + "czech" : { + "$ref" : "#/definitions/localizable" }, "chinese" : { "$ref" : "#/definitions/localizable" @@ -161,9 +164,15 @@ "english" : { "$ref" : "#/definitions/localizable" }, + "french" : { + "$ref" : "#/definitions/localizable" + }, "german" : { "$ref" : "#/definitions/localizable" }, + "italian" : { + "$ref" : "#/definitions/localizable" + }, "korean" : { "$ref" : "#/definitions/localizable" }, diff --git a/config/schemas/settings.json b/config/schemas/settings.json index 4ba76d319..45c11e533 100644 --- a/config/schemas/settings.json +++ b/config/schemas/settings.json @@ -58,12 +58,12 @@ }, "language" : { "type" : "string", - "enum" : [ "english", "chinese", "german", "polish", "russian", "spanish", "ukrainian" ], + "enum" : [ "english", "czech", "chinese", "german", "italian", "korean", "polish", "russian", "spanish", "ukrainian" ], "default" : "english" }, "gameDataLanguage" : { "type" : "string", - "enum" : [ "auto", "english", "chinese", "german", "korean", "polish", "russian", "spanish", "ukrainian", "other_cp1250", "other_cp1251", "other_cp1252" ], + "enum" : [ "auto", "english", "czech", "chinese", "german", "italian", "korean", "polish", "russian", "spanish", "ukrainian", "other_cp1250", "other_cp1251", "other_cp1252" ], "default" : "auto" }, "lastSave" : { diff --git a/launcher/languages.cpp b/launcher/languages.cpp index 0009ac158..fbe23cc86 100644 --- a/launcher/languages.cpp +++ b/launcher/languages.cpp @@ -18,12 +18,14 @@ #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"), QT_TRANSLATE_NOOP("Language", "English"), QT_TRANSLATE_NOOP("Language", "French"), QT_TRANSLATE_NOOP("Language", "German"), + QT_TRANSLATE_NOOP("Language", "Italian"), QT_TRANSLATE_NOOP("Language", "Korean"), QT_TRANSLATE_NOOP("Language", "Polish"), QT_TRANSLATE_NOOP("Language", "Russian"), diff --git a/lib/Languages.h b/lib/Languages.h index 53201463e..b0e37ff73 100644 --- a/lib/Languages.h +++ b/lib/Languages.h @@ -14,11 +14,13 @@ namespace Languages enum class ELanguages { + CZECH, CHINESE, ENGLISH, FRENCH, GERMAN, - KOREAN, // currently has no translations or detection + ITALIAN, + KOREAN, POLISH, RUSSIAN, SPANISH, @@ -49,30 +51,29 @@ struct Options /// primary IETF language tag std::string tagIETF; - /// VCMI is capable of detecting H3 install in this language - bool hasDetection = false; - /// VCMI supports translations into this language bool hasTranslation = false; }; inline const auto & getLanguageList() { - static const std::array languages + static const std::array languages { { - { "chinese", "Chinese", "简体中文", "GBK", "zh", true, true }, // Note: actually Simplified Chinese - { "english", "English", "English", "CP1252", "en", true, true }, - { "french", "French", "Français", "CP1252", "fr", true, true }, - { "german", "German", "Deutsch", "CP1252", "de", true, true }, - { "korean", "Korean", "한국어", "CP949", "ko", false, false }, - { "polish", "Polish", "Polski", "CP1250", "pl", true, true }, - { "russian", "Russian", "Русский", "CP1251", "ru", true, true }, - { "spanish", "Spanish", "Español", "CP1252", "es", false, true }, - { "ukrainian", "Ukrainian", "Українська", "CP1251", "uk", true, true }, + { "czech", "Czech", "Čeština", "CP1250", "cs", true }, + { "chinese", "Chinese", "简体中文", "GBK", "zh", true }, // Note: actually Simplified Chinese + { "english", "English", "English", "CP1252", "en", true }, + { "french", "French", "Français", "CP1252", "fr", true }, + { "german", "German", "Deutsch", "CP1252", "de", true }, + { "italian", "Italian", "Italiano", "CP1250", "it", true }, + { "korean", "Korean", "한국어", "CP949", "ko", true }, + { "polish", "Polish", "Polski", "CP1250", "pl", true }, + { "russian", "Russian", "Русский", "CP1251", "ru", true }, + { "spanish", "Spanish", "Español", "CP1252", "es", true }, + { "ukrainian", "Ukrainian", "Українська", "CP1251", "uk", true }, - { "other_cp1250", "Other (East European)", "", "CP1251", "", false, false }, - { "other_cp1251", "Other (Cyrillic Script)", "", "CP1250", "", false, false }, - { "other_cp1252", "Other (West European)", "", "CP1252", "", false, false } + { "other_cp1250", "Other (East European)", "", "CP1251", "", false }, + { "other_cp1251", "Other (Cyrillic Script)", "", "CP1250", "", false }, + { "other_cp1252", "Other (West European)", "", "CP1252", "", false } } }; static_assert(languages.size() == static_cast(ELanguages::COUNT), "Languages array is missing a value!");