Skip to content
Permalink
Browse files
Merge pull request #8006 from JosJuice/qt-rtl
DolphinQt: Enable RTL layout
  • Loading branch information
lioncash committed Oct 19, 2020
2 parents 69140ca + f1ec4fb commit 5722c68
Show file tree
Hide file tree
Showing 8 changed files with 698 additions and 2 deletions.

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN +1.63 MB (1700%) Externals/gettext/msgfmt.exe
Binary file not shown.
@@ -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 @@ class MoTranslator : public QTranslator
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(); });

0 comments on commit 5722c68

Please sign in to comment.