The use of INI file in Delphi to achieve the interface without flashing multiple language switching

Source: Internet
Author: User
Tags ini

More and more programs use a multi-language switch, although the Delphi with the addition and configuration of multiple language packages, but that way in the switch language interface will appear flashing, and to achieve a very troublesome, here I introduce you to the use of INI file to read the interface of the language text, with this method, not only simple, And there is no flicker of the interface when switching.

Let's start with an example to see how to implement a language switch. First, a new project is established. Place the following components:

MainMenu1: TMainMenu;
File1: TMenuItem;
Exit1: TMenuItem;
Label1: TLabel;
Button1: TButton;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
Button2: TButton;
Label2: TLabel;
ComboBox1: TComboBox;
Label3: TLabel;

Because you want to read the INI file, add the declaration inifiles to the uses, and then set the Showhint property of Button1 and Button2 to True, where we use ComboBox1 to display the language that is available and to select the language.

We edit the following Chinese GB in the directory of the program. INI file:

;
;
; 翻译的一些规则:
; 翻译前,拷贝 Chinese GB.ini 改名到 yourlanguage.ini
; 仅仅翻译符号'='后的文字
;
[Translations]
;
Label1.Caption =文字1
Label2.Caption =文字2
Label3.Caption =语言
Button1.Caption =按钮1
Button2.Caption =按钮2
Button1.Hint =按钮1_提示
Button2.Hint =按钮2_提示
CheckBox1.Caption =复选框1
CheckBox2.Caption =复选框2
File1.Caption =文件
Exit1.Caption =退出
;
[Messages]
;
M1 =信息框测试
;
;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.