[C #. Net] C # create a multilingual website

Source: Internet
Author: User
1. Here are some simple examples extracted from the book, but they are similar and should be generic. Record...
2. In the design view of the page where multiple languages need to be added, select "tool" -- "generate localization resource ".
(In solution Resource Manager, app_localresources is the generated local resource file)
A default. aspx. resx file is added to app_localresources,
To create a multilingual website, we need to create two copies for default. aspx. resx for different languages (default. aspx. en-us.resx and default. aspx. zh-cn.resx)
Then, replace the corresponding values in the two replicas with the corresponding language values.
3. Now you can test the multi-language function.
On the IE browser, select "tool" -- "Internet option" -- "General page" -- "language" to set the corresponding language. Open the corresponding page to see if it is the language you selected.
4. After using localization resources, the page will be added at the top of the source code
Culture = "Auto" meta: resourcekey = "pageresource1" uiculture = "Auto"
The Web. config file can be used to set the global application for the whole site (similar to the topic setting ),
Add the following nodes to <system. Web> in the web. config file.
<Globalization culture = "Auto" uiculture = "Auto"/>
5. Access Local resources programmatically
If the user control to be accessed uses the resource file, we need to read the text in the control from the resource file:
Add the following code to the user control:
Public String sbtnlogin
{
Get {return (string) base. getlocalresourceobject ("btnloginresource1.text ");}
Set {txtuserid. Text = value ;}
}
Add response. Write (userlogin1.sbtnlogin) on the page );

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.