Author: Yu Weineng
Date: 2004-Feb-18
Delphi has not provided much support for multiple languages, making it difficult to internationalize applications. When developing a cross-international application, you encounter many difficulties. The author himself participated in writing an electronic customs declaration application in early 2001. The program will be used in China, the United States, Hong Kong and Taiwan, and plans to be used in Japan and South Korea in the future. At this time, the application must be able to input text in multiple languages at the same time, and be able to input multiple languages on the same operating platform. Since I had just started using Delphi at the time, I took a lot of detours in multi-language writing. Delphi has not put much effort into multi-language development, so it is very difficult to develop multi-language programs. I have asked Borland engineers about multi-language issues before, but they were all vague. It seems that to realize this function, you can only find a way by yourself. Microsoft® Word gives me a glimmer of hope for multi-lingualism because it can input and print text in multiple languages.
Analysis: 1. In application development, if the application wants to implement multiple languages, it must use Unicode, because only Unicode can accommodate all the characters and their internal codes in the world at the same time, and can implement multiple languages on the same form. 2. It is limited by the operating platform. As mentioned above, only Unicode can solve the problem of coexistence of multiple languages, so the operating platform must use Unicode as the basic internal code. Microsoft's operating platform is only supported by Windows NT? and later versions, so the following content is mainly based on the Windows NT? kernel technology platform. As for why Microsoft Word can implement multiple languages in Windows 9x, I still don’t know what clever tricks it has come up with. Because of the inherent flaws of Windows 9x and Windows 9x will be eliminated, I don’t plan to think too much about ways to solve it in Windows 9x. There are also Probably the reason why Borland doesn't do much work for multiple languages. 3. The application's database must support Unicode internal codes. The content entered by the application will be stored in the database, so the database must use a database that supports Unicode, otherwise the stored data will not be able to read back multi-language characters (or it will take a lot of work to complete). Currently, the mainstream databases that fully support Unicode include Microsoft access 2000, SQL server 2000, and Oracle 9x. Oracle 9x must be customized and installed and the internal code must be selected as Unicode when creating the database. 4. Applications are generally divided into input interfaces and reports. In other words, the application must be able to input, display and print text in multiple languages (accommodating Traditional, Simplified, Japanese, Korean, etc.). Unicode input method for the application. Of course, the application does not have to use it. However, during testing, multiple languages must be input into the same form input cabinet to prove the feasibility of the program. Currently, the only input method that can freely convert between traditional, simplified, English, Japanese and Korean fonts is the Microsoft Pinyin input method. After analysis, the application must do the above preparations. I used: 1. Microsoft? Windows 2000 PRfessional2. Microsoft? Access database 20003. The development tool is Broand Delphi 7. 4. I used TNTComponent for interface control. It is a rewritten Delphi control to support Unicode. TNTComponent is an open source code control that everyone can use and change with confidence. You can go to: http://home.ccci.org/wolbrink to download and install (because its usage is the same as the basic control, so the usage will not be explained). 5. I use Qreport 3.6.2 for the report control, because it does not support Unicode, so I rewrote its code so that it can support multiple languages. This article provides patch code download (Http://happy.gsidc.com). (Because Qreport is a control that comes with Delphi in Delphi 5 and 6, this article assumes that readers can already use it to print reports). 6. Microsoft? Microsoft Pinyin input method. You can download it for free from the Microsoft website. (Note: If you want Japanese, etc., you need to download the language pack)3. Create a new TntForm1 and add a TntEdit input cabinet and a button. After installing TNTComponent, a.) The TntForm (Unicode) option will appear on the new page of the application. Create a new TNTFrom1 to better control Unicode. b.) A new TNT control group page will appear on Delphi's control panel. In multi-language application development, it is recommended to use controls on this type of panel wherever Unicode input or display is required. 4. Create a new report form and add a QRLabel. 5. Write the form code. Double-system TntButton1, Users report form on TntForm1 and enter the following code. 6. Test and operation results. In the program I type five language fonts. As follows: a.) The character "国" is in traditional Chinese. b.) The character "国" is in simplified Chinese. c.) The character "村" is unique to Hong Kong and is not in the traditional Chinese character library. It must be input using an input method such as Cangjie. d.) "China" is English e.) "のKindergarten ひまわり" is a Japanese font program. It turns out that the application has realized the input, display and printing functions of multi-national applications. Here is another example of reading and writing data (multiple national fonts) to the database. Download example 1