Windows 8 application resources and Localization

Source: Internet
Author: User
Application Program Resource and localization example this example shows how to use application resources to separate the content that can be located from the application Code . This example uses Windows. ApplicationModel. Resources. Core and window. Global namespace and winjs. Resources. Developers are encouraged to extract resources, such as strings and files from their application code, so that they can maintain and modify them independently. The Application resource API allows developers to apply them to a variety of devices, systems, and user configurations. They enable applications to be localized to multiple languages, Customize various device DPIs and forming factors, and target specific types of users. Void Scenario7button_show_click ( Object Sender, routedeventargs E)
{
String Currentlangvalue;
String Currentscalevalue;
String Currentcontrastvalue;
ResourceManager. Current. defaultcontext. qualifiervalues. trygetvalue ( " Language " , Out Currentlangvalue );
ResourceManager. Current. defaultcontext. qualifiervalues. trygetvalue ( " Scale " , Out Currentscalevalue );
ResourceManager. Current. defaultcontext. qualifiervalues. trygetvalue ( " Contrast " , Out Currentcontrastvalue );
This . Scenario7textblock. Text = " Current qualifier value-language: " + Currentlangvalue + " , Scale: " + Currentscalevalue + " , Contrast: " + Currentcontrastvalue;
This . Scenario7textblock. Text + = " \ R \ n " ;
This . Scenario7textblock. Text + = ResourceManager. Current. mainresourcemap. getsubtree ( " Dimensions " ). Getvalue ( " Multidimensional " ). Tostring ();

ResourceManager. Current. defaultcontext. qualifiervalues. mapchanged + = async (S, m) =>
{
ResourceManager. Current. defaultcontext. qualifiervalues. trygetvalue ( " Language " , Out Currentlangvalue );
ResourceManager. Current. defaultcontext. qualifiervalues. trygetvalue ( " Scale " , Out Currentscalevalue );
ResourceManager. Current. defaultcontext. qualifiervalues. trygetvalue ( " Contrast " , Out Currentcontrastvalue );

Await This . Scenario7textblock. Dispatcher. runasync (coredispatcherpriority. Normal, () =>
{
This . Scenario7textblock. Text = " Updated qualifier value-language: " + Currentlangvalue + " , Scale: " + Currentscalevalue + " , Contrast: " + Currentcontrastvalue;
This . Scenario7textblock. Text + = " \ R \ n " ;
This . Scenario7textblock. Text + = ResourceManager. Current. mainresourcemap. getsubtree ( " Dimensions " ). Getvalue ( " Multidimensional " ). Tostring ();
});
};

}

Complete example:/files/risk/windows8/Application resource and externalized sample.rar

Related Article

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.