#1,113 – Use of Cultures in Internationalization

When localizing an application or running a localized application, you’ll work in the context of a particular culture.  A culture can be thought of as the combination of a particular language and the country or region where the language is being spoken.

A developer targets one or more cultures when localizing an application.  For example, he might translate text in the application for the German-spoken-in-Austria culture or the English-spoken-in-the-UK culture.

Cultures are also used at run time.  A user runs an application within an environment that represents a particular culture.  This culture is then used by the application to determine which strings to load.

A culture that includes both a language and country/region indicator is known as a specific culture.  (E.g. French/Canada).  You can also work with neutral cultures, which are defined by a language but without a specific country.  (E.g. French)

#763 – The Difference Between CurrentCulture and CurrentUICulture

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);

For example, someone in England might see:

#762 – Set FlowDirection at Runtime Based on CurrentUICulture

The FlowDirection property of a FrameworkElement (including a Window) indicates how child elements of an element should be layed out–left to right (what we are used to in the US), or right to left.

FlowDirection should typically be set to match the text direction of the language being used to render text in your user interface.  If text in your application is in Arabic, the letters will run right to left, so your GUI should also be layed out right to left.

You’ll normally load text resources based on the CurrentUICulture property, which is meant to indicate the target language for your application.  So you should also set the flow direction based on information pointed to by CurrentUICulture.

For example:

        public MainWindow()

            this.FlowDirection =
                CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft ?
                    FlowDirection.RightToLeft :

On an English version of Windows, we get:
And on an Arabic version of Windows, we now get: