Over a million developers have joined DZone.

WinRT 8.1: Regional Settings Still Misbehave

DZone 's Guide to

WinRT 8.1: Regional Settings Still Misbehave

· Mobile Zone ·
Free Resource

The regional settings still misbehave in Windows 8.1 XAML apps. They misbehaved already in Windows 8 and they continue to misbehave in apps written with a newer WinRT. Some may say that they work as designed. To them I say the design is wrong.

The previous post about this subject contains more info, but here’s a short introduction to the problem.

Scenario: A Finnish users starts my Windows 8 XAML app. The app displays dates and times. The app isn’t localized to any language. I want the app to show the dates and times in Finnish format as that’s how she has configured her regional settings:

The problem: The app doesn’t respect her settings. Instead, all the dates and times are formatted using the US settings:


Other frameworks: Windows Forms, Console Applications, WPF, Silverlight and ASP.NET all handle this correctly: Dates and times are formatted using the regional settings:


The workaround: It’s possible to get the dates and times formatted correctly in WinRT apps. It’s just requires a lot of code. I call this a workaround until the WinRT XAML apps start behaving as they should:

var usersLanguage = Windows.Globalization.Language.CurrentInputMethodLanguageTag;
var dateFormatter = new DateTimeFormatter("shortdate", new[] { usersLanguage }).Patterns[0];
var timeFormatter = new DateTimeFormatter("shorttime", new[] { usersLanguage }).Patterns[0];
var fullFormatter = new DateTimeFormatter(dateFormatter + " " + timeFormatter);
this.MyDate.Text = fullFormatter.Format(DateTime.Now);


Update 4.7.2013:

It seems I can get the behavior similar to Silverlight and other frameworks by setting the Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride on application startup (App.xaml.cs). For example:

public App()
    Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = Windows.Globalization.Language.CurrentInputMethodLanguageTag;
    this.Suspending += OnSuspending;


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}