怎样制作多语言版本(100分)

T

TourAn

Unregistered / Unconfirmed
GUEST, unregistred user!
各位大侠,软件开发完成以后(简体中文),有什么简单的办法把它作成多语言
的版本,如繁体,english版本?
 
Borland Translation Suite
  这是Delphi 5包含的一个国际化和本地化工具,它能帮助用户同时开发多语言版本,管理和维护各种资源的翻译代码,从而加速产品的国际化开发步伐。现在利用Delphi 5开发的系统可以在世界范围内应用,帮助用户开拓全新的世界范围内的市场。
 
用Dll最好的。不同的语言加载不同的Dll。:)[:)]
 
用Multi什么控件比Delphi的国际化工具好
 
好象没有什么捷径,最好程序开发时所有用以显示的字串,放在资源里,有多个语言版本
然后在不同的选项下显示不同的语言
 
做资源文件
 
有一个很好用的控件
 
借宝地一用∶
TO 我是帅哥:
能否把你好用的控件共产 )-:
CHINA_PENG@163.COM
 
有没有 ,向flash get 那样 可
 
以上大家所說的都各有所長﹐但都不是很有效﹐或都說不方便吧
 
用Borland Translation Suite很方便,我就是用它实现多语言的(English,繁体(台湾)
和简体中文),不过很辛苦,其实如楼上几位说的,就是用资源文件的做法。
你也可以参考一个foxmail的做法,它的Chinese.LGB文件(ver 3.11)就相当一个资源文件
通过它来选择程序的语言。
 
[blue]用动态库是最好不过的,不同的语言就加载不同的动态库![/blue]
 
INI文件最方便。
 
看看officeXp是怎么做的
 
资源
字符串和图形都做成资源
 
不用那么麻烦吧
D6可以自动生成多语言版本,好好看看IDE的说明,
真的
我做过,非常方便
 
一个多语言的单元
unit janLanguage;
{ This component is an orginal component created 17-october 1999 by Jan Verhoeven
and is offered as freeware for free use in any application including commercial applications.
You are free to copy and modify the source code
provided youdo
not remove this comment.
email:
jan1.verhoeven@wxs.nl
website:
http://members.xoom.com/JanVee/jfdelphi.htm
}

interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,TypInfo,Inifiles;
type
TjanLanguage = class(TComponent)
private
LanguageFile:string;
procedure LoadLanguage(AForm: TForm;
Afile: string);
procedure SaveLanguage(AForm: TForm;
Afile: string);
function appldir: string;
function inifile: string;
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
procedure InitLanguage(AForm:TForm);
procedure ChangeLanguage(AForm:Tform);
published
{ Published declarations }
end;

procedure Register;
implementation
const
cr = chr(13)+chr(10);
tab = chr(9);
procedure Register;
begin
RegisterComponents('Jans 2', [TjanLanguage]);
end;

function TjanLanguage.appldir:string;
begin
result:=extractfilepath(application.exename);
end;

function TjanLanguage.inifile:string;
begin
result:=changefileext(application.exename,'.ini');
end;

procedure TjanLanguage.ChangeLanguage(AForm: Tform);
var
ini:TIniFile;
od:TOpendialog;
begin
od:=TOpendialog.Create(self) ;
od.InitialDir :=appldir;
od.Filter :='Language Files |*.lng';
if od.Execute then
begin
LanguageFile:=od.FileName ;
ini:=TInifile.Create (inifile);
ini.WriteString ('Language',Aform.name,LanguageFile);
ini.free;
LoadLanguage (Aform,LanguageFile)
end;
od.free;
end;

procedure TjanLanguage.InitLanguage(AForm: TForm);
var
ini:TIniFile;
begin
LanguageFile:=appldir+'Language.lng';
SaveLanguage (Aform,LanguageFile);
ini:=TInifile.Create (inifile);
LanguageFile:=ini.readString ('Language',Aform.name,LanguageFile);
if fileexists(LanguageFile) then
LoadLanguage (Aform,LanguageFile);
ini.WriteString ('Language',Aform.name,LanguageFile);
ini.free;
end;

procedure TjanLanguage.LoadLanguage(AForm:TForm;Afile:string);
var c:Tcomponent;
ini:tinifile;
langfile:string;
langs:TStringlist;
i,p:integer;
aname,avalue:string;
afrm,acomp,aprop:string;
AComponent:Tcomponent;
PropInfo:pPropInfo;
procedure split(s:string);
var p:integer;
begin
p:=pos('=',s);
aname:=copy(s,1,p-1);
avalue:=copy(s,p+1,length(s));
avalue:=stringreplace(avalue,'~~',cr,[rfreplaceall]);
p:=pos('.',aname);
afrm:=copy(aname,1,p-1);
aname:=copy(aname,p+1,length(aname));
p:=pos('.',aname);
acomp:=copy(aname,1,p-1);
aprop:=copy(aname,p+1,length(aname));
end;
begin
langfile:=Afile;
ini:=tinifile.Create (langfile);
langs:=tstringlist.create;
ini.ReadSectionValues ('TRANSLATIONS',langs);
if langs.Count > 0 then
begin
for i:=0 to langs.count-1do
begin
split(langs);
if Aform.name< > Afrm then
continue;
AComponent:=Aform.findcomponent(acomp);
if AComponent= nil then
continue;
PropInfo:=GetPropInfo(Acomponent,aprop);
if PropInfo< > nil then
if propinfo^.PropType^.Kind= tkLString then
setStrProp(Acomponent,aprop,avalue);
end;
end;
ini.free;
langs.free;
end;

procedure TjanLanguage.SaveLanguage(AForm:TForm;Afile:string);
var
i:integer;
langini:TInifile;
LangFile:string;
acap:string;
ahint:string;
atext:string;
PropInfo:pPropInfo;
m:Tcomponent;
begin
LangFile:=Afile;
langini:=TInifile.Create(LangFile);
for i:=0 to Aform.ComponentCount-1do
begin
m:=Aform.components;
PropInfo:=GetPropInfo(m,'caption');
if PropInfo< > nil then
begin
acap:=GetStrProp(m,PropInfo);
acap:=stringreplace(acap,cr,'~~',[rfreplaceall]);
if ((acap< > '')and(acap< > '-')) then
Langini.WriteString ('Translations',AForm.name+'.'+m.name+'.Caption',acap)
end;
PropInfo:=GetPropInfo(m,'hint');
if PropInfo< > nil then
begin
ahint:=GetStrProp(m,PropInfo);
ahint:=stringreplace(ahint,cr,'~~',[rfreplaceall]);
if ahint< > '' then
Langini.WriteString ('Translations',AForm.name+'.'+m.name+'.Hint',ahint)
end;
PropInfo:=GetPropInfo(m,'text');
if PropInfo< > nil then
begin
atext:=GetStrProp(m,PropInfo);
atext:=stringreplace(atext,cr,'~~',[rfreplaceall]);
if atext< > '' then
Langini.WriteString ('Translations',AForm.name+'.'+m.name+'.Text',atext)
end;
end;
Langini.Free;
end;

end.

 
接受答案了.
 
顶部