2

I've got a Silverlight application and corresponding ASP.Net application hosting it.

I want to use the detected culture settings to format dates in the Silverlight application but I don't think it's detecting the system settings correctly (or it's using some setting I don't know about to base them on).

When I check the culture values on the thread (in the ASP.Net app and the Silverlight) CurrentCulture is correctly set to en-GB but CurrentUICulture is en-US.

I'm running on Windows 8 with the location and languages all set to en-GB.

I've used Fiddler to check the browser settings and it's sending the Accept-Language header value as en-GB.

Is this some setting on the web server I need to change? I'm using Visual Studio's build in development server.

BenCr
  • 5,991
  • 5
  • 44
  • 68
  • possible duplicate of [What is the difference between CurrentCulture and CurrentUICulture properties of CultureInfo in .NET?](http://stackoverflow.com/questions/329033/what-is-the-difference-between-currentculture-and-currentuiculture-properties-of) – nhahtdh Sep 06 '13 at 13:05

2 Answers2

1

First, to clarify:

CurrentCulture is for Dateformats, Numbers, Currencies, etc. (not the actualy language). CurrentUICulture is the language of the UI.

Do you set both the CurrentUICulture and the CurrentCulture in your thread?

Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("de-ch");
Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("de-ch");
Remy
  • 12,555
  • 14
  • 64
  • 104
  • Yes, I have set those values manually, and the `Language` property of the RootVisual. I just thought that the framework would automatically detect the culture of the host operating system and set them automatically. – BenCr Jan 11 '13 at 10:06
  • So,even though you set them correctly, they are wrong afterwards? Or what is the issue? – Remy Jan 11 '13 at 14:49
  • I've hardcoded them to en-GB because they CurrentUICulture was en-US. I thought the plugin/.net framework detected the current culture of the operating system so I want to know why I'm having to set them at all. Why aren't they just automatically set based on my OS settings. – BenCr Jan 11 '13 at 18:53
0

See nicodemus13 comment to What is the difference between CurrentCulture and CurrentUICulture properties of CultureInfo in .NET?

Bear-in-mind that Microsoft, in their wisdom, don't separate the UI cultures of US English and (British) English or other Englishes. There's no MUI for English, which means the CurrentUICulture will always be en-US on an English-language machine, regardless of the CurrentCulture, which can be set to localise the Regional Settings.

Community
  • 1
  • 1
Markus Hartmair
  • 672
  • 7
  • 15