Recently, many people have asked ASP. NET How to Implement International (multi-language) support. Some time ago, I made such a component and published it here in the spirit of "everyone for me, everyone for me.
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 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:
There are two main responsibilities: first, provide resource files (XML) in all Languages 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. resource reading: Calls 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 in the 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 the site language in the appSettings section of the Web. config file. The value must be the language code declared by AGEs. xml in the corresponding language directory.
4. custom language selection: Set the Session ["userLanguage"] value where you want to switch the user language. similar to the default site language, the value must be defined in the language declaration file.
To facilitate the demonstration, Session is used to store custom language versions. We recommend that you use the Profile of ASP. NET 2.0 to manage your custom language versions.
Because this component is not a product, the function can not be considered complete, only for the purpose of sharing. You can continue to develop on this basis, also welcome to leave a message (http://Ryu666.cnblogs.com ).
Download link: http://files.cnblogs.com/ryu666/multi-language support .rar