mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Merge pull request #8006 from JosJuice/qt-rtl
DolphinQt: Enable RTL layout
This commit is contained in:
@ -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(); });
|
||||
|
Reference in New Issue
Block a user