[QGIS-Developer] QGIS and QLocale handling not used?

Richard Duivenvoorde rdmailings at duif.net
Mon Oct 2 01:07:41 PDT 2017


Yes, it always becomes messy with those different systems. Google for
'excel'-questions about number format :-)

For what I think now (after some quick research)

- internally all programming languages use point anyway
- locale is only for formatting (number and date-time strings) purposes
that you need the locale setting
Eg depending on your locale in Python, a number like 1.23e3 using
locale.atof() will be outputted as 1,230 in eu-locales and 1.230 in us ones.
- in The Netherlands most government officials have Dutch Windows
workstations: QGIS (and Office etc) will start up in dutch locale. So I
think(!) most people are then used to a comma as separator. But I also
see people struggle with the numberformat when they are sharing data in
spreadsheets etc etc.

My feeling now is that QGIS not really set the locale for Qt, but only
uses the 'language' setting to determine the gui-translations-strings.

IF people really want a localized QGIS, then QGIS should show(!!!) for
example numbers in the attribute table as localized strings (1,0 instead
of 1.0)
I'm not 100% sure others want that, myself I do NOT want comma's...
Not sure what we would have to use in expressions then though.... how
does Excel/Calc handle such things?

I need to do some more testing on different machines with different
locale, but my take now would be:
- Take system locale to know what gui language to use
- Make (2?) options for the locale:
1) a setting to tell load QGIS to be used in a certain language (what it
is now actually)
2) a true locale setting which loads the QtApplication (AND the Python
interpreter) in that locale (defaulting to system). This would make that
QGIS shows DateTime's and numbers in the chosen locale

I also wonder how other non western encodings and right-to-left writing
languages (Farsi eg) normally do these things.... Are they all
'westernized' in their computing? Or do they actually wish that things
were different?

Others?

Regards,

Richard Duivenvoorde


On 02-10-17 07:47, Andreas Neumann wrote:
> Hi,
> 
> It is really a mess. F.e. in Switzerland some cantons use the comma,
> some the decimal point (officially). On the federal level they use the
> comma - I guess this is what Switzerlands official positions is: use the
> comma as decimal separator. BUT: in practice most people I know use the
> point as a decimal separator. See
> also https://en.wikipedia.org/wiki/Decimal_mark
> 
> What a mess. Probably we are the only country listed in both sections:
> comma and the point (depending on the province). I don't know who had
> this brilliant idea that some provinces would use the one and some the
> other.
> 
> If someone works on locale changes, I would propose that there would be
> a separate setting where people can choose if they want the point or the
> comma as a decimal separator.
> 
> Thanks and greetings,
> 
> Andreas
> 
> 
> On 2017-10-02 01:21, Nyall Dawson wrote:
> 
>> On 30 September 2017 at 21:22, Richard Duivenvoorde
>> <rdmailings at duif.net <mailto:rdmailings at duif.net>> wrote:
>>> On 30-09-17 10:18, Richard Duivenvoorde wrote:
>>>
>>>> Given QGIS is used in so many different languages/locales, I think QGIS3
>>>> is the right time to handle this in a proper way?
>>>>
>>>> Or is my testing just plain wrong :-)
>>>
>>> Ok, see comments at the issue [0], I think there is nothing wrong with
>>> the separator handling of the delimitedtextprovider.
>>> It would be cool though if the dialog would check the 'Decimal separator
>>> is comma' when the locale is european (and maybe show the locale
>>> there...)
>>>
>>> And my test was plain wrong: 1,0 will NEVER be a valid float in Python.
>>> '1,0' is, if you have the right locale, see [1]
>>> Note that this is about plain Python. In our case there is Qt in
>>> between...
>>>
>>> I think though that changing the locale and then asking for the locale
>>> in QGIS should show the locale used.
>>>
>>> I hope somebody can tell something about this?
>>
>> I tried to clear up some of these issues during the Nodebo hackfest, but:
>>
>> 1. coming from a locale which uses the NORMAL "." as decimal
>> separator, I have no idea what the expected/proper behavior should be
>> for locales which use ","
>>
>> 2. no-one I asked from these locales could even give me a definitive
>> answer about what the correct behavior is
>>
>> So I quickly decided to let someone else handle this mess ;)
>>
>> Nyall
>> _______________________________________________
>> QGIS-Developer mailing list
>> QGIS-Developer at lists.osgeo.org <mailto:QGIS-Developer at lists.osgeo.org>
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> 
> 
> 
> 
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> 



More information about the QGIS-Developer mailing list