michielpost.nl

How to make multi language apps work on Windows 8

26-04-2012

This blog post is about Windows 8 / WinRT XAML apps. It's based on the Windows 8 Consumer Preview, things can still change in upcoming versions.

There are already great resources that tell you how to create a localized app. Like the Windows 8 sample "Application resources and localization". Tim Heuer also wrote a long blog post about it.

However, when you try those samples in Windows 8 and change your language in the Control Panel, it does not work! The application always default to English! Why?

Because there is one crucial thing missing:
You need to set the supported languages in the application manifest file.

Open the Package.apppxmanifest file with a XML editor. Look for these lines and add your supported languages:

<Resources>
   <Resource Language="en-us" />
</Resources>

My guess is this should be done automatically on compilation. But currently that's not happening.

Update:
It is possible to auto generate these values by setting the language value to x-generate:
<Resource Language="x-generate" />

Thanks Tim Heuer for the tip.

Comments


timheuer 27-04-2012
You shouldn't change the manifest. VS will automatically add the languages your app supports based on the languages indexed. For example, if you have a folder with de-DE then it will automatically be added to the final manifest as long as x-generate is used as the language in your source manifest. If you change that then you are responsible for adding each language each time. I recommend keeping x-generate.


janne 12-10-2012
The tip is good when you want to use same language resource files on multiple solution platforms using Portable Class Library projects (http://msdn.microsoft.com/en-us/library/hh871422.aspx). On those cases <Resource Language="x-generate" /> does not do the magic.


Alvaro 02-08-2013
x-generate does not work if the resources are in a referenced dll as resx resources.


John 26-05-2014
I just noticed this same bug in Visual Studio 2013 R2. Even when you change the language in the Windows Phone 8.1 emulator, the application still defaults to English. Only when I rename the "en-US" strings folder to something like "test" does the Windows Phone 8.1 app show the Spanish "es" resource strings. Typing in "x-generate" for the default language isn't allowed.


New Comment

Name
E-mail (not published)
Comment
Enter the code shown: