Fine-grained control over wxLocale

Chris Borgolte wx at delta-h.de
Thu Apr 10 00:12:54 PDT 2008


Chris Borgolte wrote:
> Vadim Zeitlin wrote:
>   
>> On Wed, 9 Apr 2008 02:45:09 -0700 (PDT) Andreas <support at raumgeometrie.de> wrote:
>>
>> A> So after I use wxLocale::Init I now call
>> A> 
>> A> setlocale( LC_NUMERIC, "C" );
>> A> 
>> A> to set just the numerical stuff to C.
>> A> 
>> A> This works. Are there any problems with this approach?
>>
>>  Yes -- the numbers won't be shown to the users using the correct decimal
>> separator. The UI should really use the users locale, you should use the
>> "C" one for internal manipulations only. As I wrote, the simplest way to do
>> it is to use C++ standard streams which have their own (by default "C")
>> locale, setlocale() is not the right tool here as it changes the locale
>> globally.
>>
>>  Regards,
>> VZ
>>
>>   
>>     
> There exists one problem:
> When porting legacy applications (which were implemented in C or
> C-style) no one wants to change the existing routines for reading files
> *and* the file format which is using point as the decimal separator. And
> old users are used to write point as decimal separator, not comma.
> Its a while ago that i had to deal with these input problems, but i
> remember me placing a setlocale() call to every such module, cause wxGTK
> changed the locale back to system locale from time to time.
>
> One sort of workaround i use for my dialogs is to have a special
> floating point input check (dont know how to give it a good name) for
> TextControlls that changes , to . .
>
> _______________________________________________
> wx-users mailing list
> wx-users at lists.wxwidgets.org
> http://lists.wxwidgets.org/mailman/listinfo/wx-users
>   

Here is a link to the faq which deals with this problem:
http://www.wxwidgets.org/docs/faqgtk.htm


More information about the wx-users mailing list