All developer Express. NET products have localized resources such as button properties, control property descriptions, menu items, acknowledgement and error information, and so on, all of these resource strings can be easily translated into various languages.
First look at the following Chinese before and after the picture:
Before the Chinese |
After the Han Dynasty |
|
|
How to achieve the above Chinese? Dev-Chinese summed up generally divided into three kinds of forms: one is to use the already Chinese good resource package, one is the use of local object classes, the use of the code to the Chinese, there is a resource bundle and code combination. Below we have a detailed explanation of the implementation methods of these three kinds of cases and their pros and cons.
First, the use of resources to Chinese
First, how to use the resource package for Chinese
First, you need to download the existing resource bundle (Resource Pack www.devexpress.com/kb=A421 by Hui du technology, download link address) will be required for the Chinese resources Zh-chs China (Simplified), ZH-CN China (China), ZH-TW China (Taiwan) Copy to the execution directory. Load a resource bundle with currentthread.currentuiculture. The reference code is as follows:
Code
1static void Main ()
2{
3 System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo ("Zh-chs");
4 Application.Run (New Form1 ());
5}
6
Ii. How to modify the resource bundle
The resource bundle has a strong-name key file strongkey.snk that is the same as the dev component. If you want to compile the resource file, you can do this as long as you have the complete source code of the component, reassign the strong key file, and get your own strongkey.snk. A specific implementation is available in the MSDN Library.
1. Copy strongkey.snk from the directory of the installed source code "program Files" Developer Express. NET vx.y "Sources" Devexpress.key " To the Devexpress.key directory of the current resource bundle. (Vx.y is the currently installed version number)
2, open the resource Package Localization.sln project, according to the use of localization methods mentioned below to find the attributes, of course, if you purchase the source code can also see the source code localization class inside the localization method listed variables to achieve your needs of the Chinese.
3. Regenerate the resource file, when the corresponding DLL will be in the DevExpress.DLL folder.
Note: Using the existing resources to use the Chinese-language is simple, the use of the most common, but because of the current Chinese resources are not complete, often modify the resource package. However strongkey.snk strong-name key files merchants could not provide, because that was their signature. If you recompile the resource bundle without your own strongkey.snk, you can only modify the resource file yourself and help recompile by using the merchant.