views:

77

answers:

1
+1  Q: 

culture fallback

I assume the following code is Correct,

CultureInfo culture = CultureInfo.GetCulture("en-US"); Assert.IsTrue(culture.GetConsoleFallbackUICulture().Name == "en");

but it is not, culture.GetConsoleFallbackUICulture().Name is still "en-US", I want to know what is the API to get the fallback culture.

Thanks Jeff

+1  A: 

This is correct, en-US does not need to fallback, that's why it returns en-US.

Only cultures in this list are affected: http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.getconsolefallbackuiculture.aspx

EDIT: if you want to do what's in your comment, use the CultureInfo.Parent property.

Gerrie Schenck
Thanks, but I want to mimic the .net culture fallback behavior, I want to get cutlure "en-US"'s parent cutlure, I assume it is "en", and "en" 's parent is Cutlure.InvariantCulture, How do I achieve this?
Jeff
Please edit your original question... I've updated my answer.
Gerrie Schenck