1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Added validation for mod translations

This commit is contained in:
Ivan Savenko 2023-02-09 21:33:59 +02:00
parent 4ec13dc5ab
commit eeafc48663
3 changed files with 14 additions and 4 deletions

View File

@ -428,7 +428,13 @@ bool CGeneralTextHandler::validateTranslation(const std::string & language, cons
if (allPresent)
logMod->warn("Translation into language '%s' in mod '%s' is incomplete! Missing lines:", language, modContext);
logMod->warn(R"( "%s" : "",)", string.first);
std::string currentText;
if (string.second.overrideValue.empty())
currentText = string.second.baseValue;
else
currentText = string.second.overrideValue;
logMod->warn(R"( "%s" : "%s",)", string.first, currentText);
allPresent = false;
}
@ -442,7 +448,7 @@ bool CGeneralTextHandler::validateTranslation(const std::string & language, cons
if (allFound)
logMod->warn("Translation into language '%s' in mod '%s' has unused lines:", language, modContext);
logMod->warn(R"( "%s" : "",)", string.first);
logMod->warn(R"( "%s" : "%s",)", string.first, string.second.String());
allFound = false;
}

View File

@ -18,6 +18,8 @@ VCMI_LIB_NAMESPACE_BEGIN
RiverTypeHandler::RiverTypeHandler()
{
objects.push_back(new RiverType);
VLC->generaltexth->registerString("core", objects[0]->getNameTextID(), "");
}
RiverType * RiverTypeHandler::loadFromJson(
@ -74,7 +76,7 @@ std::string RiverType::getNameTranslated() const
RiverType::RiverType():
id(River::NO_RIVER),
identifier("core:empty")
identifier("empty")
{}
VCMI_LIB_NAMESPACE_END

View File

@ -18,6 +18,8 @@ VCMI_LIB_NAMESPACE_BEGIN
RoadTypeHandler::RoadTypeHandler()
{
objects.push_back(new RoadType);
VLC->generaltexth->registerString("core", objects[0]->getNameTextID(), "");
}
RoadType * RoadTypeHandler::loadFromJson(
@ -74,7 +76,7 @@ std::string RoadType::getNameTranslated() const
RoadType::RoadType():
id(Road::NO_ROAD),
identifier("core:empty"),
identifier("empty"),
movementCost(GameConstants::BASE_MOVEMENT_COST)
{}
VCMI_LIB_NAMESPACE_END