Sep 262014
 
 September 26, 2014  Posted by at 11:30 am Universal Apps, WinRT  Add comments
resources and assets winrt23

With 191 markets and 54 languages we really should think about the localizing our application, as well as providing images for scaling and contrast. This article shows the following:

  • Using resource strings in XAML
  • Using resource strings in XAML for styles
  • Using resource strings in code

Covered in part 2: (tomorrow)

  • Using resource images
  • Setting images for scaling
  • Localizing the app name and description

Using resource strings in XAML

resources and assets winrt21

Declare a textblock (for example) and set the x:UID attribute to the resource string

Create a folder, inside it a folder for each locale. Use the BCP-47 language tag for folder name

resources and assets winrt4

Set default language to one of the language tags- this is what the app will default to

Create a .resw for each language and add the resource string name from earlier with a .Text extension if that is what you want to set on the element.

2014-09-25_13-18-42

Run the application.

resources and assets winrt35

resources and assets winrt3

To test the languages go to Control panel, Languages and swap the order of the languages

resources and assets winrt33

resources and assets winrt34

resources and assets winrt2

Using resource strings in XAML for stylesresources and assets winrt3

As before, but this time set the colorbrush and use it in a style

2014-09-26_19-16-42

Use the .Color extension for color

resources and assets winrt8

resources and assets winrt37

Using resource strings in code


resources and assets winrt23resources and assets winrt2 resources and assets winrt3

Create an element, set either a x:Name to access it in code behind or use bindings with change propagation (INotifyPropertyChanged implementation)

Declare the resource in the .resw file, without any extension

Use the resource loader to get the resource value

  2 Responses to “Localizing a Universal Store App part 1”

  1. Iris, for a better app localization management I recommend using a specialized translation platform that facilitates collaborative work, such as https://poeditor.com/
    I mention POEditor because it is integrated with Github and Bitbucket, and this can speed up the localization process a lot for those who use these code hosting sites.

  2. Hi, there is any way to see this properties in the designer view

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

What is 7 + 8 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)