Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Supporting Right to Left Languages
I have a question around the support of right to left languages.
In my application, we are going to start the support for right to left languages.
I know that, for right to left languages, we need to do layout mirroring.
At this point of time, we are not thinking about layout mirroring. The reason is that, in our application, we have the huge block of legacy code, UI screens, which are implemented in a custom way, without using Qt.
So, to extend the support for right to left languages, we are thinking to do in a simple way. That is just translate the texts that are being displayed.
Assume that the text displayed is
And the translation for the above text in Arabic is
Label displayed in UI: @Save@
After the changing the language to Arabic: @حفظ@
I am thinking that text alignment is not playing a big role here. Just applying the translation should do the job.
Is my understanding correct? Please help me out.
Thanks a ton,
IIRC you don't need to do anything special for your layout, Qt already supports right to left UI.
You can use QApplication::setLayoutDirection if you want to force left to right or right to left layouts.
Hope it helps
Thanks for your response Samuel :)
It helps me to some extent. But still there is a problem.
As I said in the post, the some part of application is developed in custom way, meaning Ui is not developed using Qt.
So, if we do QApplication::setLayoutDirection(,,,), its going to change the layout of the screens which are developed using Qt. And not for the screen which are developed not using Qt.
So, we thought not to change the layout direction. Instead we want to just translate the text.
Am also clear on how to use the Qt translation. But, am bit confused on the part of text alignment. Do we need to do anything special for text alignment if am not going to use setLayoutDirection?
Please let me know if am not clear in any place.
AFAIK, no you don't need to do anything special for the textual part.
But you really should consider supporting the layout direction. It will probably look surprising to your user to have a right to left text in a left to right layout.
Thank you for the response Samuel!