mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Merge pull request #2558 from IvanSavenko/localization_fix
Do not ignore translations for maps & campaigns
This commit is contained in:
commit
ccf31d19f8
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user