Fixed the translation error messages for GraphCanvas
It was unconditionally logging an AZ_Warning and AZ_Error if a translation entry with the same key was added to the database. This didn't account for the same key and value being added to the database, so loading the same translation file twice would result in error messages for each entry. Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
This commit is contained in:
@@ -163,9 +163,11 @@ namespace GraphCanvas
|
||||
}
|
||||
else
|
||||
{
|
||||
AZStd::string warning = AZStd::string::format("Unable to store key: %s with value: %s because that key already exists with value: %s", entry.first.c_str(), entry.second.c_str(), m_database[entry.first].c_str());
|
||||
AZ_Warning("TranslationSerializer", false, warning.c_str());
|
||||
warnings = true;
|
||||
const bool valueMatches = entry.second == m_database[entry.first];
|
||||
AZ_Warning("TranslationDatabase", valueMatches,
|
||||
R"(Unable to store key: "%s" with value: "%s" because that key already exists with value: "%s")",
|
||||
entry.first.c_str(), entry.second.c_str(), m_database[entry.first].c_str());
|
||||
warnings = !valueMatches;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,11 +24,12 @@ namespace GraphCanvas
|
||||
}
|
||||
else
|
||||
{
|
||||
const AZStd::string& existingValue = translationDbItr->second;
|
||||
[[maybe_unused]] const AZStd::string& existingValue = translationDbItr->second;
|
||||
|
||||
// There is a name collision
|
||||
const AZStd::string error = AZStd::string::format("Unable to store key: %s with value: %s because that key already exists with value: %s (proposed: %s)", baseKey.c_str(), it.GetString(), existingValue.c_str(), it.GetString());
|
||||
AZ_Error("TranslationSerializer", false, error.c_str());
|
||||
AZ_Error("TranslationSerializer", existingValue == it.GetString(),
|
||||
R"(Unable to store key: "%s" with value: "%s" because that key already exists with value: "%s" (proposed: "%s"))",
|
||||
baseKey.c_str(), it.GetString(), existingValue.c_str(), it.GetString());
|
||||
}
|
||||
}
|
||||
else if (it.IsObject())
|
||||
|
||||
Reference in New Issue
Block a user