Windows Phone 8.1 for Developers – Localizing Apps

This blog post is part of a series about how Windows Phone 8.1 affects developers. The series is written in collaboration with Microsoft evangelist Peter Bryntesson, check out his blog here.


When you create an app that is to be released in more than one market you must globalize and localize your app. A globalized app displays data, such as dates and numbers, in the culture format of the user. A localized app is adapted to a specific local market. This mostly involves text strings in you app being translated to other languages, like French or German

With the release of Windows Phone 8.1 the way you localize your app has changed. It is now more consistent with how you localize a Windows Store app.

How it was done in Windows Phone 8.0

Adding language resources

You add languages by checking the language in the project properties.


This will automatically add one .resx file for each language.



Accessing resources from xaml


Assuming you have a resource named “SampleProperty”, you show the string by binding to in Xaml.

<TextBlock Text="{Binding LocalizedResources.SampleProperty, Mode=OneWay, Source={StaticResource LocalizedStrings}}" />


How it is done in Windows Phone 8.1

Adding resource files

You do not specify what languages you support in the project properties any more. You only specify the default language in the app manifest.


You have to manually add one .resw file for each language you support. The files must all be named Resources.resw and must be placed in a sub-folder, named after the language, under a “Strings” folder in your project.



Accessing resources from xaml

You access the resources by setting the x:Uid property of a control to a unique name. Unfortunately the x:Uid property is not recognized by the properties window, neither in VisualStudio nor in Blend, so you must hand code it directly in the xaml file. Example:

<TextBlock x:Uid="MyTextBlock" />
<Button x:Uid="MyButton" />

You must then add a resource with the uid-name with dot-notation, that is, after the dot you write the name of the property of the control in which you want the text. Like in the picture below.



If you have a control with more than one text property, like the new ToggleSwitch control, you set the uid once and then add one resource for each property.

<ToggleSwitch x:Uid="MyToggleSwitch" />



Yes, it is a bit more complicated to localize an app in 8.1 and the potential for mistakes is greater. I do expect that in time the tooling will get better, but for now you just have to be a bit more careful with your resources.

This Post Has 15 Comments

  1. Andrea Domenichini


    Windows Phone 8.1 localization is the same of Windows Store apps.
    It’s a little bit more complicated but it’s a lot more flexible since you can set other properties and not only Text.
    In this way for example you can set FlowDirection for Arabic without modifying xaml.

  2. Frank

    I did not get design time support with this approach. When I start the program it works fine but I do not see anything in the designer. Only if set the Text property I’ll see something.

  3. Tommaso Scalici

    And they don’t work in design mode… that’s a bad thing :(

  4. Zach

    Doesn’t work for WP 8.1 Silverlight apps. I was able to get it working for Universal apps, but like others said, there is no design time support.

  5. Ram

    How do I use this key name value from cs file always getting null reference exception… too bad same way working fine in WP8 build. :(

  6. Johan Olsson

    Getting strings from code is done like this:
    var stringValue = ResourceLoader.GetForCurrentView().GetString(key);

  7. Ciwan

    Thanks for this. Was following Bob’s tutorial on Channel 9, but at the time it was recorded, it was done the old way. This blog post of yours helped me and now it works!

  8. Ciwan

    I have one issue though. Say I have ‘MainPage.xaml’ open and in the code for my TextBlock I have the attribute set as [ x:Uid=”ApplicationTitleTextBlock” ]. In the Preview Pane I can’t actually see any text! It is blank! I have to run the application and only then does it show!

    This is quite terrible to work with. Any fix?

    1. Johan Olsson

      Unfortunately translation does not work in the editor in Visual Studio or Blend. The workaround I use is to set the text property to something. Example:

      <TextBlock x:Uid=”MyTextBlock” Text=”$Sample text$”/>

      In the editor “$Sample text$” is displayed and in runtime the actual text loaded from the translated resources is displayed. A bonus is that if I see a text with $$-signs in runtime, then I know I have forgotten to add the string to the resource file.

  9. Milind

    Super, Thank you for detail explanation. It help me lot :D

  10. Milind Saraswala

    Thank you for the nice info. I implement the way you explain and it is working properly. My app is for English and Arabic as my default language is English it is get resource from English but now I am clicking on button to get Arabic resource to change it to Arabic. How we can do that.

Leave a Reply