Browse Source

Do not ignore translations for maps & campaigns

Ivan Savenko 2 years ago
parent
commit
474045194a
1 changed files with 4 additions and 13 deletions
  1. 4 13
      lib/CGeneralTextHandler.cpp

+ 4 - 13
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;