mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #3551
Diadlo (1): fix(translator): Added layout direction reset on translation.
This commit is contained in:
commit
79b9895874
|
@ -58,7 +58,8 @@ void Translator::translate()
|
||||||
// system menu translation
|
// system menu translation
|
||||||
QTranslator *qtTranslator = new QTranslator();
|
QTranslator *qtTranslator = new QTranslator();
|
||||||
QString s_locale = "qt_"+locale;
|
QString s_locale = "qt_"+locale;
|
||||||
if (qtTranslator->load(s_locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
|
QString location = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
||||||
|
if (qtTranslator->load(s_locale, location))
|
||||||
{
|
{
|
||||||
QApplication::installTranslator(qtTranslator);
|
QApplication::installTranslator(qtTranslator);
|
||||||
qDebug() << "System translation loaded" << locale;
|
qDebug() << "System translation loaded" << locale;
|
||||||
|
@ -75,6 +76,16 @@ void Translator::translate()
|
||||||
QCoreApplication::installTranslator(translator);
|
QCoreApplication::installTranslator(translator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// After the language is changed from RTL to LTR, the layout direction isn't
|
||||||
|
// always restored
|
||||||
|
const QString direction = QApplication::tr("LTR",
|
||||||
|
"Translate this string to the string 'RTL' in"
|
||||||
|
" right-to-left languages (for example Hebrew and"
|
||||||
|
" Arabic) to get proper widget layout");
|
||||||
|
|
||||||
|
QGuiApplication::setLayoutDirection(
|
||||||
|
direction == "RTL" ? Qt::RightToLeft : Qt::LeftToRight);
|
||||||
|
|
||||||
for (auto pair : callbacks)
|
for (auto pair : callbacks)
|
||||||
pair.second();
|
pair.second();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1934,6 +1934,14 @@ Share it with your friends to communicate.</source>
|
||||||
<translation>إسم الملف الشخصي "%1" موجود مسبقاً . هل تود إزاته؟</translation>
|
<translation>إسم الملف الشخصي "%1" موجود مسبقاً . هل تود إزاته؟</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>QApplication</name>
|
||||||
|
<message>
|
||||||
|
<source>LTR</source>
|
||||||
|
<comment>Translate this string to the string 'RTL' in right-to-left languages (for example Hebrew and Arabic) to get proper widget layout</comment>
|
||||||
|
<translation>RTL</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>QObject</name>
|
<name>QObject</name>
|
||||||
<message>
|
<message>
|
||||||
|
|
|
@ -1929,6 +1929,14 @@ Share it with your friends to communicate.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>QApplication</name>
|
||||||
|
<message>
|
||||||
|
<source>LTR</source>
|
||||||
|
<comment>Translate this string to the string 'RTL' in right-to-left languages (for example Hebrew and Arabic) to get proper widget layout</comment>
|
||||||
|
<translation>RTL</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>QObject</name>
|
<name>QObject</name>
|
||||||
<message>
|
<message>
|
||||||
|
|
|
@ -1935,6 +1935,14 @@ Share it with your friends to communicate.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>QApplication</name>
|
||||||
|
<message>
|
||||||
|
<source>LTR</source>
|
||||||
|
<comment>Translate this string to the string 'RTL' in right-to-left languages (for example Hebrew and Arabic) to get proper widget layout</comment>
|
||||||
|
<translation>RTL</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>QObject</name>
|
<name>QObject</name>
|
||||||
<message>
|
<message>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user