Multi-language features using Reponse.filter in asp.net

Source: Internet
Author: User

For Web systems with Cross-border operations, multilingual functionality is generally required. However, in many multi-language solutions, such as. NET resource, it will increase the burden of programmers in the development of the program, not easy to develop:

1. Multiple languages, such as the control binding of ASPX, JS script, CS Code, procedure, and so on, these multi-language implementations are different, aggravating the development difficulty.

2. In order to implement multilingual code, it is strongly coupled with the code that obtains language languages, which is inconvenient to expand and maintain. such as. NET's resource way a label implements multiple languages:

Lblname.text = Resources.Strings.name;

3. When developing and maintaining programs, programmers must simultaneously open source code and multilingual resource files, especially when multiple people are developing, sharing a multilingual file, and being difficult to handle and synchronize shared text.

These are simply a list of the traditional multilingual development of the obsession, then how to solve these problems, easy to achieve multilingual features?

I remember someone who said that Web programming is actually string processing.

Why, then? Because the web is actually the request and the response, the request and the response are strings. In our various programs, the final output to the browser is the HTML format of the string, so as long as we unified in the last step of the program output HTML format, we can identify the need for multilingual conversion of text, it is replaced by the current set language version of the text.

In ASP.net, because there is a response.filter attribute, it makes all the easier.

What is Response.filter?

Simply put, after layers of conversion, the final asp.net to output HTML, in the process of output, is the HTML into a pipe (pipeline), and then in the pipeline to the end of the HTML to be sent to the client response, asp.net provides the Response.filter property so that you can convert the HTML that you pass through accordingly.

So as long as the multilingual conversion function is placed here and the "Chinese" is recognized, it can be done by converting it to the corresponding language user setting.

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.