#763 – The Difference Between CurrentCulture and CurrentUICulture
February 25, 2013 5 Comments
In a WPF application, you have access to two properties that give you information about the user’s culture and language. They are both properties of a Thread object, which you can access via Thread.CurrentThread.
- CurrentCulture – Tells you the user’s current locale, as set in the Region applet. I.e.: Where is the user located?
- CurrentUICulture – Tells you the native language of the version of Windows that is installed. I.e.: What language does the user speak?
The user can change CurrentCulture using the Region applet. It’s used to determine formatting for numeric and date/time strings.
The user normally can’t change CurrentUICulture without re-installing Windows. It’s used to know what language to use when displaying text in your application. (I.e. Which resource files to load).
CultureInfo ci = Thread.CurrentThread.CurrentCulture; lblCurrentCulture.Content = string.Format("CurrentCulture = {0} - {1}", ci.Name, ci.DisplayName); ci = Thread.CurrentThread.CurrentUICulture; lblCurrentUICulture.Content = string.Format("CurrentUICulture = {0} - {1}", ci.Name, ci.DisplayName);