by Michael S. Kaplan, published on 2007/01/11 03:01 -05:00, original URI: http://blogs.msdn.com/b/michkap/archive/2007/01/11/1449754.aspx
It was late last year that I got the following through the contact link:
Michael, I have a question that might be of particular interest to you. You might be able to answer it in one of your 30 to 40 blog entries you'll post today or tomorrow.
I'm taking Microsoft curriculum classes for various MCTS tests that we're taking and we're doing the training for the 70-526 tests. We were discussing CurrentUICulture and CurrentCulture.
Will you explain the difference between the two in .Net and also will you explain the differences between localization, globalization, and internationalization. If you would, I'd appreciate it, and I'll share your response with my class.
I probably missed the deadline of the class, but a I have mentioned previously this is probably not the place for time-critical responses. Sorry about that, Chris.
The question about globalization vs. localization vs. internationalization is one I have covered before, both jokingly and more seriously in posts like this one and this one that points at Larry's post. The "official definitions" according to the team behind Dr. International have been substantively changed at least once (and I don't exactly go along with the current "blessed" definitions for what it is worth), and not everyone agrees with the definitions I use (which pretty much match the ones Larry gave).
Given all of this, as a question it is meaningless if it is just going to be a bunch of people arguing about terminology definitions; conversations about the concepts have a chance of being more interesting.
So I am just going to focus on the other question of CurrentCulture vs. CurrentUICulture that came up again yesterday in this post and this one.
Now I have already pointed out that the actual names are probably not the greatest so if you want to talk about that you should probably comment in one of those posts. This post is gonna focus on the concepts.
The question that people asked yesterday is about wanting to know why these have to be two different properties-- why there is not just one.
Interestingly, it gets back to the fact that the concepts of internationalization and localization are two different things.
CurrentCulture, the managed analogue of the default user locale on Windows, comes from a list of many different choices (~208 of them on Vista) that allow a user to take any language version of Windows (even if it is not their native language) and see defaults for date formats and number formats and order of text in sorted lists that make sense to them. Now all you have to do is wait until December 5th for a tax refund check that you were supposed to receive on May 12th due to an ambiguous date like 5/12/2006 to realize that no matter what language one speaks one will have certain fixed opinions on these items. This list has existed in Windows for the entire life of Win32, and serves well the people who learned one of those few lucky languages to have Windows translated into it and who nevertheless had a preference for their formats and such that does not match that language.
In other words, the concept behind CurrentCulture has been in Windows all along, and the .NET Framework is merely trying to make use of this longstanding concept. Of course the name is not so great, as I pointed out yesterday, and it does not really describe to people what it is so that the name alone suggests appropriate use, but that is a reasonable excuse for when somebody makes a mistake, not an excuse to keep making the mistake once the meaning has been explained to you.
This setting does not, should not, and will not require one to run a localized version, because these preferences that one grows up with treating as "the way things are" cannot be changed without being a really awful user experience.
Now let's move over to CurrentUICulture, the managed analogue of the user default UI language in Windows that was introduced in Windows 2000 and is meant to cover the localization (a.k.a. localisation, a.k.a. translation) of Windows into other languages. It is about the resources that are loaded up so that the dialogs and alerts and menus and help screens and tooltips and so forth can be in a specific language. The managed version of this obviously needs to be scaled down to the application level rather than all of Windows. But the intended use is obvious no matter how much the name might suck.
The connection between the managed and unmanaged versions of these functionalities is not just one of heritage, by the way. The unmanaged Windows settings are the defaults used for the managed .NET ones. Just in case people did not want to rely on documentation or subtle hints, they could fall back to paying attention to this default behavioral imperative....
Now sometimes these two settings will obviously be expected to be the same. But there are several obvious scenarios where they wouldn't:
And there are other scenarios as well, and they are also valid.
So in the end there are two different concepts that for perfectly valid reasons a user might want as two different defaults.
Which means they get two different properties. For all the times that they are not the same....
Which is not to say that everyone has the right view on this; SQL Server, for example, has been doing it wrong at least since it was a Microsoft/Sybase joint project (discussed further here).
And if the names weren't so non-intuitive, this whole post might not have been so requested! :-)
This post brought to you by ඛ (U+0d9b, a.k.a. SINHALA LETTER MAHAAPRAANA KAYANNA)
# cbenard on 11 Jan 2007 8:57 AM:
That 70-526 class is over, and I passed the test. Right now, we're training for the 70-536 and the Web Dev one. Our class will continue until May.
I appreciate the in-depth answer, and I'll stick a link to it on our class intranet.
Thanks a ton!
# Erzengel on 12 Jan 2007 4:40 PM:
I am really confused by:
"...even if they still want that default user locale setting that affects behavior they really have been accustomed to since for all intensive purposes their zygote phase."
Firstly, whenever someone says "for all intensive purposes" they usually mean "for all intents and purposes". (Like a "Safety Posit Box" or "Safety Deposit Box", when they mean "Safe Deposit Box"). (Come on, you're a language guy, you should know this)
Do you mean something like: "...even if they still want their default user locale setting for behavior set to what they have been accustomed to since--for all intents and purposes--their zygote phase."?
I usually don't pick appart grammar and such, but I couldn't figure out what you meant at all for a good while.
# Michael S. Kaplan on 12 Jan 2007 5:53 PM:
Hmmm.... given the googlefight results, I think prescriptive grammarians have lost on this one. :-)
# Erzengel on 12 Jan 2007 6:36 PM:
Define "for all intensive purposes" for me.
Just because everyone says it doesn't mean it's right. How many people say "loose" when they mean "lose"? How many people say "it's" when they mean "its"? How many "people" (as defined by the law) said slavery was OK in the early 1800s? How many "people" (as defined by the law) said that women were second class citizens in the early 1800s? Just because "everyone" says it, doesn't make it right.
"For all intensive purposes" means "For purposes which are intensive only. All other purposes are discluded." Therefore, "since their zygote phase" would only apply to "intense" purposes, exceptional cases, rather than general ones. Is this truly what you meant? Or did you in fact mean, "all intents and purposes", which means "all purposes, and all intents".
As a language and internationalization person, you should prefer the CLEARER, rather than the more used, method. The more often used phrase does not make sense to non-native English speakers or persons who have not encountered the phrase. By using an incorrect phrase, you remove any and all clues to your meaning. Is that what you want?
# Michael S. Kaplan on 12 Jan 2007 6:53 PM:
I never said it was right... I was being skeptical about the "confusion" given how widespread and common the mistake is in other places.
My interesting linguistics and internationalization and language do not make me a prescriptive grammarian, so I am not obsessive about such things. So will I make the mistake again? Maybe not. But I don't fix every typo, either.
And I don't think I have removed "any and all clues" to anything, really. HYPERBOLE is a very confusing facet of comments, and often makes me suspect that the commenter either didn't get the point of the article or decided not to read it. But that's not really related...
That phrase is a small piece of a larger article that has nothing to do with the point being made, and there is no way that the importance of that small piece would be misunderstood to be more important no matter what the confusion might be? :-)
# Erzengel on 12 Jan 2007 7:17 PM:
The confusion wasn't about the phrase "for all intensive purposes". I understood what was meant there, that cmment was a throw away correction. Using "intensive" instead of "intents and" only throws away ("any and all") clues to the extent of that single phrase.
I couldn't understand that which was around the phrase. Possibly because I did not understand what a "zygote phase" was. After looking it up, and looking over the sentance several more times, I can somewhat peice together the meaning of the sentance. But the sentance itself (from "even" beyond) comes across as a bit clunky and was hard for me to understand.
To check my understanding, I've rewritten the sentance, and ask if it's correct:
"There are a lot of times when a person is multilingual; they may want to use a different localized version or switch to a different MUI version, if they have it. Even if they do they may want to keep the same behavior of the locale setting they’ve been accustomed to since—for all intentsive purposes[sic]—the zygote phase."
Is that basically what you meant?
I don't know why it's hard for me to understand the sentance, it just was.
# Michael S. Kaplan on 12 Jan 2007 8:24 PM:
Delete the sentence in your mind as you read. You'll enjoy the experience much more (if not then are probably other blogs you can follow!).
It's time to move back on topic, I think....
# Dean Harding on 14 Jan 2007 10:17 PM:
Actually, the correct google fight URL would be: http://www.googlefight.com/index.php?lang=en_GB&word1=%22intensive+purposes%22&word2=%22intents+and+purposes%22 since you're looking for the whole phrase, not just individual words in the phrase...
Which puts "intents and purposes" as 10 times more common than "intensive purposes" :)
Anyway, I'm sure most of us were able to figure out what you mean ;)
# pealla on 26 Jun 2008 3:14 AM:
Harking back to an earlier post by Erzengel I agree that the literal translation of "for all intents and purposes" is "for all intents and all purposes" however the phrase is generally accepted to mean "for all practical purposes".
# Michael S. Kaplan on 26 Jun 2008 3:43 AM:
In the meantime, given the intensity with which some people are arguing this minute point that has nothing to do with the original topic, I would argue that FOR ALL INTENSIVE PURPOSES is actually valid given how intense everyone is! :-)
# villa rental south of france on 19 Nov 2008 5:08 AM:
I need to fetch the current time zone info on windows 2003 server .. specifically the day and month in french
I know it can be done using
private static extern int GetTimeZoneInformation(out TimeZoneInformation lpTimeZoneInformation);
but my problem is that it returns the time zone standard name in the language which is currently used on the device(like German).
I want it to be in french
Is it possible?
# Michael S. Kaplan on 19 Nov 2008 8:57 AM:
This really belongs in the Suggestion Box (see the link on the right for it). It really has nothing to do with this post and is a request for a new one....
# Ms. Chanandular Bong on 11 Dec 2008 7:54 AM:
thanks for this very good article. I'm currently estimating the effort needed to make our software localizable and you helped me a lot with understanding the difference between those two properties.
But I encourtered another problem. I tried everything (i think) to get Windows XP to give me another CurrentUILanguage than my non-MUI Windows language (German). Is it possible, that only the MUI-Version supports changing the default user interface language?
Thanks a lot.
Mike Claymon on 21 May 2009 3:50 PM:
I have a CurrentCulture vs. CurrentUICulture issue and I don't understand how to resolve it. If you could help, I would greatly appreciate it.
I have a Windows XP computer with English installed for the OS and French set in Control Panel/Regional Settings. The CurrentCulture returns English and the CurrentUICulture returns French.
I have a Windows Server 2003 computer with French installed for the OS and French set in Control Panel/Regional Settings. The CurrentCulture returns French and the CurrentUICulture returns English.
As it stands right now, I can't always use either CurrentCulture or CurrentUICulture. How can I make this work?
William Garrison on 22 Jun 2009 12:08 PM:
Absolute proof that the CurrentCulture -vs- CurrentUICulture thing is stupid can be summed-up in the following MSDN article:
Read the example. It says:
"The following code example shows the threading statement that allows the user interface of a Windows Forms to display in the culture that is set in Control Panel. Additional code is needed."
Now why the heck would someone have to add special code to make their application display the UI in the culture set in the control panel? That's absurd.
The code boils down to:
CurrentUICulture = CurrentCulture
Further proof: Install a suite of apps that support German on an English windows. Now, go to Control Panel - Regional and Language - Languages - and set "Language used in menus..." to German. OOPS! It's not there! It only lets you select from the languages that Microsoft has installed language packs for -- COMPLETELY defeating the purpose of the screen. If you have all translated apps installed, but don't have Microsoft's language pack installed, you are forbidden from even selecting your language.
Michael S. Kaplan on 23 Jun 2009 3:27 AM:
Hi William.... note that a dumb code sample is not proof of a setting being dumb -- it is proof that people can write dumb code samples and get them published.
But the code is TRYING to make the app use the USER LOCALE, which can be changed even if MUI is not installed, which is a little silly but not stupid -- just poorly described in the article.
The other issue is by design -- Windows UI languages are about WINDOWS. It would be nice if they were extended beyond that but that is not proof they are stupid, that is proof that making an incorrect assumption can lead to incorrect results....
I have no problem calling things stupid when they are, but you are a bit mis-aimed in this case in putting your finger on the actual problems behind the cases you are seeing.
William Garrison on 11 Jul 2009 11:32 PM:
"which is a little silly but not stupid"
Perhaps. Sounds like we mainly disagree in the degree of the problem.
"The other issue is by design -- Windows UI languages are about WINDOWS"
Stating that it is by design does not make it correct. The point is that this behavior is not what the users expect, nor what the programmers expect.
The code sample is vindication to all the programmers who spent hours frustrated, when their German application on their machine set to German, displays English. :-)
Michael S. Kaplan on 12 Jul 2009 1:56 AM:
When there are two knobs on a radio, one for the volume and one that changes the station, and both USERS and STORE CLERKS are confused because they think there should be only one knob, then the answer is the same.
Now perhaps the radio is designed poorly and that is why everyone thought the one knob should always work for both settings, but that is a UI flaw unrelated to the fact that it is BY DESIGN.... :-)
ivl on 21 Jul 2009 7:41 AM:
I just want to confirm that I have understood what the "bottom line" is:
We shouldn't change the following:
System.Threading.Thread.CurrentThread.CurrentCulture = ...
because we would like to honor the user's "Formats" (Date, Time, Number, Currency) settings in Control Panel.
We should change the following:
System.Threading.Thread.CurrentThread.CurrentUICulture = ...
only if the Windows language pack for the language in which we would like to display the UI of our app in, is not installed.
Does this sound correct?
Mike Claymon's comments are worrying though, why would he be getting such results? Mike, if you're reading, did you resolve your issue? If so, what was wrong?
Jesse Chisholm on 3 Mar 2010 11:02 AM:
So. From my point of view the "bottom line" sounds like this collection of points:
1 The system runtimes will automatically look for satellite localized resources belonging to CurrentUICulture.
2 When loading additional localized resources at run time, look for the ones belonging to: CurrentUICulture.
3 When formatting an object of the special four types (Date, Time, Number, Currency), use the CurrentCulture.
4 If you want to override the system culture at run time, then change CurrentUICulture to what you want it to be IN EVERY THREAD THAT NEEDS TO BE DIFFERENT.
Item 4 is such a hassle, (I can't control the code in all threads) that I am willing to leave it to release v2 of our product. In release v1, you get the localized strings of the OS's culture, and the user chosen formats. It's a start.
Alan on 23 Apr 2010 8:50 AM:
There is no such thing as "intensive purposes". The expression is "intents and purposes".
Michael S. Kaplan on 23 Apr 2010 9:31 AM:
Alan, have you read the previous comments? Already discussed, debated... YEARS AGO. :-)
Chris on 24 Apr 2010 12:53 PM:
Ah, finally. Went through a couple of books and couldn't find a decent explanation of CurrentCulture and/vs CurrentUICulture.
pealla on 25 Apr 2011 9:02 PM:
I'd forgotten about this thread entirely, good old google, reuniting us with past lost. Now back to the main point of this discussion. Let's take an entry from a hypothetical bomb disposal manual "... and one now cuts the red wire, <turn page> after first cutting the blue wire...". The consequences may not be in accordance with the author's expectations. Here, the unintended consequences (being beset upon by a gaggle of deranged pedants), are not as dire but would have been avoided with a little more care.
Language binds us, where shall we set the bar? Should we set it here. Ore maibee hear. Aboot how their. Cucumber.
Ben Thurdson on 17 Sep 2012 10:24 AM:
You made this too verbose. I got lost trying to find what I need. Little text, little code is the way to go. I can make things complicated on my own.
Michael S. Kaplan on 17 Sep 2012 5:11 PM:
Not how I roll, sorry! MSDN is fine for little info, litle code, though...
go to newer or older post, or back to index or month or day