ASP. net2.0 learning 9-Internationalization

Source: Internet
Author: User

Internationalization:

1.Global Resource file

You can set internationalization for all pages.

App_globalresourcesThe folder must contain the following resource files:

Resource. resx

Resource. zh-CN.resx

Resource. En. resx

For Information Descriptions of different country languages, we canResource. zh-CN.resxDefine the following content

BtsaveThe value is "save"

BtcancelThe value is "canceled"

InResource. En. resxThe file is defined as follows:

BtsaveThe value is"Save"

BtcancelThe value is"Cancel"

 

Then, we marked the following in the page:

 <ASP:Button ID= "Btsave" Runat= "Server" Text="<%$ Resources: resource, btsave%>"> </ASP:Button>

<ASP:Button ID= "Btcancel" Runat= "Server" Text="<%$ Resources: resource, btcancel%>"> </ASP:Button>

 

At the top of the pageUicultureSetAuto,Resource file search is automatically performed for the current language of the browser.

If the browser is Chinese, the above button prompts are "save" and "cancel"

If the browser is English, the above button prompt is displayed as"Save","Cancel"

 

<%@ Page Language= "C #" Autoeventwireup= "True" Uiculture= "Auto" Culture= "Auto" Codefile= "Login. aspx. cs" Inherits= "Login" %>

 

2.Local resource file

InApp_localresourcesIn the folder, resource files in different languages are defined, but the resource file name must be the same as the page name and can only be set to internationalization for a single page:

For exampleLogin. aspx,The resource file is:

Login. aspx. resx

Login. aspx. zh-CN.resx

Login. aspx. En. resx

In fact, the application is the same as above

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.