Merge pull request #9246 from JosJuice/translation-eot

DolphinQt: Don't return 0x04 bytes from tr
This commit is contained in:
Léo Lam 2020-11-18 02:31:13 +01:00 committed by GitHub
commit eb1581bbcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -186,7 +186,7 @@ public:
[](const char* a, const char* b) { return strcmp(a, b) < 0; });
if (iter == end || strcmp(*iter, original_string) != 0)
return original_string;
return nullptr;
u32 offset = ReadU32(&m_data[m_offset_translation_table + std::distance(begin, iter) * 8 + 4]);
return &m_data[offset];
@ -214,17 +214,21 @@ public:
QString translate(const char* context, const char* source_text,
const char* disambiguation = nullptr, int n = -1) const override
{
const char* translated_text;
if (disambiguation)
{
std::string combined_string = disambiguation;
combined_string += '\4';
combined_string += source_text;
return QString::fromUtf8(m_mo_file.Translate(combined_string.c_str()));
translated_text = m_mo_file.Translate(combined_string.c_str());
}
else
{
return QString::fromUtf8(m_mo_file.Translate(source_text));
translated_text = m_mo_file.Translate(source_text);
}
return QString::fromUtf8(translated_text ? translated_text : source_text);
}
private: