How to write a procedure that supports multi-language, allowing it to automatically display the appropriate text based on the op

zhaozj2021-02-08  252

Q: How to write a procedure that supports multi-language, allowing it to automatically display the corresponding text based on the running operating system. Moreover, not only to replace the Windows Standard dialog, but also automatically replace all displayed texts and all errors in the window title, buttons title.

A: Integrated Translation Environment (ITE) using Delphi 5 can easily complete this work.

We created a schematic engineering Multilanguage, put a Label and a Button on Form, assigning the CAPTION to "English Label" and "English Button".

Select Menu Project | Anguages ​​| Add ..., Delphi Displays the Add Languages ​​dialog box, select Next.

Select "English (US)" and "Chinese (China)" from the Language list, select Next.

ITE will create subdirectories based on the selected language, the directory name is the abbreviation of the language, select Next.

When the language is first added, the Update Mode is fixed to CREATE New and select Next.

Select Finish.

Delphi automatically creates resource dynamics that supports different languages.

Delphi will automatically create an engineering group, including the original Multilanguages.exe, as well as newly built two resource dynamic libraries (Multila, Multila, Multila ,uages.chs). Save the engineering group.

Delphi launches Translation Manager, the left is the language that needs to be translated, and the right side is percentage.

Choose "Chinese (China)" | Forms | Unit1, fill in the translated Chinese in the 15th and 20 lines of the right. Save and close.

Open Project Manager, compile Multilanguages.enu and Multilanguages.chs, Delphi generate a resource dynamic library in the corresponding subdirectory, but suffix is ​​not DLL but ENU and CHS.

Sun Li

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

New Post(0)