Adding Localization to a Windows Phone app

If you have any Windows Phone 7 apps from the original templates, unlike the Windows Phone 8 app templates they did not come with localization setup already. So lazy me just wrote the strings inline. Fortunately adding localization after updating to Windows Phone 8 is easy.

  1. Add a Resources folder
  2. Add new Resources resx to the folder named AppResources.resx
  3. Ensure Custom Tool is set to PublicResXFileCodeGenerator
    AppResources.resx Properties
  4. Add a new class named LocalizedStrings to the root of your project
    using YourAppNamespace.Resources;
    namespace YourAppNamespace
        /// <summary>
        /// Provides access to string resources.
        /// </summary>
        public class LocalizedStrings
            private static AppResources _localizedResources = new AppResources();
            public AppResources LocalizedResources { get { return _localizedResources; } }
  5. Add an Application.Resource of your LocalizedStrings class to your App.xaml

            <local:LocalizedStrings xmlns:local="clr-namespace:YourAppNamespace" x:Key="LocalizedStrings"/>
  6. Add strings in AppResources.resx

    AppResources.resx Content

  7. Use localized strings anywhere in your Xaml

    CompanyName="{Binding Path=LocalizedResources.CompanyName, Source={StaticResource LocalizedStrings}}"
  8. To Add other languages and for more details follow How to build a localized app for Windows Phone

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s