C++Builder 程序员博客
19 Aug
这个问题,我从delphi版块中查到了汉化的办法(作者是StarRains(星雨)):
1. 打开文件consts.pas(在Delphi安装目录的\source\vcl下)
2. 将以下资源字符串常量的值进行改动:
SMsgDlgWarning = '警告';
SMsgDlgError = '错误';
SMsgDlgInformation = '信息';
SMsgDlgConfirm = '确认';
SMsgDlgYes = '(&Y)是';
SMsgDlgNo = '(&N)否';
SMsgDlgOK = '确定';
SMsgDlgCancel = '放弃';
SMsgDlgHelp = '(&H)帮助';
SMsgDlgHelpNone = '无效的帮助';
SMsgDlgHelpHelp = '帮助';
SMsgDlgAbort = '(&A)放弃';
SMsgDlgRetry = '(&R)重试';
SMsgDlgIgnore = '(&I)忽略';
SMsgDlgAll = '(&A)全部';
SMsgDlgNoToAll = '(&o)全不';
SMsgDlgYesToAll = '(&A)全是';
—- 经过这样改动后,对应按钮的热键仍然可以使用。
3.打开文件dialogs.pas(在Delphi安装目录的\source\vcl下)
4.查到ButtonCaptions:
把 ButtonCaptions: array[TMsgDlgBtn] of Pointer = (
@SMsgDlgYes, @SMsgDlgNo, @SMsgDlgOK, @SMsgDlgCancel,
@SMsgDlgAbort,@SMsgDlgRetry, @SMsgDlgIgnore, @SMsgDlgAll,
@SMsgDlgNoToAll, @SMsgDlgYesToAll, @SMsgDlgHelp);
改为
ButtonCaptions: array[TMsgDlgBtn] of string = (
'是', '否', '确定', '取消', '退出','重试', '跳过',
'所有', '全不', 'YesToAll', '帮助');
把 LoadResString(ButtonCaptions[B]) 改为ButtonCaptions[B]
(注意共有二处)
5. 修改后编译生成dialog.dcu、consts.dcu文件。
6. 将dialog.dcu、consts.dcu文件拷贝到..\delphi6\lib目录下。
但我只要在项目中加入dialog.pas编译,就会出错!编译consts.pas倒是没问题。我用的是C++ Builder 5。
有哪位朋友试成功的吗?如果试成功的话,能否将编译好以后的dialog.dcu和consts.dcu寄给我?第一个寄给我的朋友,将得到最多的分数!进来顶贴的人也有分。我的电子邮件是puma66@sina.com
我的做法是:
1、将BCB目录下的dialogs.pas拷贝一份到你的源程序目录中,然后,修改源程序目录下的dialogs.pas文件,将ButtonCaptions改为中文,
2、运行BCB,打开你的软件project,击Project菜单的Add to project菜单项,在对话框的文件类型,选择Pascal unit(*.pas),然后将修改后的dialogs.pas添加入你的的软件porject。
3、编译你的程序,OK!
不用这么麻烦的
仅仅修改 dialogs.pas 即可
resourcestring {下面为增加的代码 仅仅修改三个}
SMsgDlgYes1 = '(&Y)是';
SMsgDlgNo1 = '(&N)否';
SMsgDlgOK1 = '(&O)确认';
var {原来的代码}
Captions: array[TMsgDlgType] of Pointer = (@SMsgDlgWarning, @SMsgDlgError,
@SMsgDlgInformation, @SMsgDlgConfirm, nil);
IconIDs: array[TMsgDlgType] of PChar = (IDI_EXCLAMATION, IDI_HAND,
IDI_ASTERISK, IDI_QUESTION, nil);
ButtonNames: array[TMsgDlgBtn] of string = (
'Yes', 'No', 'OK', 'Cancel', 'Abort', 'Retry', 'Ignore', 'All', 'NoToAll',
'YesToAll', 'Help');
ButtonCaptions: array[TMsgDlgBtn] of Pointer = ( {仅仅修改三个Caption 如SMsgDlgYes1}
@SMsgDlgYes1, @SMsgDlgNo1, @SMsgDlgOK1, @SMsgDlgCancel, @SMsgDlgAbort,
@SMsgDlgRetry, @SMsgDlgIgnore, @SMsgDlgAll, @SMsgDlgNoToAll, @SMsgDlgYesToAll ,@SMsgDlgHelp);
将 dialogs.pas 加入 Project,修改 Options
不选择 Build With Runtime Packages
我也不是很清楚 dialogs.pas 的代码已经被编译到哪个 BPL 中的
TO nikita2000,我按照你的方法成功地编译了dialogs.pas,然后将重新编译后的dialog.dcu和consts.dcu拷入到
C:\program files\Borland\CBuilder5\Lib\Obj下,覆盖原文件,但还是不行,MessageDlg中的按钮还是显示英文,不知问题出在哪里?你改了以后,能显示中文吗?
搞定!受Behard 的启发,原来编译时要不选择 Build With Runtime Packages 才行。
貌似來晚了?