Groups | Blog | Home
all groups > dotnet internationalization > march 2007 >

dotnet internationalization : UI Culture - How to distinguish between countries


Dan Cooperstock
3/5/2007 8:52:37 AM
It seems that the default UI culture that you get in a Windows Forms
application is based on only a language, and not a country. But in English,
there are certainly language differences, such as American "check" versus
Canadian or British "cheque".

How do I get the UI Culture to pick up the country as well as the language?
I'm assuming from previous reading and my testing so far that the default
is based on your "Language used in menus and dialogs" setting in Control
Panel -> Regional and Language Options -> Language tab. That setting only
appears if you have a multilingual pack installed (on Windows XP).

There is always the option of setting the UI Culture to be the same as the
regular Culture (which determines date/time, currency etc. formatting), but
I have the impression that is not at all a good idea, because there's no
reason to assume your users will want this.

---------------------------
Dan Cooperstock
DONATION web site: http://www.FreeDonationSoftware.org
DONATION Support forums: http://forums.FreeDonationSoftware.org
E-mail: mailto:info@FreeDonationSoftware.org
Dan Cooperstock
3/5/2007 3:02:23 PM
Dan Cooperstock <dancoo@newsgroups.nospam> wrote in
news:Xns98EA78D1DDD43dcoopssympaticoca@207.46.248.16:

[quoted text, click to view]

It seems that this isn't correct. In fact, I'm in Canada, and what I'm
seeing is that my CurrentCulture is en-CA, and my CurrentUICulture is en-
US.

I can't figure out how to get my CurrentUICulture to be en-CA (just using
Control Panel). Obviously I can set it in my application, but I don't want
to have to do that.


---------------------------
Dan Cooperstock
DONATION web site: http://www.FreeDonationSoftware.org
DONATION Support forums: http://forums.FreeDonationSoftware.org
E-mail: mailto:info@FreeDonationSoftware.org
Mihai N.
3/5/2007 7:54:45 PM
[quoted text, click to view]

You cannot. The application's CurrentUICulture is inherited from the UI
language of the OS.
And since there is no English Canada version of localized Windows, the OS
will never have CurrentUICulture en-CA (unless MS releases an nglish Canada
version of Windows, quite unlikely).


--
Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Dan Cooperstock
3/6/2007 6:41:28 AM
"Mihai N." <nmihai_year_2000@yahoo.com> wrote in
news:Xns98EACA914C3D4MihaiN@207.46.248.16:

[quoted text, click to view]

So, what would you recommend I do in my code? What I'm trying right now is,
if the CurrentCulture and the CurrentUICulture are the same language but a
different country, I set the CurrentUICulture to be a new CultureInfo with
the same LCID as the CurrentCulture.

Does that make sense?

---------------------------
Dan Cooperstock
DONATION web site: http://www.FreeDonationSoftware.org
DONATION Support forums: http://forums.FreeDonationSoftware.org
E-mail: mailto:info@FreeDonationSoftware.org
Mihai N.
3/6/2007 7:04:30 PM
[quoted text, click to view]

I think it does make sense.
But what happens if you have no localized version matching CurrentCulture?
For instance you offer en-US and and en-CA, but the user has en-NZ.

You might add some extra logic there, but I think the best idea is to also
offer the user a way to change the language.
Maybe even pop-up a dialog the very first time, listing all the available
languages that you offer.
And you might use the CurrentUICulture/CurrentCulture logic for a best guess,
selecting something in the list that matches.



--
Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
AddThis Social Bookmark Button