std.locale

Don nospam at nospam.com
Mon Mar 2 00:29:01 PST 2009


Georg Wrede wrote:
> Walter Bright wrote:
>> Andrei Alexandrescu wrote:
>>> There will be a global reference to a Locale class, e.g. 
>>> defaultLocale. By default the reference will be null, implying the C 
>>> locale should be in effect. Applications can assign to it as they 
>>> find fit, and also pass around multiple locale variables.
>>
>> I disagree with being able to assign to the global defaultLocale. This 
>> is going to cause endless problems. Just one is that any function that 
>> uses locale can no longer be pure. defaultLocale should be immutable.
> 
> The two programs that are most "locale aware" are usually spread sheets 
> and word processors.

And Microsoft products do "locale awareness" so badly, I'm pretty sure 
there's no simple solution. (<gripe> They could at least recognize that 
outside the US, everyone uses A4-size paper, not that bizarro 
letter/legal stuff </gripe>).

> It is usual that the user needs to write, say, in Swedish or in Russian, 
> while in a Finnish setting. Or that one wants to use a decimal separator 
> other than what is "proper" for the country.
> 
> For example, a lot of people use "." instead of the official "," in 
> Finland, and many use time as "18:23" instead of "18.23".

This is my experience as well. There's an awful lot of expats in the world.

> For this purpose, these programs let the users define these any way they 
> want.
> 
> I think the notion of locales is, slowly but steadily, going away.
> 
> It was a nice idea at the time, but with two problems: users don't use 
> it, and programmers don't use it.

I think the whole idea is based on a fallacy: that there IS a locale.
The idea that you can choose which currency symbol to use, based on 
where the computer is, is utterly absurd. Surely these days, nearly 
everyone has to deal with the Euro, the US dollar, the Pound, and the 
Yen, as well as their local currency.

The world is international now, not local.

I nearly always end up setting the locale to "Antarctica", it turns off 
most the locale logic <g>. There's so many programs that try to be too 
clever.

> Of course, eventually we will want to "do something" about this. But 
> that should be left to the day when real issues are all sorted out in D. 
> This is a non-urgent, low-priority thing.



More information about the Digitalmars-d mailing list