In fact, ASP. NET has integrated support for internationalization and localization, But I was studying CS a few days ago. Therefore, Microsoft's built-in multi-language support solution is not used. Instead, CS2.1 project's multi-language support solution is used as the blueprint for rewriting.
This scheme is mainly implemented by ASP. NET multi-language support components and site engineering interaction.
I. Component Engineering:
The ResourceManager object is responsible for reading resources (text), and The Ryu666Cache object is responsible for caching resource file data (with cache dependencies added ).
Ii. site engineering:
ASP. NET multi-language support components have two main responsibilities: first, provide resource files (XML) for all language versions under the ages directory under the site directory ). second, in the Web. the appSettings section in the Config file provides the default language version of the site. instructions for use:
According to the above instructions, it is quite simple to use this module. It is described in the following aspects:
1. Read resources:
Call ResourceManager where the resource text needs to be read. getString ("XXXX"), XXXX is the name attribute of the resource element in the resource file. note: It is not necessarily necessary to read resources from the site project. If you use custom controls, this component will be more effective.
2. Resource file provision:
Create the ages directory in the site project, and then click ages. xml declares all supported language versions. create a subdirectory named by the corresponding language code, and then create Resources in its own format. xml resource file.
3. Set the default site language:
Declare in the appSettings section of the Web. config file. The value must be the language code stated in the languages. xml in the corresponding language directory.
4. Custom language selection:
You can set the Session ["userLanguage"] value when you need to switch the user language. The default site language is set to a similar value. The value must be defined in the language declaration file.
To facilitate the current version, Session is used to store custom language versions. If it is used for productization, ASP is recommended.. NET 2.0 Profile manages the user's personalized language version. use this ASP. NET multi-language support components, you can easily in ASP.. NET program.
- Overview of ASP. net ajax Configuration
- Installing ASP. NET AJAX
- Analysis of ASP. NET page request principles
- ASP. NET static page four steps
- Analysis on ASP. NET authorization Module