Thursday, January 11, 2007 12:01 AM
Michael S. Kaplan
Why we have both CurrentCulture and CurrentUICulture
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.
Thanks,
Chris
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:
- Often there are no such resources available, which is true of every version of Windows and every version of the .NET Framework itself, where the number of languages into which the software is translated is smaller than the list of possible locales.
- There are lots of times that a person knows more than one language, and if they have the localized version or the MUI version they can switch to, they would like to do it, 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.
- Interestingly, there are also times when people (especially developers) have historically preferred the English version due to perhaps perceived stability issues or cultural issues, yet they still want those built-in defaults that they grew up with and expect to be what they always were.
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)