Windows Phone 8 Dev – Basic App Localization


In my last post I made a basic color swatch and I thought it would be interesting to localize it for another language.

As you can see in the gallery above I set bindings to localize my app name, subtitle and for each color name in the swatch.

To do this we need to choose which language(s) we want to support and then populate their AppResources.resx page. To choose supported languages open the WMAppManifest.xml file and then click on the Packaging tab.


As you can see English (US) is my default language and Spanish is the other language that I have chosen to support. Click the Save button after selecting languages.

In the Solution Explorer (under the Resources folder) I now have an .resx file for Spanish called AppResources.resx is the file for my default language.

In each .resx file I set the binding Name and it’s Value. For example I have ApplicationTitle set in both pages with different values – Theme Colors and Tema Colores respectively. As you can see I created my own Names for the colors and app subtitle.

So I worked through both .resx files making sure that there were binding Names for my app title, subtitle and each color – along with the appropriate values for each language.

The next step is to set up the bindings in our app. Let’s start with the app title.

<TextBlock Text="{Binding Path=LocalizedResources.ApplicationTitle,
           Source={StaticResource LocalizedStrings}}"
           Style="{StaticResource PhoneTextTitle2Style}"
           Margin="12,0" />

So, we have replaced the hard-coded application name with a binding to the ApplicationTitle in both of our .resx files.

Similarly you can see that I used the same code to localize the color names – just changing the binding name for each color:

<TextBlock Text="{Binding Path=LocalizedResources.Lime,
           Source={StaticResource LocalizedStrings}}"
           Margin="0 22 0 0"
           Grid.Column="0" />
<TextBlock Text="
           Grid.Column="0" />

I did have to update the layout of my TextBlocks to separate the localized and non-localized elements.

To test localization in the Visual Studio emulator you need to change the language under All Settings > language.

In my next post I will look at localizing the AppBar.

Happy coding!


2 thoughts on “Windows Phone 8 Dev – Basic App Localization

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s