Bug 376114

Summary: KDE Plasma force Qt5 applications layout direction
Product: [Frameworks and Libraries] frameworks-ki18n Reporter: ttv200
Component: generalAssignee: Chusslove Illich <caslav.ilic>
Status: RESOLVED DUPLICATE    
Severity: normal CC: kde, kdelibs-bugs
Priority: NOR    
Version: 5.32.0   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: example: zeal app - English language, RTL layout.

Description ttv200 2017-02-06 22:30:18 UTC
When I move to KDE Plasma I notice that english Qt5 applications Always on direction Right to left 
My KDE is in Hebrew - on Right to left language
this make this applications to be Uncomfortable or even impossible to use (because of ui element is one on another)
for example: zeal, Qt Designer (all qt official develop applications)
I try on another desktop, but there everything is fine, those apps are LTR.

After long investigation I understand that KDE force the Qt5 app to be on Layout direction of the system language.

You can see the function load() in /src/main.cpp in ki18n repository:

    // The way Qt translation system handles plural forms makes it necessary to
    // have a translation file which contains only plural forms for `en`. That's
    // why we load the `en` translation unconditionally, then load the
    // translation for the current locale to overload it.	
    LoadTranslation(QStringLiteral("en"));

    QLocale locale = QLocale::system();
    if (locale.name() != QStringLiteral("en")) {
        if (!loadTranslation(locale.name())) {
            loadTranslation(locale.bcp47Name());
        }
    }

the function loadTranslation loat the translation from QLibraryInfo::TranslationsPath - the default Qt translation

You can see that the translation are import based on the system language.

On program who use KDE Framework this is not influencing on the layout direction, probebly because that KDE Framework check if the app have translate and change the Layout direction in accordance.

But on plain Qt5 applications the function set the default translation file of Qt5 and this make them always be on system layout direction, because Qt5 set the direction of app by those translations (you can see here: https://github.com/qt/qtbase/blob/dev/src/gui/kernel/qguiapplication.cpp#L210 )

I try to fix it, but I don't know how
I Build the library with this function disabled, and the plain Qt apps work well but the KDE apps don't.

You just need to do:
If the app is use KDE Framework -> set the translations
else -> don't do anything

Thanks!
Comment 1 ttv200 2017-02-06 22:39:37 UTC
Created attachment 103871 [details]
example: zeal app - English language, RTL layout.
Comment 2 ttv200 2017-02-06 22:40:59 UTC
*** Bug 372851 has been marked as a duplicate of this bug. ***
Comment 3 ttv200 2017-03-22 12:05:30 UTC
On KDE 5.8 you fix a lot of RTL bugs
this is the biggest bug
Please take a look
I think is easy to fix
Comment 4 ttv200 2017-05-18 21:44:44 UTC

*** This bug has been marked as a duplicate of bug 379989 ***