How to localize text resources

This guide will walk you through the necessary steps to localize an Uno Platform application.


The complete source code that goes along with this guide is available in the unoplatform/Uno.Samples GitHub repository - Localization


For a step-by-step guide to installing the prerequisites for your preferred IDE and environment, consult the Get Started guide.


  1. Create a new Uno Platform application, following the instructions here.

  2. Modify the content of MainPage:

    • In MainPage.xaml, replace the content of the page:
      <Page x:Class="UnoLocalization.MainPage"
          <StackPanel toolkit:VisibleBoundsPadding.PaddingMask="Top">
              <TextBlock x:Uid="MainPage_IntroText" Text="Hello, world!" Margin="20" FontSize="30" />
              <TextBlock x:Name="CodeBehindText" Text="This text will be replaced" />


      • The x:Name is used to make the element accessible from the code-behind with that same name.
      • The x:Uid is used for localization. To localize a property, you need to add a string resource in each resource file using its x:Uid followed by a dot (.) and then the property name. eg: MainPage_IntroText.Text More on this in the resource steps that follow.
    • In MainPage.xaml.cs, add an Page.Loaded handler to change the text for CodeBehindText:
      public MainPage()
          this.Loaded += (s, e) => CodeBehindText.Text = Windows.ApplicationModel.Resources.ResourceLoader
  3. Create a new resource file for localization in French in the UnoLocalization.Shared project:

    1. Add a new folder fr under the Strings folder by: Right-click on String > Add > New Folder
    2. Add a new resource file Resources.resw under the fr folder by: Right-click on fr > Add > New Item ... > Visual C# > Xaml > Resources File
  4. Add the localization strings for both English and French:

    Open both Strings\en\Resources.resw and Strings\fr\Resources.resw, and add these:

    Name Value in en\Resources.resw Value in fr\Resources.resw
    MainPage_IntroText.Text Hello Uno Bonjour Uno
    MainPage_CodeBehindString String from code-behind Texte provenant du code-behind

    Make sure to hit Ctrl+S for both files, to save the changes.


    The ResourceLoader will search for resources in the current language, then the default language. The default language is defined by the MSBuild property DefaultLanguage, which defaults to en.

  5. You can now try to run the app.

    The "Hello World" text should be replaced with "Hello Uno", or "Bonjour Uno" if the targeted environment is on French culture. Now, if you change the language of the targeted PC or the mobile device AND restart the app, that text should also change accordingly.

    You can also set the starting culture to see the result, without having to modify the system language:

    • App.cs or App.xaml.cs:
      public App()
          this.Suspending += OnSuspending;
      private void ChangeStartingLanguage()
          var culture = new System.Globalization.CultureInfo("fr");
          Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = culture.TwoLetterISOLanguageName;

Get the complete code

See the completed sample on GitHub: LocalizationSamples/Localization

Additional Resources

Help! I'm having trouble


If you ran into difficulties with any part of this guide, you can: