How many of you want to have your Windows Phone application downloaded across the globe and get popularize. This is a question that comes to everyone mind that will my app will be downloaded and used in all the country. Yes the answer to the question will be yes unless if you Localize your application, ok now the question is what is Localization. In simple terms Localization is the process of translating a product into different languages or adapting a product for a specific country or region.
Ok now we got the solution, that we can localize to multiple languages and deploy the application to different markets so we have maximum downloads. But to have the application available in multiple geolocation for different languages we need to understand the language and assign the appropriate values to get loaded which is practically impossible. To over come this scenario Microsoft released a new toolkit called “Multilingual App Toolkit” which is an extension to Visual Studio integration, but need to manually download and install as it will not be available by default with Visual Studio.
Let us see the steps which makes your life easy to Localize a Windows Phone app with the help of Multilingual App Toolkit
Steps:
Step 1 – Download “Multilingual App Toolkit” from Microsoft and install in the development environment where Visual Studio is installed (Keep in mind that VS should be closed before you start the installation)
Step 2 – Open the application which needs to be localized or create a new application with Visual Studio.
Step 3 – In the application just identify the controls that are to be localized and add the resources in the resource file as shown in the screen below.
Step 4 – Now go to the Xaml page and change the code to bind the value from the resource file. In this example we will take the title and assign the welcome message to the application and localize that as well as shown in the code below.
Code:
<TextBlock Text=”{Binding Source={StaticResource LocalizedStrings}, Path=LocalizedResources.Title}” Margin=”9,-7,0,0″ Style=”{StaticResource PhoneTextTitle1Style}”/>
Step 5 – Navigate to Visual Studio Tool menu and click on Enable Multilingual Toolkit option which will basically add a file to the resources folder and assign few options, if you see the option is not enabled restart the Visual Studio once again and you can see the option as shown in the screen below.
Step 6 – Now you can see the Multilingual App Toolkit is enabled and a file added to the Resources folder by default. Lets delete that file and right click on the project and click on Add Translation languages to select the list of languages that are required for our app as shown in the screen below.
Step 7 – Clicking on Add Translation Languages option will open a popup which has the list of languages with the culture information. You can select as much as you want, but be clear on the market and the requirement as all the market will have option to be on English as well. In this example lets consider using the traditional Hindi and one more foreign language as french as shown in the screen below.
Step 8 – Click on OK and we can see 2 files added to the resources folder with the names AppResources.fr.xlf and AppResources.hi-IN.xlf. Open any of the files and you can see the list of resources that are used in the initial resource in English will be available as shown in the screen below.
Step 9 – If you are familiar with the language you can edit the translation section directly, since most of the languages are not common we can use the Machine generated language which matches to the exact word. At the background it uses the BING API to translate the language and get the nearest match. To get that done close this window and go to the file in resources folder right click and click on “Generate Machine Translations” as shown in the screen below.
Step 10 – We can see a progress window and and you can see the content is translated to the language that is selected in the culture (in our case its Hindi) and note that you need to connect with Internet as the Tool Kit connect to the Bing API and do the conversion as shown in the screen below.
Now we are done build and execute the application and make sure if you use the emulator go to setting and change the phone language to Hindi and you can see the app automatically changes the Title to Hindi and if you change to french language it automatically changes the title to french language as shown in the screen below.