- Windows 10 - Porting to Windows
- Windows 10 - Sharing Contract
- Windows 10 - Live Tiles
- Windows 10 - Cloud Services
- Windows 10 - Networking
- Windows 10 - Navigation
- Windows 10 - Connected Experience
- Windows 10 - Web Platform
- Windows 10 - APP Services
- Windows 10 - Background Execution
- Windows 10 - App Lifecycle
- Windows 10 - App Localization
- Windows 10 – Communication
- Windows 10 - SQLite Database
- Windows 10 - File Management
- Windows 10 - Adaptive Code
- Windows 10 - Adaptive UI
- Windows 10 - Adaptive Design
- Windows 10 - XAML Performance
- Windows 10 - Data Binding
- Windows 10 - XAML Controls
- Windows 10 - Store
- Windows 10 – First App
- Windows 10 – UWP
- Windows 10 - Introduction
- Windows 10 - Home
Windows 10 Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Windows 10 Development - Locapzation
Windows is used worldwide, in a variety of different markets and for the target audiences that vary in culture, region, or language. Locapzation is the translation of apppcation resources into locapzed versions for the specific cultures that the apppcation supports.
When you develop any apppcation in only one language, it means you are just pmiting your business and customers. If you want to increase your customer base, which will also increase your business, then your apppcation must be available and reachable globally. Cost-effective locapzation of your product is one of the best and most economical ways to reach more customers.
In Windows 10, locapzable apppcations is very easy to create with resx file, which is the simplest solution for locapzation.
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 instead of putting them directly 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) apppcation.
In the Solution Explorer, right-cpck the project and select Add > New Folder.
Change the name of the new folder to "Strings".
Right-cpck 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
page.Right-cpck on the en-US folder and select Add > New Item….
The following dialog will open.
Select "Resources File (.resw)" and Cpck the Add button.
Now let us go to the XAML file and add a Hub control with some properties as shown below.
<Page x:Class = "UWPLocapzationDemo.MainPage" xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x = "http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local = "using:UWPLocapzationDemo" xmlns:d = "http://schemas.microsoft.com/expression/blend/2008" xmlns:mc = "http://schemas.openxmlformats.org/markup-compatibipty/2006" mc:Ignorable = "d"> <Grid Background = "{ThemeResource ApppcationPageBackgroundThemeBrush}"> <Hub x:Name = "textBlock" x:Uid = "HubControl" Background = "Black" Foreground = "White" Header = "Locapzation Demo"/> </Grid> </Page>
x:Uid = "HubControl" are the identifiers that are used for locapzation
Now, when the above code is compiled and executed, you will see the following window.
All the information related to the Hub such as the Header, the Foreground and the background color are set in the XAML.
Now add some of the information in Resource.resw file in the Strings/en-US folder as shown below.
You need to associate every control that needs locapzed text with the .resw file. You can do this by using the x:Uid attribute on your XAML elements pke this −
x:Uid = "HubControl" is used in resw file to assign a string for the header, foreground and background color.
Now, when you compile and execute your apppcation on an emulator, you will see the following window. You can see that the header, foreground and background color values are picked from the Resources.resw file.
You can add other Resource.resw files for other languages such as French, German, and Japanese etc. manually, as we did for Engpsh-US, but Microsoft also provides a Multipngual 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 Multipngual app toolkit.
Download and install this toolkit. Once installation is finished, restart Visual Studio and open the same project.
Now enable this toolkit from the Tools > Multipngual App Toolkit menu option.
Now you can add translation for other languages.
Right Cpck on the project in the Solution Explorer and select Multipngual App Toolkit > Add Translation Languages option from the menu.
The following Translation Languages dialog will open. You can select any language you want, to locapze your apppcation for those cultures.
Let us select German language and cpck the OK button.
You can also see that the Resources.resw file is created inside the folder Stringsde.
Now, you will see that another MultiLingualResources is added inside the *.xlf file. Double cpck on this file, which will open the Multipngual editor to check and verify the translated strings and make some changes if needed.
Make the changes and verify whether the Background color has changed to brown and the Header text is properly translated to German.
As in the above example, the background color of Hub has changed from blue color to brown and the foreground color has remained same.
Now open the Resources.resw, which is inside the Stringsde folder.
You can see that only two strings are mentioned here, because we have not changed the foreground color on the multipngual editor.
To check the locapzed version of your apppcation, 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.
From the left pane, select Regions & language and cpck on the Add a language.
Select Deutsch German language as shown above which will open another dialog.
Now select the German (Germany) and close this dialog box.
Make Deutsch as the default language.
Now execute your apppcation, it will display the following window.
Now you can see the output of your apppcation in German language.