by Michael S. Kaplan, published on 2005/03/25 16:38 -05:00, original URI: http://blogs.msdn.com/b/michkap/archive/2005/03/25/402313.aspx
This question often comes up -- what is the InstalledUICulture used for?
Short answer? It isn't for anything. Don't use it.
Longer answer? It is a culture based on the return of the GetSystemDefaultUILanguage for systems that support that API. This API is itself fairly useless. Which is why you should avoid the managed object -- wrapped up useless does not find itself being more useful. Neither one is for anything. Don't use them.
Want an even longer answer? Ok, you asked for it....
The GetSystemDefaultUILanguage returns the install language of the operating system. On a localized system that is the install language of the OS, and on an MUI system that is almost always English1.
Now note that this is not a language that the user has chosen to work in, or claimed to have knowledge of, or claims to even be able to comprehend. Having your application do something with it is as productive as looking into who your grandfather took to the prom and chatting them up as if they should know who you are. In summary, it is a bad idea.
There are exceptions, but to date I have never seen an application that uses it which is doing so appropriately.
This is in marked contrast to a similarly named but very different API that I have talked about in the past -- GetSystemDefaultLCID. Although it too is misused (and such misuse can be dangerous), it does at least have some important functionality. If you need a conceptual hook to understand the difference between GetSystemDefaultUILanguage and GetSystemDefaultLCID, it is like looking at the difference between Heroin and Cocaine -- both are very dangerous but the latter does have some medicinal benefit2.
The API and method are similar to the drugs in that the developer gets a "high" from thinking that their code works; the "down" comes later when they find out that the whole usage thing was just a "bad trip."
Don't you wish you had stuck with the short answer and avoided my drug analogy? :-)
1 - I'll talk about the exceptions to this another time. I promise that they will not rehbailitate either the Win32 API or the managed object.
2 - e.g. as a diagnostic indicator for people suffering from glossopharayngeal neuralgia. I'll talk about this disease some other time, though I do not myself have it. :-)
This post brought to you by "d" (U+0064, a.k.a. LATIN SMALL LETTER D)
(The Letter "d" says "Don't say NO to drugs; say NO THANK YOU and calmly walk away)
Umesh on 11 Aug 2010 11:58 PM:
You don't suggest what needs to be used though. Let me give an example. Suppose my application needs that a prerequisite be installed. And I want to help the user by directing him to a download site where usage directions are in different languages at different links. How do I choose the appropriate link to present to the user?
Michael S. Kaplan on 12 Aug 2010 7:02 AM:
The user's chosen UI language!
go to newer or older post, or back to index or month or day