Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Supporting Right to Left Languages

    General and Desktop
    2
    5
    1226
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      kumararajas last edited by

      Hello!
      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.

      Example:
      Assume that the text displayed is
      @HELLO@

      And the translation for the above text in Arabic is
      @مرحبا@

      Another example
      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,
      Kumar

      --Kumar

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        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

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • K
          kumararajas last edited by

          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.

          Thanks,
          Kumar

          --Kumar

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            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.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply Reply Quote 0
            • K
              kumararajas last edited by

              Thank you for the response Samuel!

              --Kumar

              1 Reply Last reply Reply Quote 0
              • First post
                Last post