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(,