PC Review


Reply
Thread Tools Rate Thread

displaying country name in current UI culture?

 
 
Rich
Guest
Posts: n/a
 
      6th May 2005
I have a two-letter country code and I need to display the name of this
country in the current UI culture.

Sadly I can't create a CultureInfo and use the DisplayName property
because this displays it in the localised version of the .NET framework
and not in the current UI culture which I might have changed (it is
calculated regardless of the language that the system is set to
display).

e.g:
country code: US
current ui culture: Spanish:
test string i need: "Estados Unidos"

Any suggestions?

 
Reply With Quote
 
 
 
 
Katy King
Guest
Posts: n/a
 
      6th May 2005
From: "Rich" <(E-Mail Removed)>
| I have a two-letter country code and I need to display the name of this
| country in the current UI culture.
|
| Sadly I can't create a CultureInfo and use the DisplayName property
| because this displays it in the localised version of the .NET framework
| and not in the current UI culture which I might have changed (it is
| calculated regardless of the language that the system is set to
| display).

CultureInfo.NativeName is in the language of that culture. So if you're
looking for the native name of the current UI culture, use that.
CultureInfo.DisplayName is (as you found) based on the language of the .NET
framework.
CultureInfo.EnglishName is always the English name for the culture.

If you want to display the name of a culture in some other language (e.g.,
Framework is English, current UI is Spanish, and you want the name of
German culture in Spanish), I'm not sure how to get that.

Katy

 
Reply With Quote
 
Rich Urwin
Guest
Posts: n/a
 
      7th May 2005
Hi,

> If you want to display the name of a culture in some
> other language (e.g., Framework is English, current UI
> is Spanish, and you want the name of German culture in
> Spanish), I'm not sure how to get that.


Thanks for replying - that's exactly what I want! Anybody else have any
suggestions?

cheers,
rich



*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
Marc Bernard
Guest
Posts: n/a
 
      9th May 2005
"Rich Urwin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
>> If you want to display the name of a culture in some
>> other language (e.g., Framework is English, current UI
>> is Spanish, and you want the name of German culture in
>> Spanish), I'm not sure how to get that.

>
> Thanks for replying - that's exactly what I want! Anybody else have any
> suggestions?


I would suggest asking in microsoft.public.dotnet.internationalization





 
Reply With Quote
 
Nicole Calinoiu
Guest
Posts: n/a
 
      9th May 2005
How about the same way the CultureInfo class does it? e.g.:

public string GetLocalizedName(CultureInfo targetCulture, CultureInfo
languageCulture)
{
ResourceManager manager = new ResourceManager("mscorlib",
typeof(string).Assembly);
return manager.GetString("Globalization.ci_" + targetCulture.Name,
languageCulture);
}

One important detail is that the mscorlib resources file for the specified
language must be installed on the machine. If not, the usual
ResourceManager language fallback rules will be applied. In other words,
it's probably pretty useless even if all available language packs have been
installed (which is extremely unlikely).




"Rich Urwin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
>> If you want to display the name of a culture in some
>> other language (e.g., Framework is English, current UI
>> is Spanish, and you want the name of German culture in
>> Spanish), I'm not sure how to get that.

>
> Thanks for replying - that's exactly what I want! Anybody else have any
> suggestions?
>
> cheers,
> rich
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
culture for different country ¥øÃZ½Þ¤j·Ý Microsoft ASP .NET 0 8th Jun 2006 03:48 AM
where to set the current culture in ASP.NET 2.0? Edge Microsoft ASP .NET 9 17th Jan 2006 09:01 PM
displaying country name in current UI culture? Rich Microsoft Dot NET Framework 0 5th May 2005 12:01 PM
Obtain current culture ??? cmrchs@yahoo.com Microsoft ASP .NET 3 25th Feb 2005 04:02 PM
How to change the current thread current culture at run time. Manu Microsoft ASP .NET 1 20th Jul 2003 04:27 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:20 AM.