1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Do not ignore translations for maps & campaigns

This commit is contained in:
Ivan Savenko 2023-08-11 15:59:35 +03:00
parent b2de5d32d1
commit 474045194a

View File

@ -313,19 +313,7 @@ void CGeneralTextHandler::registerStringOverride(const std::string & modContext,
assert(!modContext.empty());
assert(!language.empty());
std::string baseModLanguage = getModLanguage(modContext);
if (baseModLanguage != language)
{
// this is translation - only add text to existing strings, do not register new ones
if (stringsLocalizations.count(UID.get()) == 0)
{
logMod->warn("Unknown string '%s' in mod '%s' for language '%s'. Ignoring", UID.get(), modContext, language);
return;
}
}
// NOTE: implicitly creates entry, intended - strings added by vcmi (and potential UI mods) are not registered anywhere at the moment
// NOTE: implicitly creates entry, intended - strings added by maps, campaigns, vcmi and potentially - UI mods are not registered anywhere at the moment
auto & entry = stringsLocalizations[UID.get()];
entry.overrideLanguage = language;
@ -349,6 +337,9 @@ bool CGeneralTextHandler::validateTranslation(const std::string & language, cons
if (string.second.baseLanguage == language && !string.second.baseValue.empty())
continue; // Base string already uses our language
if (string.second.baseLanguage.empty())
continue; // String added in localization, not present in base language (e.g. maps/campaigns)
if (config.Struct().count(string.first) > 0)
continue;