mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-10 22:31:40 +02:00
make new languages selectable only with config file
This commit is contained in:
@@ -102,6 +102,9 @@ void Languages::fillLanguages(QComboBox * widget, bool includeAll)
|
||||
|
||||
for(const auto & language : Languages::getLanguageList())
|
||||
{
|
||||
if(!language.selectable && activeLanguage != language.identifier)
|
||||
continue;
|
||||
|
||||
QString displayName = generateLanguageName(language);
|
||||
QVariant userData = QString::fromStdString(language.identifier);
|
||||
|
||||
@@ -135,6 +138,9 @@ void Languages::fillLanguages(QListWidget * widget, bool includeAll)
|
||||
|
||||
for(const auto & language : Languages::getLanguageList())
|
||||
{
|
||||
if(!language.selectable && activeLanguage != language.identifier)
|
||||
continue;
|
||||
|
||||
QString displayName = generateLanguageName(language);
|
||||
QVariant userData = QString::fromStdString(language.identifier);
|
||||
|
||||
|
@@ -135,7 +135,7 @@ void MainWindow::detectPreferredLanguage()
|
||||
logGlobal->info("Preferred language: %s", userLang.toStdString());
|
||||
|
||||
for (auto const & vcmiLang : Languages::getLanguageList())
|
||||
if (vcmiLang.tagIETF == userLang.toStdString())
|
||||
if (vcmiLang.tagIETF == userLang.toStdString() && vcmiLang.selectable)
|
||||
selectedLanguage = vcmiLang.identifier;
|
||||
|
||||
if (!selectedLanguage.empty())
|
||||
|
@@ -74,32 +74,35 @@ struct Options
|
||||
|
||||
/// Ruleset for plural forms in this language
|
||||
EPluralForms pluralForms = EPluralForms::NONE;
|
||||
|
||||
/// Selectable in launcher
|
||||
bool selectable;
|
||||
};
|
||||
|
||||
inline const auto & getLanguageList()
|
||||
{
|
||||
static const std::array<Options, 20> languages
|
||||
{ {
|
||||
{ "czech", "Czech", "Čeština", "CP1250", "cs", "cze", "%d.%m.%Y %H:%M", EPluralForms::CZ_3 },
|
||||
{ "chinese", "Chinese", "简体中文", "GBK", "zh", "chi", "%Y-%m-%d %H:%M", EPluralForms::VI_1 }, // Note: actually Simplified Chinese
|
||||
{ "english", "English", "English", "CP1252", "en", "eng", "%Y-%m-%d %H:%M", EPluralForms::EN_2 }, // English uses international date/time format here
|
||||
{ "finnish", "Finnish", "Suomi", "CP1252", "fi", "fin", "%d.%m.%Y %H:%M", EPluralForms::EN_2 },
|
||||
{ "french", "French", "Français", "CP1252", "fr", "fre", "%d/%m/%Y %H:%M", EPluralForms::FR_2 },
|
||||
{ "german", "German", "Deutsch", "CP1252", "de", "ger", "%d.%m.%Y %H:%M", EPluralForms::EN_2 },
|
||||
{ "greek", "Greek", "ελληνικά", "CP1253", "el", "ell", "%d/%m/%Y %H:%M", EPluralForms::EN_2 },
|
||||
{ "hungarian", "Hungarian", "Magyar", "CP1250", "hu", "hun", "%Y. %m. %d. %H:%M", EPluralForms::EN_2 },
|
||||
{ "italian", "Italian", "Italiano", "CP1250", "it", "ita", "%d/%m/%Y %H:%M", EPluralForms::EN_2 },
|
||||
{ "japanese", "Japanese", "日本語", "UTF-8", "ja", "jpn", "%Y年%m月%d日 %H:%M", EPluralForms::NONE },
|
||||
{ "korean", "Korean", "한국어", "CP949", "ko", "kor", "%Y-%m-%d %H:%M", EPluralForms::VI_1 },
|
||||
{ "polish", "Polish", "Polski", "CP1250", "pl", "pol", "%d.%m.%Y %H:%M", EPluralForms::PL_3 },
|
||||
{ "portuguese", "Portuguese", "Português", "CP1252", "pt", "por", "%d/%m/%Y %H:%M", EPluralForms::EN_2 }, // Note: actually Brazilian Portuguese
|
||||
{ "russian", "Russian", "Русский", "CP1251", "ru", "rus", "%d.%m.%Y %H:%M", EPluralForms::UK_3 },
|
||||
{ "spanish", "Spanish", "Español", "CP1252", "es", "spa", "%d/%m/%Y %H:%M", EPluralForms::EN_2 },
|
||||
{ "swedish", "Swedish", "Svenska", "CP1252", "sv", "swe", "%Y-%m-%d %H:%M", EPluralForms::EN_2 },
|
||||
{ "norwegian", "Norwegian", "Norsk", "CP1252", "no", "nor", "%d/%m/%Y %H:%M", EPluralForms::EN_2 },
|
||||
{ "turkish", "Turkish", "Türkçe", "CP1254", "tr", "tur", "%d.%m.%Y %H:%M", EPluralForms::EN_2 },
|
||||
{ "ukrainian", "Ukrainian", "Українська", "CP1251", "uk", "ukr", "%d.%m.%Y %H:%M", EPluralForms::UK_3 },
|
||||
{ "vietnamese", "Vietnamese", "Tiếng Việt", "UTF-8", "vi", "vie", "%d/%m/%Y %H:%M", EPluralForms::VI_1 }, // Fan translation uses special encoding
|
||||
{ "czech", "Czech", "Čeština", "CP1250", "cs", "cze", "%d.%m.%Y %H:%M", EPluralForms::CZ_3, true },
|
||||
{ "chinese", "Chinese", "简体中文", "GBK", "zh", "chi", "%Y-%m-%d %H:%M", EPluralForms::VI_1, true }, // Note: actually Simplified Chinese
|
||||
{ "english", "English", "English", "CP1252", "en", "eng", "%Y-%m-%d %H:%M", EPluralForms::EN_2, true }, // English uses international date/time format here
|
||||
{ "finnish", "Finnish", "Suomi", "CP1252", "fi", "fin", "%d.%m.%Y %H:%M", EPluralForms::EN_2, true },
|
||||
{ "french", "French", "Français", "CP1252", "fr", "fre", "%d/%m/%Y %H:%M", EPluralForms::FR_2, true },
|
||||
{ "german", "German", "Deutsch", "CP1252", "de", "ger", "%d.%m.%Y %H:%M", EPluralForms::EN_2, true },
|
||||
{ "greek", "Greek", "ελληνικά", "CP1253", "el", "ell", "%d/%m/%Y %H:%M", EPluralForms::EN_2, false },
|
||||
{ "hungarian", "Hungarian", "Magyar", "CP1250", "hu", "hun", "%Y. %m. %d. %H:%M", EPluralForms::EN_2, true },
|
||||
{ "italian", "Italian", "Italiano", "CP1250", "it", "ita", "%d/%m/%Y %H:%M", EPluralForms::EN_2, true },
|
||||
{ "japanese", "Japanese", "日本語", "JIS", "ja", "jpn", "%Y年%m月%d日 %H:%M", EPluralForms::NONE, false },
|
||||
{ "korean", "Korean", "한국어", "CP949", "ko", "kor", "%Y-%m-%d %H:%M", EPluralForms::VI_1, true },
|
||||
{ "polish", "Polish", "Polski", "CP1250", "pl", "pol", "%d.%m.%Y %H:%M", EPluralForms::PL_3, true },
|
||||
{ "portuguese", "Portuguese", "Português", "CP1252", "pt", "por", "%d/%m/%Y %H:%M", EPluralForms::EN_2, true }, // Note: actually Brazilian Portuguese
|
||||
{ "russian", "Russian", "Русский", "CP1251", "ru", "rus", "%d.%m.%Y %H:%M", EPluralForms::UK_3, true },
|
||||
{ "spanish", "Spanish", "Español", "CP1252", "es", "spa", "%d/%m/%Y %H:%M", EPluralForms::EN_2, true },
|
||||
{ "swedish", "Swedish", "Svenska", "CP1252", "sv", "swe", "%Y-%m-%d %H:%M", EPluralForms::EN_2, true },
|
||||
{ "norwegian", "Norwegian", "Norsk", "CP1252", "no", "nor", "%d/%m/%Y %H:%M", EPluralForms::EN_2, false },
|
||||
{ "turkish", "Turkish", "Türkçe", "CP1254", "tr", "tur", "%d.%m.%Y %H:%M", EPluralForms::EN_2, true },
|
||||
{ "ukrainian", "Ukrainian", "Українська", "CP1251", "uk", "ukr", "%d.%m.%Y %H:%M", EPluralForms::UK_3, true },
|
||||
{ "vietnamese", "Vietnamese", "Tiếng Việt", "UTF-8", "vi", "vie", "%d/%m/%Y %H:%M", EPluralForms::VI_1, true }, // Fan translation uses special encoding
|
||||
} };
|
||||
static_assert(languages.size() == static_cast<size_t>(ELanguages::COUNT), "Languages array is missing a value!");
|
||||
|
||||
|
Reference in New Issue
Block a user