1
0
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:
sudden6 2016-08-01 21:30:46 +02:00
commit 79b9895874
No known key found for this signature in database
GPG Key ID: 279509B499E032B9
4 changed files with 36 additions and 1 deletions

View File

@ -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
View File

@ -1934,6 +1934,14 @@ Share it with your friends to communicate.</source>
<translation>إسم الملف الشخصي &quot;%1&quot; موجود مسبقاً . هل تود إزاته؟</translation>
</message>
</context>
<context>
<name>QApplication</name>
<message>
<source>LTR</source>
<comment>Translate this string to the string &apos;RTL&apos; 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
View File

@ -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 &apos;RTL&apos; 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
View File

@ -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 &apos;RTL&apos; 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>