Localization Support in Windows Phone 8 Apps

Problem

You want to add Localization support but don't know how to do that.

Solution

If you're publishing your app for various marketplaces, Windows Phone owners will use the app in their local language. As previous experience has told me, building a globalized (English) app won't matter. Localization matters very much!

Luckily, Visual Studio makes it very easy for us. When we add Supported Languages, it will create .resx (Resource Files) per language.

Let's Add French support to our application. Open Project Properties and select French (France): 


ss7.png

When we rebuild our application, the French resource file will be added to the Resources folder.

ss8.png

The contents of the resource files aren't translated when you do that! So you'll need to edit per added language:

ss9.png   ss10.png

Ok.We created our resource files.But how to use them?

Let's add a Textblock control to our Grid.To display a value from the Resource file, we need to write code such as this:

lbltext.Text = AppResources.Title;

This will show the value of the key named "Title" in the Resource file. So keep in mind; the key can be the same in all resource files, but values need to differ depending on the language. 

When we change our language settings from English to French, our textblock control will display the same value we wrote in the French Resource file.

That's it! Now we have Localization support for our Windows Phone 8 App.

Dont forget that localization is very important for a mobile app.

Up Next
    Ebook Download
    View all
    Learn
    View all
    Araf Global is a software consultancy company founded in 2016 focusing on cutting edge technologies.