Asp. net2.0 Internationalization

Source: Internet
Author: User

The company's business needs to be carried out abroad. Therefore, the previous system had to use multiple languages, collected a lot of information from the Internet, and finally selected a relatively simple solution.

1. Open vs2005 and create a website,

First, add the configuration in the configuration file:

<Globalization culture = "auto" uiCulture = "auto"/>

</System. web>

 

Add App_GlobalResources in the asp.net folder and add "resource files", as shown in figure

  

2. Copy Resource. resx, paste it to the App_GlobalResources folder, and change the name to Resource. en-us.resx as follows:

  

3. asp: Label call

<Asp: Label ID = "Label1" runat = "server" Text = "<% $ Resources: Resource, msg1 %>"> </asp: Label>

4. asp: Button call

<Asp: Button ID = "Button1" runat = "server" Text = "<% $ Resources: Resource, msg1 %>" OnClientClick = "test ();"/>

5. js call

Alert ("<% = Resources. Resource. msg1 %> ");

6 background call

<Asp: Label ID = "Label2" runat = "server" Text = "Label"> </asp: Label>

Label2.Text = Convert. ToString (GetGlobalResourceObject ("Resource", "msg1 "));

7. Image Resources

<Asp: Image ID = "Image1" runat = "server"/>

Then in Page_Load, Image1.ImageUrl = "~ /Image. aspx? Culture = "+ Convert. ToString (Session [" culture "]);

  

   ( != Session[ c = Convert.ToString(Session[==   Page_Load( c = Request[= (System.Drawing.Bitmap)GetGlobalResourceObject(,= = 

8. Set language manually

  

Chinese english
   ( != Session[ c = Convert.ToString(Session[==   DropDownList1_SelectedIndexChanged( c = (!] =.Response.Redirect(, 

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.