Review Request 112292: Make KLocalizedString::isApplicationTranslatedInto and QLocale::uiLanguages compatible

Vishesh Handa me at vhanda.in
Tue Aug 27 13:08:49 UTC 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/112292/
-----------------------------------------------------------

(Updated Aug. 27, 2013, 1:08 p.m.)


Review request for KDE Frameworks, Albert Astals Cid, Aleix Pol Gonzalez, and Chusslove Illich.


Changes
-------

Updated comments to better reflect the problem.

Originally, QLocale::uiLanguages() used to return $LANGUAGE, it was then changed to return it the bcp47 format [1]. This format is obviously not consistent with the QLocale::name() format, but this seems to intentional. There is a QLocale::bcp47Name() for people wishing to use uiLangauges. Therefore the code posted above should be -

QLocale locale;
locale.uiLanguages().contains(locale.bcp47Name()); // returns true

--

Since we operate on the setlocale format, the code is now just a rough translator between bcp47 and the setlocale format. It doesn't cover the bcp47 grammar[2] completely, but it does cover the grammar QLocale generates.

[1] https://codereview.qt-project.org/#change,25016
[2] http://tools.ietf.org/html/bcp47#section-2.1


Description
-------

    Make KLocalizedString::isApplicationTranslatedInto & QLocale::uiLanguages compatible
    
    QLocale::uiLanguages returns "lang-script-country" whereas KCatalog
    expects the format to be "lang_countr at script". We need to convert the
    format before checking if the corresponding catalog exists.


Diffs (updated)
-----

  staging/ki18n/src/klocalizedstring.cpp eab9216 

Diff: http://git.reviewboard.kde.org/r/112292/diff/


Testing
-------

Limited testing done. My QLocale::uiLanguages() returns "en-US" which is correctly converted to "en_US". I haven't tested it with anything else. Any tips on how I should go about testing this?


Thanks,

Vishesh Handa

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20130827/f1f07892/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list