Guest:
Register
|
Login
|
Member List
|
Search
|
Statistics
|
FAQ
Language
----------
Simplifed Chinese
Traditional Chinese
English
CnPack Forum
»
CnVCL 组件包
» cnpack支持对事件内容的多语言处理吗?
‹‹ Last Thread
|
Next Thread ››
Poll
Trade
Reward
Activity
Printable Version
|
Email to Friend
|
Subscription
|
Favorites
Subject: cnpack支持对事件内容的多语言处理吗?
262607zzg
新警察
UID 42652
Digest Posts 0
Credits 12
Posts 4
点点分 12
Reading Access 10
Registered 2009-6-23
Status Offline
#1
Post at 2009-6-23 16:21
Profile
|
Blog
|
P.M.
cnpack支持对事件内容的多语言处理吗?
我的代码中有很多的MessageBox,看了“CnPack多语组件帮助文档”但是在文档中未找到涉及程序代码中提示信息多语言处理。请问下高手,CnPack支持代码中的信息多语言处理吗,如果可以的话如何处理。
举个小例子:
begin
application.MessageBox('测试','测试',mb_ok);
end;
代码中MessageBox信息能和Form中的Button的Caption信息一样存到文本文件中吗?不胜感激。
Passion
(LiuXiao)
管理员
UID 359
Digest Posts
19
Credits 6838
Posts 3591
点点分 6838
Reading Access 102
Registered 2004-3-28
Status Offline
#2
Post at 2009-6-23 17:11
Profile
|
Blog
|
P.M.
这个需要手工来了。多语组件目前还没这么智能地分析字符串。
需要自行定义
var
SThisCaption: string = '测试';
然后翻译的时候,TranslateStr(SThisCaption, 'SThisCaption');
多语文件中也要手工写上:
SThisCaption=测试
262607zzg
新警察
UID 42652
Digest Posts 0
Credits 12
Posts 4
点点分 12
Reading Access 10
Registered 2009-6-23
Status Offline
#3
Post at 2009-6-23 17:31
Profile
|
Blog
|
P.M.
非常感谢!没想到才发帖这么点时间就有高手来回复。
刘啸老师,但是我这里还是有点问题。
procedure TForm1.Button1Click(Sender: TObject);
var
SThisCaption: string;
ss:string;
begin
SThisCaption :='TForm1.Button1.Caption';
ss := CnLangManager1.TranslateString(SThisCaption);
memo1.Lines.Add(ss);
end;
end.
并且在对应的文本中写上TForm1.Button1.Caption=测试
怎么取不到对应的‘测试’两个字呢?
最后还想问下
“function Translate(Src: string): string;”
和
function TranslateString(Src: string): string;
这两个方法有什么区别呢?多谢
262607zzg
新警察
UID 42652
Digest Posts 0
Credits 12
Posts 4
点点分 12
Reading Access 10
Registered 2009-6-23
Status Offline
#4
Post at 2009-6-23 18:08
Profile
|
Blog
|
P.M.
现在解决了,我看了源代码。问题出在
function TCnBaseLangManager.TranslateString(Src: string): string;
begin
if FLanguageStorage <> nil then
begin
if CurrentLanguageIndex <> FLanguageStorage.CurrentLanguageIndex then
FLanguageStorage.CurrentLanguageIndex := CurrentLanguageIndex;
FLanguageStorage.GetString(Src, Result);
end
else
Result := '';
end;
我是在调用TranslateString之前没有进行CurrentLanguageIndex的设置,多谢了。
Poll
Trade
Reward
Activity
CnPack Forum
CnPack English Forum
> CnWizards IDE Wizards
> CVSTracNT
> Announcements & Others
All times are GMT++8, the time now is 2024-11-22 06:52
Powered by
Discuz!
5.0.0
© 2001-2006
Comsenz Inc.
Processed in 0.007952 second(s), 7 queries , Gzip enabled
TOP
Clear Cookies
-
Contact Us
-
CnPack Website
-
Archiver
-
WAP
Member's CP Home
Edit Profile
Credits Transaction
Public User Groups
Buddy List
Main
Page Views
User Agents
Posts History
Top Forums
Top Threads
Post Ranking
Credit Ranking
Online Time
Team
Moderation Stats