[Lazarus] TFloatSpinEdit and DecimalSeparator (GTK)

Bart bartjunk64 at gmail.com
Wed Mar 18 12:46:09 CET 2009


(On the subject of dependency on libc for locale formatsettings)
>  Unless of course Graeme Geldenhuys works through his meanwhile astronomic TODO
>  list and implements the Locale checking himself in 100% Object Pascal :-)

Poor Graeme.
Done some digging into this aspect.
I'm not even sure this is at all possible without depending (directly
or indirectly) on libc.

In theory one could determine which LC_xxx file we should use, and
then parse the file.
However, the LC_xxx file structure is not the same in all libc
versions (I know that at least libc 2.2 changed it), so that may be a
problem (we would have to check libc versiion without linking libc?
and respond to all changes in LX_xxx with new libc versions).

One could also execute locale with the right options (locale -ck
LC_foo), pipe the output and process it to retrieve the values of
decimalseparator etc, but that seems like cheating to me (we don't
want to link libc but we execute locale which uses libc).

Back to the original subject.
Including clocale in the test program now makes sure
SysUtil.DecimlaSeparator and SysUtil.ThousandSeparator have correct
values: DS = , (comma), TS = #0 (not set).
However the TFloatSpinEdit control seems to use a hardcoded value for
the DecimalSeparator it displays.
On GTK2 it is a period (.), on GTK1 it is a comma (,),

I'll file a bugreport on the subject.

Bart



More information about the Lazarus mailing list