Merge pull request #8006 from JosJuice/qt-rtl

DolphinQt: Enable RTL layout
This commit is contained in:
LC
2020-10-19 07:46:40 -04:00
committed by GitHub
8 changed files with 698 additions and 2 deletions
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -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
+23 -1
View File
@@ -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:
@@ -291,6 +302,17 @@ static bool TryInstallTranslator(const QString& exact_language_code)
void Translation::Initialize()
{
// Let the translation select the GUI directionality. This is intentionally excluded
// from compilation, since all that matters is that xgettext sees it. We could use
// QT_TRANSLATE_NOOP3 instead of tr, but that doesn't compile correctly when put
// on a line of its own, so we would need to exclude it from compilation anyway.
#if 0
QGuiApplication::tr(
"QT_LAYOUT_DIRECTION",
"Translate this string to the string 'LTR' in left-to-right languages or to 'RTL' in "
"right-to-left languages (such as Hebrew and Arabic) to get proper widget layout.");
#endif
// Hook up Dolphin internal translation
Common::RegisterStringTranslator(
[](const char* text) { return QObject::tr(text).toStdString(); });