Localized Apps for Windows Phone 8.0

If you want your app to be used by millions, localize it. In countries like India, it is a must have feature. Think about having an app allowing farmers to sell their produce directly to the customers. In such scenario, many farmers don’t know English and are used to, to their native language. It doesn’t make any sense to build an app which can’t communicate and relate with them. Rather, having an app in their own language can help boost the productivity, sale and profit. Lets see how we can build such apps.

Normally, we use resource files to store strings and various resources pertaining to different locals. To help building such resources for different locals, Microsoft has provided Multilingual App Toolkit. Download and install the toolkit from here

Lets start with building a Windows Phone application, which will welcome users in their own language. For the sake of understanding, we’ll keep it simple, one page app. The design will look like the one as shown below:

image

For this, I’ve modified the code as shown below:image

To have text for both English and Hindi languages, lets first add a text for English in ‘AppResources.resx’ file under ‘Resources’ folder. After adding text, it should look like:

image

You can add as many resources as you want to have it displayed on the screen.

Now, to enable multilingual features (Hindi in our case), if you’ve installed the toolkit then from ‘Tools’ menu click on Enable Multilingual App Toolkit.

image

Now to add support for Indian language, right click your project and click on ‘Add translation languages’. This will bring following dialog. Select ‘Hindi’ and click on ‘OK’. Note: You can select as many languages as you want. So, your app can show data to any user in their own language supported by toolkit. :)

image

It will add another file named ‘AppResources.hi-IN.xlf’ in Resources folder (for each language selected above). Double click that file to open the toolkit. In this dialog, resource file for Hindi, will be already populated with content similar to AppResources file.

image

On this screen, click on ‘Translate’ > ‘Translate all’. It will automatically translate all the texts which can be translated. If anything fails, you can manually change it.

image

Now save the file and come back to Visual Studio.

Even though, we’ve added resource strings for English and Hindi, we haven’t bind it to actual text control. Modify the text control with following code:

image

This code, at runtime, binds the textblock to text in selected language’s resource file.

After this, first, try the app using default language i.e. English. When you run the app in emulator, it will look like:

1

Here, app shows text ‘Welcome friend’ in English. At this point, change the language and local to Hindi, India to test the app in Hindi language. To do this, go to Settings > Language+Region and change it to India with following setting.

1.2

Here, you may need to restart the phone. After restart, deploy the app again and you should see the following screen:

2

This is just the beginning of multilingual app. You can add as many languages as you want. And not just text, you can add any type of resource (image, icons sound, etc…) in your resource files.

By building multilingual apps, you can reach more users. This means more money and a successful app. Hope this helps.

Refer:

Cheers,

Mayur Tendulkar

Advertisements

Published by

Mayur Tendulkar

Working as a Program Manager for Xamarin in Microsoft. More details at: https://about.me/tendulkar

One thought on “Localized Apps for Windows Phone 8.0”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s