Script Canvas node translation system and naming consistency

Signed-off-by: lsemp3d <58790905+lsemp3d@users.noreply.github.com>
This commit is contained in:
lsemp3d
2021-12-07 15:40:04 -08:00
parent 8d096ebf61
commit 72bfd8bdf8
1515 changed files with 235974 additions and 2095 deletions
@@ -104,35 +104,49 @@ namespace GraphCanvas
return m_database.find(key) != m_database.end();
}
GraphCanvas::TranslationRequests::Details TranslationDatabase::GetDetails(const AZStd::string& key)
GraphCanvas::TranslationRequests::Details TranslationDatabase::GetDetails(const AZStd::string& key, const Details& fallbackDetails)
{
const char* name = Get(key + ".name");
const char* tooltip = Get(key + ".tooltip");
const char* subtitle = Get(key + ".subtitle");
const char* category = Get(key + ".category");
static bool s_traceMissingItems = true;
if (s_traceMissingItems)
Details details;
if (!Get(key + ".name", details.m_name))
{
AZ_TracePrintf("GraphCanvas", AZStd::string::format("Value (name) not found for key: %s", key.c_str()).c_str());
AZ_TracePrintf("GraphCanvas", AZStd::string::format("Value (tooltip) not found for key: %s", key.c_str()).c_str());
AZ_TracePrintf("GraphCanvas", AZStd::string::format("Value (subtitle) not found for key: %s", key.c_str()).c_str());
AZ_TracePrintf("GraphCanvas", AZStd::string::format("Value (category) not found for key: %s", key.c_str()).c_str());
details.m_name = fallbackDetails.m_name;
}
return Details(name ? name : "", tooltip ? tooltip : "", subtitle ? subtitle : "", category ? category : "");
if (!Get(key + ".tooltip", details.m_tooltip))
{
details.m_tooltip = fallbackDetails.m_tooltip;
}
if (!Get(key + ".subtitle", details.m_subtitle))
{
details.m_subtitle = fallbackDetails.m_subtitle;
}
if (!Get(key + ".category", details.m_category))
{
details.m_category = fallbackDetails.m_category;
}
return details;
}
const char* TranslationDatabase::Get(const AZStd::string& key)
bool TranslationDatabase::Get(const AZStd::string& key, AZStd::string& value)
{
AZStd::lock_guard<AZStd::recursive_mutex> lock(m_mutex);
if (m_database.find(key) != m_database.end())
{
return m_database[key].c_str();
value = m_database[key];
return true;
}
return "";
static bool s_traceMissingItems = false;
if (s_traceMissingItems)
{
AZ_TracePrintf("GraphCanvas", AZStd::string::format("Value not found for key: %s", key.c_str()).c_str());
}
return false;
}
bool TranslationDatabase::Add(const TranslationFormat& format)