The final version of "Delphi: Complete Chinese" (published in the 37th issue of "Home Computer", please forgive me for the new bottle!)
Xi'an Liang Ming
-------------------------------------------------- ----------------------------------
Before writing this article, I had such a dirty thought: I must not "leak" this trick to others! However, my conscience immediately told me that I must not have such an idea! So I immediately wrote it down. It can be regarded as a supplement to the last article "Delphi: Complete Chinese", and it can be regarded as a reward for my own conscience!
Now let's get to the point: As you all know, when we deal with Delphi's own messages (I refer here to all messages from Delphi itself, including Delphi system dialog boxes, exception prompts, etc.), the general approach we take is to "get ahead of Delphi" , or block the function of the system and use our own way to deal with it, in order to provide users with pure Chinese language The purpose of the environment. However, all of this can only be subjectively predicted based on the programmer's existing experience! Due to the complexity of the system and our own level limitations, the results of this will inevitably be one and the other. Problems that may occur at any time may not be solved. It is not handled thoroughly or even not handled at all. Just imagine: if some English prompts appear during the user's use, will the "grade" of your program be greatly reduced?
Therefore, we must also look for a more ideal and thorough method. At least, when bugs appear in the program, ordinary users can understand the prompts (it does not mean that you can do whatever you want). Fortunately, after the author's repeated trials, it has been Find another foolproof strategy. Please listen to me explain it below (only if your version of Delphi has the source code of VCL - that is, the professional or enterprise version):
0. Back up Delphi's VCL source code (the directory is generally "X:PRogram FilesBorlandDelphi4SourceVcl"). Of course, as needed, you can also back up only a few files we need to modify;
1. Open the BdeConst.pas, Consts.pas, BdeConst.pas, DbConsts.pas, midconst.pas, mxConsts.pas, OleConst.pas, WebConst.pas and other unit files in the VCL directory in the Delphi environment. These unit files are defined
Defines the constants used by Delphi;
2. "Translate" the string constants defined by Delphi into our great mother tongue - Chinese;
3. After the "translation" work is completed, save it according to the original file name;
4. Now let’s try our results, create a new project, deliberately write some code that will cause system prompts, and before compiling, go to the Search Path option on the Directories/Conditionals page of the Delphi Project Options dialog box and add a search Path (that is, the directory where we just modified the constant unit), confirm and exit;
5. Just watch your English translation level!
Notice:
① If your version is Delphi 3, change the above path accordingly, and Directories/Conditionals in the Project Options dialog box is Directories;
② This change to the compilation conditions is only valid for this project. It needs to be reset after creating a new project. If you want to fix it once and for all, please follow me:
Run the Windows registry editing program Regedit.exe, open HKEY_CURRENT_USER->Software->Borland->Delphi->4.0->Library, and add "$(DELPHI)SourceVCL".Ok to one of the string values for "Search path". , the purpose is achieved!
The following is the message sent by the function after the author modified the constants of the function MessageDlg in the Consts.pas unit file. This time, what we see is no longer a half-English and half-yang message box. How about it, pretty enough?
...
Begin
MessageDlg('How do you feel?'+#13#10#13#10+
'Here I translate "SMsgDlgInformation" as 'message';'+#13#10+
'The result of translating "SOKButton" as 'OK'!',
mtInformation,[mbok],0);
End;
...
****Insert Figure 4 here****
Is the above action a bit too honest?! In fact, we can customize these constants according to our own wishes (as long as Inprise agrees) to achieve a special effect. For example, we can translate "SMsgDlgInformation" to you software title or your own studio name, etc. In this way, your extraordinary personality will be fully displayed!
This is all the experience and skills the author plans to introduce about Delphi's "Complete Chinese" (I will put this whole set on my personal homepage after I explain the two programs I have, please go there then) Down). Of course, calling it "completely Chinese" makes me blush, but I really hope that Inprise will end the era of us "envying" VB programmers as soon as possible!
There are still some problems, for example: the Delphi environment is in English, the report preview prompts and buttons are also in English, etc. Regarding the first question, I personally think it is not necessary, because no programmer can even understand the menu. If you don’t understand, the goal of our efforts is users; there is also a solution to the second problem. This topic should not be covered here, but I saw many people asking this question on the Internet, so I will briefly discuss it here. Let me end this topic with:
①Develop the content of QuickRep as required;
②Imitate QuickRep’s preview mode or customize QRPreview yourself;
③Assign the QRPrinter of QuickRep to the QRPrinter of QRPreview in the OnPreview event of QuickRep
(For example, QRPreview1.QRPrinter:=Quickrep1.QRPrinter;) QRPreview can replace QuickRep
preview mode.
Moderator: Liang Ming
Date: 1999-03-01
E-mail:[email protected]