Multilingual support in .NET Framework

zhaozj2021-02-16  96

Multilingual support in .NET Framework

Title: .NET Framework multi-language support implementation Keywords: .NET multilingual Author: dREAMtHEATER Difficulty: Normal [x] Medium [] High [] http: //dREAMtHEATER.yeah.netE-Mail: NoteXPad@163.com Date: August 02, 2004, Foreword once remembered the era of win32's native code programming. In order to achieve a multilingual interface, the brain juice, so a lot of tutorials teach you how to make the program to implement multi-language support, these The technical level of implementation methods is uneven, it is difficult to find a good framework to achieve in business programs. The arrival of the .NET era, we suddenly found that all this is so simple, you can make your program perfect multi-language support. I don't want to explain the concepts of excessive explanation here because MSDN has provided us with a fully localized technical documentation. Text I use Visual C # .NET in Visual Studio 2003, this Demo I design can automatically realize the localization of current zone settings, but also manually change the interface language and realize local local locations. . Demo Source Code Download here. Please follow my steps:

Create a new Windows application called "Multilanguage". In the Properties window, set the localizable property of the form to True. The Language property is set to (default). Drake MainMenu, PictureBox, dragged from the "Windows Form" tab of "Toolbox" to the form, then set up the layout, design of these controls in the DEMO form. Set the list of the list to "Chinese (People's Republic of China)." Re-press the layout and design of the Chinese interface of these controls in the DEMO form. Click the "Show All File" buttons in the Solution Explorer. The resource file appears below Form1.cs. Form1.resx is a backup regional resource file that will be generated to the main assembly. Form1.en-cn.resx is a resource document of Simplified Chinese in China. Generate the Click event of the menu item separately, follow the implementation code I am in Demo to the event processing section. Everyone is primarily learning how I dynamically modify all the language-related elements on the interface, including strings, objects (such as PictureBox.image). Click Add New Item on the Project menu. Select the "Spring Resource File" template in the Template box. Type "Winformstrings.resx" in the Name box. The winformstrings.resx file will contain English backup resources. These resources will be accessed whenever the application is not more suitable for the UI regional resource. This file is added to the project in the Solution Explorer and is automatically opened in the XML designer. Select "DATA" in the Dataset pane. In the "Data" pane, click Block and Enter "StrMessage" in the "Name" column, enter "Hello World" in the Value column. On the File menu, click Save WinFormStrings.resx. Perform two steps 8-12 to create a resource file called "winformstrings.en-cn.resx", and this file has the string resources specified in the table below. The winformstrings.zh-cn.resx file will contain resources specific to China's English-speaking.

Resource file name namevaluewinformstrings.zh-cn.resxStrMessage Hello! world

转载请注明原文地址:https://www.9cbs.com/read-10995.html

New Post(0)