ASP. NET (4): Multilingual Solutions

Source: Internet
Author: User

Note: There are only two solutions listed here to facilitate your memory.

1. A language design scheme defined using traditional resource files. For details, refer to Microsoft msdn.

2. Round Robin. The specific implementation is as follows.

1) Two database or file design columns: name1 and name2;

2) define the function for obtaining resources. Res. getstring (string name1_info)

3) The following calls res. getstring ("hello") for all the multilingual processing involved ");

4) Implementation of the res. getstring Function

 

Public static string getstring (string name1_info)
{
If (current language = "zh_cn ")
{
Return name1_info;
}
Else
{
// Obtain data from the database
VaR STR = dB. Table. Select (P => P. name1 = name1_info). firstordefault ();
If (STR = NULL)
{
// Write the current value to the database if no value is found
DB. Table. insert (name1_info ,"");
STR = name1_info;
}
Return STR;

}
}

 

5 ).ProgramAfter running for a period of time, implement name2 translation based on the database name1.

 

 

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.