ELK cultures for other platforms

by Michael S. Kaplan, published on 2006/02/07 03:01 -05:00, original URI: http://blogs.msdn.com/b/michkap/archive/2006/02/07/526339.aspx


Ever since that first post about ELKs (Lions and tigers and bearsELKs, Oh my!) there has been a lot of interest in this mechanism. But that is not the only thing that generates interest.

For example, Dieter asked the following question in the microsoft.public.win32.programmer.international newsgroup:

I am passing 'hr-ba' to the construcutor of .NET Framework 2.0 class CultureInfo. Works fine in XP 2000, fails in Windows Server 2003 with message:

Culture name 'hr-ba' is not supported.
Parameter name: name

I have noticed that hr-ba is not in the lsit of supported cultures of CultureInfo documentation, but in blog entry http://blogs.msdn.com/shawnste/archive/2005/12/06/500675.aspx I have read that the CultureInfo is built up from os infos.

Any suggestions what I have to make it work on Windows Server 2003? Is there a setup available that installs that additional cultures available in XP Prof. and not in Windows Server 2003?

It is important to remember that these 'Windows only" CultureInfo objects are simply not designed to work on all platforms. They just aren't.

Now if someone who was using the exciting new Welsh locale in XP SP2 was not able to see it in their managed applications, they would be complaining pretty loudly.

Of course now there will obviously be people unhappy with the fact that these new cultures will not be on all platforms.

I think the problem is that developers like to complain. I know, because that is what I used to do anytime I wasn't getting what I wanted. :-)

(Maybe that isn't even as past tense as I like to think!)

Now it is true that there is no mechanism to add locales to a platform that does not have them other than the ELKs (which are not currently available for Server 2003, as I mentioned in ELKs aren't roaming where the servers are). And while I have learned since I started working for Microsoft it is that one can never say never, there is obviously no way that Dieter's immediate need will be met directly. Even if everything changed.

But don't worry, there is a definite workaround here to get things up and running.

After all, there is certainly a mechanism to add cultures to the 2.0 version of the .NET Framework -- CUSTOM CULTURES!

That's right, you can create a custom culture based on the Windows only one, save it as LDML, copy that file to the other machine (Server 2003, Windows 2000, even Window 98/ME), and register it.

Dieter tried it out and responded back with:

Thanks for the hint with the LDML file. It worked for me.

And now, with that same format now being supported in new versions of Windows, the ability to level the playing field will only become easier in the future, for both managed and unmanaged code.

 

This post brought to you by "рай" (U+183d, a.k.a. MONGOLIAN LETTER ZA) 


# Dave Sussman on 19 Apr 2006 1:15 PM:

We've hit the same problem with a requirement for Welsh locale support in an ASP.NET 2.0 web application. You don't explain how you create the LDML file and import it into server 2003 - any pointers?

Thanks

dave
(davids@ipona.com)

# Michael S. Kaplan on 19 Apr 2006 7:59 PM:

Hi Dave,

The trick is to use the CultureAndRegionInfoBuilder class. I'll put together a sample and post it here....

referenced by

2010/09/10 Doing the minimum isn't always the best plan...

2006/11/22 Fixing the sample code for getting ELK cultures on other platforms

2006/04/20 Sample code for getting ELK cultures on other platforms

go to newer or older post, or back to index or month or day