Windows 8 Localized multi-language support

Source: Internet
Author: User
Tags resource

The WIN8 platform handles localized multilingual support relatively easily, but is slightly more complex than WP8, unlike the WP8 platform, where much of the work is done with VS IDE processing, and WIN8 platform operations require developers to handle the basics. And the use of it in XAML is slightly different.

It's also important to emphasize that whether your current application needs to support multiple languages, separating your code from localizable resources into a resource file is a good coding habit.

Localized MultiLanguage configuration

Refer to the directory structure in the following figure to create the strings folder as well as subdirectories and RESOURCES.RESW resource files.

Create a resource folder for each culture that the application supports, and add a resource file called APPRESOURCES.RESW for this folder, where the resource folder is the regional language, such as: Chinese (Simplified, Chinese): ZH-CN, English: En, English (USA): en-us.

After the application is started, your localized application will implicitly load and display the resources that the culture most matches the display language of the user's phone. If there is no good match, the application will use a neutral language resource. Windows prioritizes language matching in a standard, Easy-to-understand way. For example, in order of precedence, en-us is matched in turn with en-us, en, EN-GB, and so on.

The ZH-CN/APPRESOURCES.RESW resource file is shown below:

The EN/APPRESOURCES.RESW resource file is shown below:

Use of localized resources

With respect to the way localized resources are used and WP8, here's a simple example of a quick start: Using string resources (Windows Store application using C#-vb-c++ and XAML) (Windows).

Use in 1.XAML (associating a control to a resource)

<textblock x:uid= "Greeting" text= ""/>

Each control that needs to be localized for text must be associated with the. resw file. To do this, you can use the X:uid property of the XAML element, which is associated with the Text property of the TextBox x:uid as greeting.

2. Use in the code

Windows.ApplicationModel.Resources.ResourceLoader Resloader_ = new    Windows.ApplicationModel.Resources.ResourceLoader (); Basetitle.text = Resloader_. GetString ("AppTitle");

This column more highlights: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/net/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.