by Michael S. Kaplan, published on 2005/04/11 07:16 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2005/04/11/407107.aspx
Now this is a topic I have talked about before, so I am going to put a slightly different spin on the issue, this time.
To review, a user can go into Regional Options and make choices about the language they want to use.
Now I could go on forever (hell, I have gone on forever!) about using the NLS APIs to have that setting respected and how it is such a good idea.
But developers do not tend to think that way.
Generally speaking, they develop programs that meet requirements, and the "respect user locale" requirement is such a stealth one one that it usually does not show up on the list a developer is working from.
So, put yourself in my shoes. Or the shoes of a developer working on NLS. How do you make sure that the user preferences are going to be respected?
Well, the best way is to make sure that by default the APIs pick up the user preferences. It has to be harder to not get those preferences. And we do that -- all the NLS APIs like GetNumberFormat and GetLocaleInfo require developers to pass the LOCALE_NOUSEROVERRIDE flag explicitly to not get the user's preferences. In the same way, the CultureInfo ctor has a default that picks up that same set of user preferences. Sure, you can explicitly pass false to that UseUserOverride parameter, but the default does not require that.
Now there are people who actually work on .NET who feel that the .NET Framework should have had different defaults here -- better in their mind to go with the locale-insensitive behavior and then make picking up the user settings an "opt-in" process. But such an approach is doomed to be non-intuitive since users who make changes in Regional Options have a realistic expectation that they will be able to see the change picked up. It is the main reason that even the .NET Framework was given mechanisms to pick up these changes -- because people expect to not only make them but to see the results reflected by applications, managed and unmanaged.
So, over the objection of some people, the .NET Framework does the same thing as Windows functions like lstrcmp and lstrcmpi -- it respects the user's setting by the default in comparison, parsing, and formatting. If you are a developer writing code and you want to ignore those settings, you have to explicitly work at it....
Because I am a developer myself, and I know that sometimes the respect must be enforced to make sure developers do it. No offense to the developers (and this does not apply to all of you!) but it applies to enough to make doing it this way a requirement.
This post brought to you by "ܜ" (U+071c, a.k.a. SYRIAC LETTER TETH GARSHUNI)
# Mick O on 11 Apr 2005 10:34 AM:
# Centaur on 11 Apr 2005 2:40 PM:
# Mike Williams on 11 Apr 2005 6:13 PM:
# Michael S. Kaplan on 11 Apr 2005 10:10 PM:
# Tim Mckinnon on 13 Apr 2005 2:49 AM:
# DaveG on 25 Apr 2005 11:00 AM:
2005/04/23 SetLocaleInfo really stinks
go to newer or older post, or back to index or month or day