Windows 10 Development Localization - Windows 10 Development

What is Windows 10 Development Localization?

Windows is used worldwide, in a variation of different markets and for the target audiences that vary in culture, region, or language. Localization is the conversion of application resources into localized versions for the exact cultures that the application supports.

When you grow any application in merely one language, it means you are just restricting your business and customers. If you need to increase your customer base, which will also upsurge your business, then your application must be accessible and reachable globally. Cost-effective localization of your product is one of the best and most inexpensive ways to reach more customers.

In Windows 10, localizable applications are very easy to create with resx file, which is the simplest solution for localization.

Let us understand this with the help of a simple example by following all the below mentioned steps.

Translating UI Resources

You can put string resources for your UI into resource (resw) files in its place of putting them openly in code or markup, and then you can reference those strings from your code or markup. Follow the steps given below to add strings to the resource files.

  • Create a new Universal Windows Platform (UWP) application.
  • In the Solution Explorer, right-click the project and select Add > New Folder.

app_localization

  • Alter the name of the new folder to "Strings".
  • Right-click the Strings folder and add a new folder with the name "en-US". These are naming conventions specific to a language and country/region name, and it can be found on National Language Support (NLS) API Reference msdn.microsoft.com page.
  • Right-click on the en-US folder and select Add > New Item….

app_localization_sec

  • The resulting dialog will open.

app_localization_thi

  • Select "Resources File (.resw)" and Click the Add button.
  • Now let us go to the XAML file and add a Hub control with some properties as shown below.

  • x:Uid = "HubControl" are the identifiers that are used for localization
  • Now, when the above code is compiled and executed, you will see the following window.

All the data related to the Hub such as the Header, the Foreground and the background color are set in the XAML.


app_localization_bg

  • Now add some of the information in Resource.resw file in the Strings/en-US folder as shown below.

app_localization_add_name

  • You want to associate every control that needs localized text with the .resw file. You can do this by using the x:Uid attribute on your XAML elements like this −
    • x:Uid = "HubControl" is used in resw file to assign a string for the header, foreground and background color.
  • Currently, when you compile and execute your application on an emulator, you will see the resulting window. You can see that the header, foreground and background color values are picked from the Resources.resw file.

app_localization_bgcolor

  • You can add other Resource.resw files for other languages such as French, German, and Japanese etc. manually; as we did for English-US, but Microsoft also provides a Multilingual App Toolkit with the help of which, you can easily translate your Resource.resw in to other languages.
  • Go to the Tools > Extensions and Update menu and search the Multilingual app toolkit.

app_localization_multi_app

  • Download and install this toolkit. Once installation is finished, restart Visual Studio and open the same project.
  • Now enable this toolkit from the Tools > Multilingual App Toolkit menu option.

localization_multi_app_tool

  • Now you can add translation for other languages.
  • Right Click on the project in the Solution Explorer and select Multilingual App Toolkit > Add Translation Languages option from the menu.

multi_app_toolkit_add

  • The resulting Translation Languages dialog will open. You can select any language you want, to localize your application for those cultures.

localization_translation_lang

  • Let us select German language and click the OK button.

localization_german_lang

  • You can also see that the Resources.resw file is created inside the folder Strings\de.
  • Now, you will see that another MultiLingualResources is added inside the *.xlf file. Double click on this file, which will open the Multilingual editor to check and verify the translated strings and make some changes if needed.

localization_multilingual_editor

  • Create the changes and verify whether the Background color has changed to brown and the Header text is properly translated to German.
  • As in the overhead instance, the background color of Hub has altered from blue color to brown and the foreground color has remained same.
  • Currently open the Resources.resw, which is inside the Strings\defolder.

app_localization_str

  • You can see that only two strings are mentioned here, since we have not altered the foreground color on the multilingual editor.
  • To check the localized version of your application, change the culture of your machine. To change the culture of your machine follow the steps given.
  • Let us go to the PC settings and select Time & Language.

localization_pc_set_time

  • From the left pane, select Regions & language and click on the Add a language.

localization_region_lang

  • Select Deutsch German language as shown above which will open another dialog.

localization_deutsch_german
Now select the German (Germany) and close this dialog box.

localization_german

  • Make Deutsch as the default language.
  • Currently execute your application, it will display the resulting window.

localization_execute

  • Currently you can see the output of your application in German language.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Windows 10 Development Topics