Windows 8.1 – Localization

Today I want to share how I localized my Windows Store application, very easy! Localization can also be implemented using “Resources File (.resw)” files. I will try it soon but first I wanted to implement a solution using my already existing resx files.

To test the developing process for Windows Store and Windows Phone I am using this project structure:

All localization terms are already in a portable class library, so that they are share between the Windows Phone and Windows 8 applications.

The terms are contained in “resx” files:

AppResources.resx (default app language, English)

AppResources.es-ES.resx (Spanish)

AppResources.fra.FR.resx (French)

These files contains a list of string properties that we can create be created easily using the editor:

Once the project is compiled a class “AppResources” with a property of type string with each entrance of the table is created. The value of the string is resolved using the resx corresponding to the current language of the UI Thread.

There are several ways to use this resources files in XAML, I wanted to use them with the support of IntelliSense, with my solution it is possible to define a common Localization Provider on my App.xaml that uses the resources files contained by the portable class library:

The Localization Provider is a class that should be non static, so that it is possible to create a common instance in App.xaml. this class contains only one static property that returns a new instance of the AppResources class generated by the Resources files contained in the common project:

The last step to upload an application to the store supporting more than one language, this means not only an application that can run with different languages but also appears with a different description and screenshots on the store depending of the language, is to add this in the appxmanifest:

Post navigation

4 thoughts on “Windows 8.1 – Localization”

Hi.
Did you succeed to handle localization in a Windows Universal Application, using an external project for handling localization and an helper Localization class in order to have, also using resw resource files, the capability to not duplicate common entries?
I am having problems: I can manage the localization only if the Resources.resw files are in the Shared project (in the proper String/xx-yy directory) using a class like this:
public class LocalizedStrings {

Unfortunately if the Resource.resw file is in the Shared project it is not possible to set in the property the Custom Tool as PublicResXFileCodeGenerator (to have the Resource.Designer.cs class generated). If I try, as I would prefer, to create a separate project (a portable one) to handle localization, because of the need to have each Resources.resw file in .separate directory related to a specific language, I am not able to make the things work!!

Hi Juan Carlos, I had a similar approach in my app but, at some point, it didn’t work no more.
In particular, I have an app based on mvvmcross 4.3, Xamarin.Android and Windows Phone 8.1.
I have a PCL project dedicated to the string resources: the same are for Android and Windows Phone 8.1.
Actually, I don’t know exactly after which update my localization solution stopped to work (maybe Visual Studio 2015 Update 4?), but until a month ago I can run it in the emulator (both debug or release) and by changing the system language I could see the effect in the app. Since the last month my app just ignore the regional settings and just work ONLY with default language (that one you set in manifest).

Thanks to your post I’ve found a solution: add a “Resource” item for each non-default language in the app manifest.

So, many thanks for your post… anyway I’m really curious about the reason of this problem.
I post this feedback here to ask if you (or someone else) know the solution.
Thanks