Skip to content
This repository has been archived by the owner on May 10, 2018. It is now read-only.

[Qt5] Application Layout still LTR even if it's language is RTL #1557

Closed
SafaAlfulaij opened this issue Dec 17, 2014 · 13 comments
Closed

[Qt5] Application Layout still LTR even if it's language is RTL #1557

SafaAlfulaij opened this issue Dec 17, 2014 · 13 comments

Comments

@SafaAlfulaij
Copy link
Contributor

qupzillaqt5rtl

As in the screenshot, The UI doesn't reverse. I tried the -reverse option and it worked great.

@srazi
Copy link
Member

srazi commented Dec 17, 2014

You should place qt_ar.qm in /usr/share/qupzilla/locale (maybe different on your distribution)

@SafaAlfulaij
Copy link
Contributor Author

I think that this thing should be done automatically.
You may use:
app.setLayoutDirection(QLocale('localeCode').textDirection());

I don't see qt_ar.qm anywhere in the QupZilla package filelist...

@srazi
Copy link
Member

srazi commented Dec 17, 2014

We don't need to do this, because layout direction is set by Qt after loading qt_*.qm.

I don't see qt_ar.qm anywhere in the QupZilla package filelist...

It's not part of QupZilla source code, but it's there in Windows installer, I'm not sure about Linux packages. Also always you can find it in Qt SDK or by googling.

@SafaAlfulaij
Copy link
Contributor Author

I've copied it and nothing changed.
I suggest a game developers to use that line and it worked for them.
Are you sure that Qt do that automatically?

@srazi
Copy link
Member

srazi commented Dec 17, 2014

I've copied it and nothing changed.

Are you sure it was loaded successfully? For example does Insert Unicode Character within context-menu of location bar is translated to Arabic?
Note: The Qt version ofqt_ar.qm and QupZilla (Help->About Qt) should be the same.

Are you sure that Qt do that automatically?

Yes

@SafaAlfulaij
Copy link
Contributor Author

Are you sure it was loaded successfully? For example does Insert Unicode Character within context-menu of location bar is translated to Arabic?

This menu item is not available for Linux yet, It's a Qt5 problem.

Qt uses libxcb to communicate with X and thus the xcb platform plugin is responsible for part of the abstractions. one of those is indicating whether RTL extensions should be used.
you're already using the xcb platform plugin. you just cannot enable the useRtlExtensionsyada flag on anything but Windows currently

I tried the Qt4 version and it got flipped. Maybe it's a problem with Qt5?

@srazi
Copy link
Member

srazi commented Dec 18, 2014

Oh... you are right it's a Qt5 issue.

  • I tested it with Qt-5.3, I don't know if it has been fixed on Qt-5.4 or not.

BTW, the following workaround works correctly:

diff --git a/src/main/main.cpp b/src/main/main.cpp
index 070d42e..9939dbf 100644
--- a/src/main/main.cpp
+++ b/src/main/main.cpp
@@ -187,6 +187,7 @@ int main(int argc, char* argv[])
     if (app.isClosing())
         return 0;

+    app.setLayoutDirection(QApplication::tr("QT_LAYOUT_DIRECTION") == QLatin1String("RTL") ? Qt::RightToLeft : Qt::LeftToRight);
     app.setProxyStyle(new ProxyStyle);

     return app.exec();

@srazi srazi added the Qt label Dec 18, 2014
@srazi srazi changed the title Application Layout still LTR even if it's language is RTL [Qt5] Application Layout still LTR even if it's language is RTL Dec 18, 2014
@pejakm
Copy link
Member

pejakm commented Dec 18, 2014

@srazi Here's the screenshot:

https://a.pomf.se/lgbcsc.png

Qt-5.4. Without the patch Qz looks like the OP's screenshot.

@srazi
Copy link
Member

srazi commented Dec 18, 2014

@pejakm Thanks for the test.
I opened an upstream bug report: https://bugreports.qt-project.org/browse/QTBUG-43447

@SafaAlfulaij
Copy link
Contributor Author

UPDATE:
They moved the string to QCoreApplication.

BTW, Why don't you set the "document-start" and "document-end" translatable?

Also, Why don't QupZilla loads this file? ftp://ftp.qt-project.org/qt/l10n/index.html
It says that I have to download/open it

@srazi
Copy link
Member

srazi commented Dec 18, 2014

BTW, Why don't you set the "document-start" and "document-end" translatable?

If you mean document-start and document-end in GreasMonkey plugin then they are not translatable they are supported values of @run-at.

Also, Why don't QupZilla loads this file? ftp://ftp.qt-project.org/qt/l10n/index.html

Please open another issue for this one.

@SafaAlfulaij
Copy link
Contributor Author

If you mean document-start and document-end in GreasMonkey plugin then they are not translatable they are supported values of @run-at.

I mean in the settings dialog, Here:

ui->startAt->setText(m_script->startAt() == GM_Script::DocumentStart ? "document-start" : "document-end");

The values are got from an another cpp file.

@srazi
Copy link
Member

srazi commented Dec 19, 2014

That file is part of GreasMonkey plugin, and as I said those are values and not translatable strings.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants