I'm working on a SL5 app with C# and I'm looking to internationalize it. I found the following to set the UI culture:
var culture = new CultureInfo(Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName);
Thread.CurrentThread.CurrentUICulture = culture;
Thread.CurrentThread.CurrentCulture = culture;
Some controls like the DatePicker seem to pick this up. If I format any datetime by using the 'd' format string, I still get the default format "M/dd/yyyy" however.
Exactly how does SL interpret culture and how can I set it correctly for the entire application?
Thanks
UPDATE:
Found the answer:
First of all, set the appropriate cultures in the Application_Startup:
var culture = new CultureInfo("nl-BE");
Thread.CurrentThread.CurrentUICulture = culture;
Thread.CurrentThread.CurrentCulture = culture;
The key element however is to add the following to force the RootVisual's culture/language:
var root = RootVisual as Page;
if (root != null)
{
root.Language = XmlLanguage.GetLanguage(Thread.CurrentThread.CurrentCulture.Name);
}
OverrideMetadata
method. CurrentCulture also does not contain aIetfLanguageTag
property... – Ladylove