diff --git a/launcher/modManager/cmodlistview_moc.cpp b/launcher/modManager/cmodlistview_moc.cpp index 1d541d3ae..144d0e9ea 100644 --- a/launcher/modManager/cmodlistview_moc.cpp +++ b/launcher/modManager/cmodlistview_moc.cpp @@ -24,6 +24,7 @@ #include "../jsonutils.h" #include "../../lib/CConfigHandler.h" +#include "../../lib/Languages.h" void CModListView::setupModModel() { @@ -221,7 +222,6 @@ QString CModListView::genModInfoText(CModEntry & mod) QString textTemplate = prefix + "
%2
"; QString listTemplate = "%1: %2
"; QString noteTemplate = "%1
"; - QString compatibleString = prefix + tr("Mod is compatible") + ""; QString incompatibleString = redPrefix + tr("Mod is incompatible") + ""; QString supportedVersions = redPrefix + "%2 %3 %4"; @@ -242,9 +242,7 @@ QString CModListView::genModInfoText(CModEntry & mod) result += urlTemplate.arg(tr("Contact")).arg(mod.getValue("contact").toString()).arg(mod.getValue("contact").toString()); //compatibility info - if(mod.isCompatible()) - result += compatibleString.arg(tr("Compatibility")); - else + if(!mod.isCompatible()) { auto compatibilityInfo = mod.getValue("compatibility").toMap(); auto minStr = compatibilityInfo.value("min").toString(); @@ -267,6 +265,31 @@ QString CModListView::genModInfoText(CModEntry & mod) } } + QStringList supportedLanguages; + QVariant baseLanguageVariant = mod.getBaseValue("language"); + QString baseLanguageID = baseLanguageVariant.isValid() ? baseLanguageVariant.toString() : "english"; + + bool needToShowSupportedLanguages = false; + + for(const auto & language : Languages::getLanguageList()) + { + if (!language.hasTranslation) + continue; + + QString languageID = QString::fromStdString(language.identifier); + + if (languageID != baseLanguageID && !mod.getValue(languageID).isValid()) + continue; + + if (languageID != baseLanguageID) + needToShowSupportedLanguages = true; + + supportedLanguages += QApplication::translate("Language", language.nameEnglish.c_str()); + } + + if(needToShowSupportedLanguages) + result += replaceIfNotEmpty(supportedLanguages, lineTemplate.arg(tr("Languages"))); + result += replaceIfNotEmpty(mod.getValue("depends"), lineTemplate.arg(tr("Required mods"))); result += replaceIfNotEmpty(mod.getValue("conflicts"), lineTemplate.arg(tr("Conflicting mods"))); result += replaceIfNotEmpty(mod.getValue("description"), textTemplate.arg(tr("Description")));