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
|
||||
QTranslator *qtTranslator = new QTranslator();
|
||||
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);
|
||||
qDebug() << "System translation loaded" << locale;
|
||||
|
@ -75,6 +76,16 @@ void Translator::translate()
|
|||
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)
|
||||
pair.second();
|
||||
}
|
||||
|
|
8
translations/ar.ts
vendored
8
translations/ar.ts
vendored
|
@ -1934,6 +1934,14 @@ Share it with your friends to communicate.</source>
|
|||
<translation>إسم الملف الشخصي "%1" موجود مسبقاً . هل تود إزاته؟</translation>
|
||||
</message>
|
||||
</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>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
|
|
8
translations/he.ts
vendored
8
translations/he.ts
vendored
|
@ -1929,6 +1929,14 @@ Share it with your friends to communicate.</source>
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</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>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
|
|
8
translations/ug.ts
vendored
8
translations/ug.ts
vendored
|
@ -1935,6 +1935,14 @@ Share it with your friends to communicate.</source>
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</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>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
|
|
Loading…
Reference in New Issue
Block a user