El diumenge, 8 de gener de 2023, a les 9:57:18 (CET), hanyoung va escriure: > Hello everyone, > > I'd like to rename `pt` directory in our svn to `pt_PT` to fix the bug that > most applications treat `pt` as `pt_BR`. My understanding is that > `l10n-kf5/$LANGUAGE/messages/plasma-workspace/plasmashell.po` will be sync > to `plasma-workspace/po/$LANGUAGE/plasmashell.po`. In turn, when we call > `KLocalizedString::availableDomainTranslations("plasmashell").values()` in > systemsetting to get the list of available languages, it essentially > iterates over the translation directories and return the list of directory > names that have plasmashell.po in them. And that's why we're getting ["pt", > "pt_BR"]. Sadly, most applications (include KDE itself) treat `pt` as > `pt_BR`.
"most applications" is not correct, as far as i understand the only thing that says pt -> pt_BR is QLocale (and CLDR but as far as i know there's not much plain CLDR usage out there). The rest of the glibc world treats pt as that, just pt with no country specialization. > So effectively, user can't set their system language to `pt_PT` in > systemsettings. That's a bug in systemsettings, we've had code tha takes into account "pt in glibc locale world needs to be pt_PT in QLocale world" since I fixed in 2015, but I guess someone removed it at some point. > As a temporary measure, we can explicitly set 'pt' to 'pt_PT' in > systemsettings code. As I did in this MR: > https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2478 That seems reasonable (except for the hand rolled search algorithm) (haven't tested either) I don't see why you consider that a temporary measure, it's the correct fix that manages correctly the fact that glibc and qlocale disagree. > However, I wish in the long term we can rename the 'pt' in > https://websvn.kde.org/trunk/l10n-kf5/pt/ to 'pt_PT'. This should fix the > root issue. I think that would be bad idea since it would make people using the pt_MO locale not getting any translation. Cheers, Albert > > Relevant bug report, forum discussion and MR: > https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2478 > https://discuss.kde.org/t/rename-pt-in-i10n-svn-to-pt-pt/118 > https://bugs.kde.org/show_bug.cgi?id=454991 > > Note: please reply on either MR, forum post or bug report. Forum post is > preferred since I linked it to the MR and bug report (and also in source > code comment) > > Regards, > Han