DolphinQt: Support gettext contexts (Qt disambiguations)
This commit is contained in:
parent
19ce87fa63
commit
74ae02f979
|
@ -8,7 +8,7 @@ SRCDIR=Source
|
|||
find $SRCDIR -name '*.cpp' -o -name '*.h' -o -name '*.c' | \
|
||||
xgettext -d dolphin-emu -s --keyword=_ --keyword=wxTRANSLATE --keyword=SuccessAlertT \
|
||||
--keyword=PanicAlertT --keyword=PanicYesNoT --keyword=AskYesNoT --keyword=CriticalAlertT \
|
||||
--keyword=GetStringT --keyword=_trans --keyword=tr --keyword=QT_TR_NOOP \
|
||||
--keyword=GetStringT --keyword=_trans --keyword=tr:1,1t --keyword=tr:1,2c --keyword=QT_TR_NOOP \
|
||||
--add-comments=i18n -p ./Languages/po -o dolphin-emu.pot -f - --package-name="Dolphin Emulator" \
|
||||
--from-code=utf-8
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
|
||||
#include "Common/File.h"
|
||||
#include "Common/FileUtil.h"
|
||||
|
@ -213,7 +214,17 @@ public:
|
|||
QString translate(const char* context, const char* source_text,
|
||||
const char* disambiguation = nullptr, int n = -1) const override
|
||||
{
|
||||
return QString::fromUtf8(m_mo_file.Translate(source_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()));
|
||||
}
|
||||
else
|
||||
{
|
||||
return QString::fromUtf8(m_mo_file.Translate(source_text));
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue