Review Request 118584: Formats KCM: Use QLocale::name() instead of bcp47Name() when writing to the configuration file

John Layt jlayt at kde.org
Fri Jun 6 16:30:19 UTC 2014



> On June 6, 2014, 11:53 a.m., Sebastian Kügler wrote:
> > I'd like to hear John's take on this. IIRC, bcp47Name() is the correct one to use here. (Which leaves questions indeed.)
> 
> Luca Beltrame wrote:
>     Indeed. But for some reason, at least on my system, bcp47Name() returns "it" only, and that breaks everything. Hence the reason for this patch.
>     Also I wanted indeed to wait till the "pros" gave their answers. ;)
> 
> John Layt wrote:
>     Please don't make me read the BCP47 standard again: it's long and complicated and ambiguous and I read it three times and still didn't understand it :-) What I do remember with BCP47 is that the standard states it should always return the minimal code required to identify a locale.  For example, if your locale fully expressed is "it_IT at Latn" then bcp47name() returns just "it" as Italy and Latin are the default country and script values for Italian and so are unneeded.  This compares to name() which will always return the form language_COUNTRY regardless of the locale (unless country is explicitly set to AnyCountry) but will always leave off the script for backwards compatibility reasons.  I need to go back to the POSIX standard to check, but I think it expects to have the country explicitly included, but the script only if not the default (or not Latn?).  If so Qt needs a posixName() which we'd need to simulate for now.  I also need to look into the .UTF-8 stuff as well.

OK, checked POSIX and it always expects the country to be included, so name() is closer to what we want than bcp47Name(). We also need to add the .encoding and @script when not the default, but I'm still working on the rules for that.  My opinion is ship it, as it improves the situation and fixes many issues, but isn't the full solution so add a TODO note in the code.


- John


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


On June 6, 2014, 7:45 a.m., Luca Beltrame wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/118584/
> -----------------------------------------------------------
> 
> (Updated June 6, 2014, 7:45 a.m.)
> 
> 
> Review request for Plasma, John Layt and Sebastian Kügler.
> 
> 
> Repository: plasma-desktop
> 
> 
> Description
> -------
> 
> Currently the Formats KCM writes its configuration file using the selected locale's bcp47Name(). This, at least on my distro, breaks locale loading as locales are in the form "foo_FOO" (e.g., "it_IT" for my own locale) and instead the Formats KCM exports LANG as "foo" (e.g. "it").
> 
> This causes a bunch of runtime warnings and locales don't get actually loaded. This patch's approach is naive and likely needs more pairs of eyes on it, as I can't test with other distros.
> 
> Also we might need "UTF-8" suffix for distros that use UTF-8 locales: or so I think, but I'm not knowledgeable enough to tell if this is needed or not.
> 
> 
> Diffs
> -----
> 
>   kcms/formats/kcmformats.cpp 4169244 
> 
> Diff: https://git.reviewboard.kde.org/r/118584/diff/
> 
> 
> Testing
> -------
> 
> Compiled, ran the Formats KCM, selected my country, inspected the generated files.
> 
> 
> Thanks,
> 
> Luca Beltrame
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20140606/a49956df/attachment.html>


More information about the Plasma-devel mailing list