Review Request 123131: Port kio_man away from kdelibs4support

Martin Koller kollix at aon.at
Sun Jan 15 16:22:22 UTC 2017



> On March 25, 2015, 9:54 p.m., Lukáš Tinkl wrote:
> > man/kio_man.cpp, line 242
> > <https://git.reviewboard.kde.org/r/123131/diff/1/?file=356605#file356605line242>
> >
> >     Not correct, this returns only user configured list of languages, whereas it previously returned the full list.
> 
> Nick Shaforostoff wrote:
>     please see https://projects.kde.org/projects/kde/kdesdk/lokalize/repository/revisions/master/entry/src/common/languagelistmodel.cpp for the ways to get a list of all languages (there is a KDE-way and Qt-way)
> 
> Alex Richardson wrote:
>     So if I parse this correctly the KDE way is: `KConfig(QLatin1String("locale/kf5_all_languages"), KConfig::NoGlobals, QStandardPaths::GenericDataLocation).groupList()`?
>     Should there be something in KI18n or is this sufficiently rare that we can just add "@deprecated use `KConfig(QLatin1String("locale/kf5_all_languages"), KConfig::NoGlobals, QStandardPaths::GenericDataLocation).groupList()` instead" to KLocale::languageList()?
> 
> David Faure wrote:
>     Sounds to me like it should be a method in ki18n, it's a bit too arcane to be maintainable.
> 
> Alex Richardson wrote:
>     Seems like it's not the right replacement:
>     
>     No special env vars set:
>     ```
>     KLocale::global()->languageList()  ("de", "en_US")
>     KLocalizedString::availableApplicationTranslations() = ("pt_BR", "nds", "kk", "ga", "mr", "km", "ko", "en_US", "ca", "gl", "is", "it", "el", "nb", "tr", "ro", "pl", "es", "et", "en_GB", "eu", "ja", "ru", "nl", "cs", "nn", "pt", "ar", "ug", "hi", "lt", "da", "lv", "uk", "zh_CN", "zh_TW", "fi", "de", "sk", "hr", "sl", "hu", "bg", "fr", "ca at valencia", "sv")
>     QLocale().uiLanguages() = ("de-DE")
>     KConfig(kf5_all_languages).groupsList() = ("ca at valencia", "ln", "de", "tw", "lo", "ty", "lt", "lv", "ug", "uk", "pt_BR", "dz", "mg", "mh", "mi", "ur", "mk", "ml", "mn", "mo", "uz", "mr", "ms", "mt", "el", "en", "crh", "eo", "my", "be at latin", "es", "et", "eu", "vi", "na", "nb", "nd", "ne", "vo", "ng", "fa", "nl", "nn", "csb", "nr", "fi", "fj", "sr at ijekavian", "nv", "wa", "fo", "ny", "fr", "oc", "fy", "wo", "ga", "sr at latin", "hne", "om", "gd", "or", "os", "gl", "uz at cyrillic", "gn", "gu", "xh", "gv", "zh_HK", "pa", "nso", "pi", "ha", "pl", "he", "hi", "mai", "ps", "pt", "ho", "hr", "hu", "yi", "hy", "hz", "yo", "ia", "id", "ie", "aa", "ik", "ab", "qu", "ae", "za", "io", "af", "nds", "is", "ven", "it", "iu", "zh", "am", "ar", "as", "ja", "sr at ijekavianlatin", "x-test", "ay", "zu", "az", "rn", "ro", "en_US", "ba", "ru", "be", "rw", "bg", "bh", "bi", "jv", "bn", "sa", "bo", "sc", "sd", "br", "se", "bs", "sg", "si", "ka", "sk", "sl", "zh_CN", "sm", "ast", "sn", "so", "sq", "ki", "sr", "bn_IN", "ca", "ss", "kk", "st", "kl", "su", "km", "sv", "kn", "ce", "sw", "ko", "ch", "ks", "rom", "ku", "kv", "kw", "ta", "co", "ky", "zh_TW", "te", "cs", "tg", "cu", "th", "cv", "ti", "hsb", "la", "lb", "tk", "cy", "tn", "to", "en_GB", "li", "tr", "da", "ts", "tt", "dsb")
>     ```
>     
>     With LANGUAGE="de_DE"
>     
>     ```
>     KLocale::global()->languageList()  ("de", "en_US")
>     KLocalizedString::availableApplicationTranslations() = ("sv", "pt_BR", "ca at valencia", "kk", "ga", "mr", "km", "ko", "en_US", "nds", "ca", "gl", "is", "it", "el", "nb", "tr", "ro", "en_GB", "pl", "es", "et", "eu", "ja", "ru", "nl", "cs", "nn", "pt", "ar", "ug", "hi", "lt", "da", "zh_CN", "zh_TW", "lv", "uk", "fi", "de", "sk", "hr", "sl", "hu", "bg", "fr")
>     QLocale().uiLanguages() = ("de-DE")
>     KConfig(kf5_all_languages).groupsList() = (...)
>     ```
>     
>     With LANGUAGE="en_GB:de_DE"
>     ```
>     KLocale::global()->languageList()  ("en_GB", "de", "en_US")
>     KLocalizedString::availableApplicationTranslations() = ("ga", "nds", "kk", "mr", "km", "ko", "ca", "gl", "pt_BR", "is", "it", "el", "nb", "tr", "ro", "en_US", "pl", "es", "et", "eu", "ja", "ru", "nl", "cs", "nn", "pt", "ar", "en_GB", "ug", "hi", "lt", "da", "lv", "uk", "fi", "de", "sk", "hr", "sl", "hu", "bg", "fr", "ca at valencia", "zh_CN", "zh_TW", "sv")
>     QLocale().uiLanguages() = ("en-GB", "de-DE")
>     ```
>     
>     With LANGUAGE="de_DE:en_GB"
>     ```
>     KLocale::global()->languageList()  ("en_GB", "de", "en_US")
>     KLocalizedString::availableApplicationTranslations() = ("mr", "km", "ko", "nds", "en_GB", "ca", "gl", "is", "it", "el", "nb", "tr", "ro", "pl", "es", "et", "eu", "ja", "ru", "nl", "cs", "nn", "zh_CN", "zh_TW", "pt", "ar", "ca at valencia", "ug", "hi", "lt", "da", "lv", "uk", "fi", "de", "sk", "hr", "sl", "hu", "bg", "pt_BR", "fr", "sv", "en_US", "ga", "kk")
>     QLocale().uiLanguages() = ("de-DE", "en-GB")
>     KConfig(kf5_all_languages).groupsList() = (...)
>     ```
>     This one is very confusing, why is en_GB still the highest priority according to KLocale::global()->languageList()? Maybe it is reading some config file where I set that?
>     
>     With LANGUAGE="fr_FR"
>     
>     ```
>     KLocale::global()->languageList()  ("de", "en_US")
>     KLocalizedString::availableApplicationTranslations() = ("et", "eu", "ja", "ru", "nl", "cs", "nn", "pt", "en_GB", "ar", "ca at valencia", "ug", "hi", "lt", "da", "lv", "uk", "fi", "de", "sk", "hr", "sl", "zh_CN", "zh_TW", "hu", "bg", "fr", "sv", "nds", "ga", "kk", "mr", "km", "ko", "pt_BR", "ca", "gl", "en_US", "is", "it", "el", "nb", "tr", "ro", "pl", "es")
>     QLocale().uiLanguages() = ("fr-FR")
>     ```
>     
>     Even more confusion, LANGUAGE now has no effect on KLocale::global()->languageList()
>     
>     With LANG=fr_FR
>     ```
>     KLocale::global()->languageList()  ("fr", "en_US")
>     KLocalizedString::availableApplicationTranslations() = ("sk", "hr", "sl", "hu", "bg", "pt_BR", "fr", "sv", "en_US", "kk", "ga", "km", "mr", "ko", "en_GB", "ca", "gl", "is", "it", "el", "nb", "tr", "ro", "pl", "es", "et", "eu", "ja", "ru", "nl", "cs", "nn", "zh_CN", "zh_TW", "pt", "ar", "ca at valencia", "nds", "ug", "hi", "lt", "da", "lv", "uk", "fi", "de")
>     QLocale().uiLanguages() = ("fr-FR")
>     ```
>     
>     LANG seems to work where LANGUAGE doesn't.
>     
>     
>     I have no idea what's going on here, I need some feedback from someone with more I18N experience.
>     
>     However, QLocale().uiLanguages() seems to be almost the right replacement if we append en_US and convert it from de-DE to de_DE. However, the order is not the same...
> 
> Albert Astals Cid wrote:
>     Given kf5_all_languages is part of kdelibs4support, making code in ki18n breaks tiering, so a -1 from my side to David's comment.
> 
> David Faure wrote:
>     Ah, then another implementation is needed. Proving even more that ki18n should provide a way to list available translations, since it's definitely not a trivial issue.
> 
> Albert Astals Cid wrote:
>     ki18n already has such method (availableApplicationTranslations), i'm not sure that is what we want here though.
>     
>     Can someone clarify what we exactly want in here? all languages? all languages this ki18n-using application is translated too?

What we want here in kio_man is to display the man page a user can read, which includes his preferred language(s) and the untranslated original man page, since this is the true reference.

Therefore the code loops over the user selected languages and does not use all system installed translation dirs.

I'd say QLocale().uiLanguages() is the way to go, including the "-" -> "_" replacement


- Martin


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/123131/#review78048
-----------------------------------------------------------


On March 25, 2015, 9:17 p.m., Alex Richardson wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/123131/
> -----------------------------------------------------------
> 
> (Updated March 25, 2015, 9:17 p.m.)
> 
> 
> Review request for KDE Frameworks, Plasma and Martin Koller.
> 
> 
> Repository: kio-extras
> 
> 
> Description
> -------
> 
> Port kio_man away from kdelibs4support
> 
> 
> Diffs
> -----
> 
>   CMakeLists.txt 02ae89f2524324f758450ad368f64849e39b2f7d 
>   man/CMakeLists.txt cb4585a289d3f69b8a16429ce87bfce115d1cc27 
>   man/kio_man.cpp e8cf2d70c50c4c20adbb5a81a6213175d397b76e 
>   man/kmanpart.cpp 3af7fc182806e8b89297e8de884ce611c827e881 
>   man/man2html.cpp 3c493ba334bce890b450d7b11ab00c6e783708d4 
> 
> Diff: https://git.reviewboard.kde.org/r/123131/diff/
> 
> 
> Testing
> -------
> 
> man view in kdevelop5 works
> 
> Not sure about the `KLocale::global()->languageList();` -> `QLocale().uiLanguages();` change though so I would like some feedback.
> 
> 
> Thanks,
> 
> Alex Richardson
> 
>

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


More information about the Kde-frameworks-devel mailing list