Problem in loading QM translations with LANGUAGE="" envar

Safa Alfulaij safa1996alfulaij at gmail.com
Wed Jan 10 05:30:54 UTC 2018


More investigation shows that it does not work with other locales than the
default one (the one that is used in case you don't pass a country code,
which, in case of Arabic, is ar_EG).

[safa at archlinux]$ LANG=ar_BH.utf8
> [safa at archlinux]$ python testQtLocale.py
> b'\xd9\xa2\xd9\xa0 B'
> [safa at archlinux]$ LANG=ar_EG.utf8
> [safa at archlinux]$ python testQtLocale.py
> b'\xd9\xa2\xd9\xa0 \xd8\xa8\xd8\xa7\xd9\x8a\xd8\xaa'
> [safa at archlinux]$ LANG=ar_SA.utf8
> [safa at archlinux]$ python testQtLocale.py
> b'\xd9\xa2\xd9\xa0 B'
> [safa at archlinux]$ LANG=ar_TN.utf8
> [safa at archlinux]$ python testQtLocale.py
> b'20 B'


Notice the translated version of "B" in ar_EG. The locale is set correctly
as we can see ar_TN uses the correct English/Arabic (not Hindi) numbering
system.
So it seems that the files are registered for that ar_EG locale only, which
is causing the trouble.

Note: Qt prioritizes LANGUAGE which has no country code, and that was the
problem. I'll be sending a small patch to use LANG if the first choice in
LANGUAGE is the same as LANG's main language.

Regards

2018-01-10 5:49 GMT+03:00 Safa Alfulaij <safa1996alfulaij at gmail.com>:

> Well, I don't want to remove it but it's a must. First it's not right
> logically and second is that Qt prefers it over LANG, and use any locale
> varient since it has no country name. (QLocale("ar") returns "Arabic
> (Egypt)" (which is defind in unicode), instead of my "Arabic (Bahrain)"
> locale.
> And it's the only thing that is not getting translated which is obviously
> a bug.
>
> Regards
>
> On Jan 10, 2018 12:20 AM, "Albert Astals Cid" <aacid at kde.org> wrote:
>
>> El dimarts, 9 de gener de 2018, a les 20:08:02 CET, Safa Alfulaij va
>> escriure:
>> > Hello all.
>> >
>> > After doing some investigation about a problem, I came into an issue in
>> > loading correct translations in Frameworks (that has the “_qt” suffix in
>> > translation system).
>> > Previously, I had my LANGUAGE enviroment variable containing “ar”,
>> which is
>> > because I added Arabic in my “Language” KCM (without knowing that I
>> don't
>> > need it if the locale is alread set to Arabic).
>> > This was normal and things was translated well. Today I removed that
>> “ar”
>> > because it's not needed, and all applications (Qt, KDE, Gnome, other
>> KF5s)
>> > worked except for those frameworks which are using QM files (the ones
>> with
>> > “_qt” suffix). The translation isn't loaded and strings are shown in
>> > English.
>>
>> So don't remove it?
>>
>> Cheers,
>>   Albert
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180110/1d9c9ec5/attachment.html>


More information about the Kde-frameworks-devel mailing list