mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Fix incorrect warnings about missing translations
This commit is contained in:
parent
d86c0a969d
commit
95dd4b3ffb
@ -313,6 +313,18 @@ 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
|
||||
auto & entry = stringsLocalizations[UID.get()];
|
||||
|
||||
|
@ -141,8 +141,11 @@ class DLL_LINKAGE CGeneralTextHandler
|
||||
std::vector<size_t> scenariosCountPerCampaign;
|
||||
|
||||
std::string getModLanguage(const std::string & modContext);
|
||||
public:
|
||||
|
||||
/// add selected string to internal storage as high-priority strings
|
||||
void registerStringOverride(const std::string & modContext, const std::string & language, const TextIdentifier & UID, const std::string & localized);
|
||||
|
||||
public:
|
||||
/// validates translation of specified language for specified mod
|
||||
/// returns true if localization is valid and complete
|
||||
/// any error messages will be written to log file
|
||||
@ -155,9 +158,6 @@ public:
|
||||
/// add selected string to internal storage
|
||||
void registerString(const std::string & modContext, const TextIdentifier & UID, const std::string & localized);
|
||||
|
||||
/// add selected string to internal storage as high-priority strings
|
||||
void registerStringOverride(const std::string & modContext, const std::string & language, const TextIdentifier & UID, const std::string & localized);
|
||||
|
||||
// returns true if identifier with such name was registered, even if not translated to current language
|
||||
// not required right now, can be added if necessary
|
||||
// bool identifierExists( const std::string identifier) const;
|
||||
|
Loading…
Reference in New Issue
Block a user