mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-04 23:17:41 +02:00
Hide not installed translation mods to languages other than selected one
This commit is contained in:
parent
b50ebba1ba
commit
adf58fa834
@ -35,6 +35,7 @@
|
|||||||
//
|
//
|
||||||
// Some mod types have additional effects on your mod:
|
// Some mod types have additional effects on your mod:
|
||||||
// Translation: mod of this type is only active if player uses base language of this mod. See "language" property.
|
// Translation: mod of this type is only active if player uses base language of this mod. See "language" property.
|
||||||
|
// Additionally, if such type is used for submod it will be hidden in UI and automatically activated if player uses base language of this mod. This allows to provide locale-specific resources for a mod
|
||||||
// Compatibility: mods of this type are hidden in UI and will be automatically activated if all mod dependencies are active. Intended to be used to provide compatibility patches between mods
|
// Compatibility: mods of this type are hidden in UI and will be automatically activated if all mod dependencies are active. Intended to be used to provide compatibility patches between mods
|
||||||
"modType" : "Graphical",
|
"modType" : "Graphical",
|
||||||
|
|
||||||
|
@ -92,8 +92,21 @@ bool CModEntry::isInstalled() const
|
|||||||
|
|
||||||
bool CModEntry::isVisible() const
|
bool CModEntry::isVisible() const
|
||||||
{
|
{
|
||||||
if (getBaseValue("modType").toString() == "Compatibility" && isSubmod())
|
if (getBaseValue("modType").toString() == "Compatibility")
|
||||||
return false;
|
{
|
||||||
|
if (isSubmod())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getBaseValue("modType").toString() == "Translation")
|
||||||
|
{
|
||||||
|
// Do not show not installed translation mods to languages other than player language
|
||||||
|
if (localData.empty() && getBaseValue("language") != QString::fromStdString(settings["general"]["language"].String()) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (isSubmod())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return !localData.isEmpty() || !repository.isEmpty();
|
return !localData.isEmpty() || !repository.isEmpty();
|
||||||
}
|
}
|
||||||
|
@ -115,9 +115,14 @@ void CModInfo::loadLocalData(const JsonNode & data)
|
|||||||
{
|
{
|
||||||
if (baseLanguage != VLC->generaltexth->getPreferredLanguage())
|
if (baseLanguage != VLC->generaltexth->getPreferredLanguage())
|
||||||
{
|
{
|
||||||
logGlobal->warn("Translation mod %s was not loaded: language mismatch!", verificationInfo.name);
|
if (identifier.find_last_of('.') == std::string::npos)
|
||||||
|
logGlobal->warn("Translation mod %s was not loaded: language mismatch!", verificationInfo.name);
|
||||||
implicitlyEnabled = false;
|
implicitlyEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Translation submods are always explicitly enabled
|
||||||
|
if (identifier.find_last_of('.') != std::string::npos)
|
||||||
|
explicitlyEnabled = true;
|
||||||
}
|
}
|
||||||
if (config["modType"].String() == "Compatibility")
|
if (config["modType"].String() == "Compatibility")
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user