From 474045194aeb009dba710964bb9e10296db1a521 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Fri, 11 Aug 2023 15:59:35 +0300 Subject: [PATCH] Do not ignore translations for maps & campaigns --- lib/CGeneralTextHandler.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/lib/CGeneralTextHandler.cpp b/lib/CGeneralTextHandler.cpp index eb2cd8900..5739db44f 100644 --- a/lib/CGeneralTextHandler.cpp +++ b/lib/CGeneralTextHandler.cpp @@ -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;