Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the language selector to select an RTL language on mac does not cause the ui to be reversed #8806

Closed
TheOneRing opened this issue Jul 6, 2021 · 9 comments · Fixed by #8981
Assignees
Milestone

Comments

@TheOneRing
Copy link
Member

image

@TheOneRing
Copy link
Member Author

Maybe because we call the translations code AFTER we initialized QApplication?

@fmoc
Copy link
Contributor

fmoc commented Jul 8, 2021

I think we just need to call setLayoutDirection in setupTranslations, once we can tell whether we have an RTL language or not. https://doc.qt.io/qt-5/qguiapplication.html#layoutDirection-prop

@fmoc
Copy link
Contributor

fmoc commented Jul 9, 2021

I cannot reproduce this issue. You didn't reveal which locale you were testing against. I selected a random right-to-left-looking language, and without a code change the layout was changed:

grafik

I can also control the layout direction using setLayoutDirection. We could add the following snippet to setupTranslations nevertheless, if you want to:

            // use a right-to-left layout for such languages
            QApplication::setLayoutDirection(QLocale(lang).textDirection());

@TheOneRing
Copy link
Member Author

I don't think we should call it directly this should be handled by the translations system.
The issue seems to only occur on mac.
I could imagin it being caused by us setting up the translations in the QApplication constructor....
@erikjv

@erikjv
Copy link
Collaborator

erikjv commented Jul 13, 2021

Hmm, Qt has this in QGuiApplicationPrivate::init():

    if (layout_direction == Qt::LayoutDirectionAuto || force_reverse)
        QGuiApplication::setLayoutDirection(qt_detectRTLLanguage() ? Qt::RightToLeft : Qt::LeftToRight);

That in turn is called from the QApplication constructor.

That said, I assume you're not running with the -reverse cmdline option, right? And your translations have the following translated:

        (QGuiApplication::tr("QT_LAYOUT_DIRECTION",
                         "Translate this string to the string 'LTR' in left-to-right"
                         " languages or to 'RTL' in right-to-left languages (such as Hebrew"
                         " and Arabic) to get proper widget layout.") == QLatin1String("RTL"));

Correct?

@TheOneRing
Copy link
Member Author

Hmm, Qt has this in QGuiApplicationPrivate::init():

    if (layout_direction == Qt::LayoutDirectionAuto || force_reverse)
        QGuiApplication::setLayoutDirection(qt_detectRTLLanguage() ? Qt::RightToLeft : Qt::LeftToRight);

That in turn is called from the QApplication constructor.

That said, I assume you're not running with the -reverse cmdline option, right? And your translations have the following translated:

of course

        (QGuiApplication::tr("QT_LAYOUT_DIRECTION",
                         "Translate this string to the string 'LTR' in left-to-right"
                         " languages or to 'RTL' in right-to-left languages (such as Hebrew"
                         " and Arabic) to get proper widget layout.") == QLatin1String("RTL"));

Correct?

the translation is properly rtl displayed on windows and linux.
but we do argument parsing and translation setup in the constructor of QApplictation....

@github-actions
Copy link

This issue was marked stale because it has been open for 30 days with no activity. Remove the stale label or comment or this will be closed in 7 days.

@gabi18
Copy link
Contributor

gabi18 commented Sep 30, 2021

confirmed fixed with testpilotcloud 2.9.1rc1

CleanShot 2021-09-30 at 14 15 23@2x

CleanShot 2021-09-30 at 14 15 54@2x

@gabi18
Copy link
Contributor

gabi18 commented Sep 30, 2021

Remaining issue with systray and dot menu?

CleanShot 2021-09-30 at 14 14 01@2x

CleanShot 2021-09-30 at 14 16 44@2x

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

Successfully merging a pull request may close this issue.

4 participants