易截截图软件、单文件、免安装、纯绿色、仅160KB

delphi中国际化的几种方案及比较(转)

delphi中国际化的几种方案及比较(转)
随着全球化程度加深,软件越来越像蒲公英,到处飘散、扎根。这其中要解决的是不同语言的显示问题。我们当然希望一套程序,可以不修改代码就可以支持不同的语言,不要去维护很多的版本。
        首先要谈到的一个问题是乱码问题,因为delphi
win32到11.x版还是不支持unicode,所以一般使用Ansi码,有这样几种情况会显示乱码:
使用的语言文字与系统当前设定的语言不一样;比如简体版QQ在繁体操作系统(或简体操作系统的区域设置中“非Unicode程序的语言”设定为繁体)就是乱码。即使改变Font.Charset,某些元件仍然会出现乱码,如StatusBar。因此,在越南文版的windows显示越南文,在伊朗文版的windows显示伊朗文,不要在越南文版windows显示伊朗文,在伊朗文版windows显示越南文,这样就能确保没有乱码问题。好在一般这样的错位用法也不多见。
系统没有安装你要显示的语言的语言包;
       
如果你要保证完全无乱码,必须考虑使用unicode码,使用成套的支持unicode的元件,如tnt,但它在UI变现上比较单一,你不可能不使用别的元件。
       
言归正传,首先,看看哪些地方的字串需要实现多语言,并来看看各种实现方法的优劣。
           
1、界面上的元件,如TButton的Caption;
           
2、主动弹出的消息,如ShowMessage('Are you sure?'),Raise
Exception.Create('Error!');
           
3、例外错误举发的报告信息,如f/0引起的exception;
           
4、第3方元件包内部的上述字串;
       
实现多语言的方法很多,列举一二:
           
1、delphi自带的Resource生成工具
               
此工具把专案的dfm文件里的所有字串以及pas中定义为ResourceString的字串列举出来,按不同的语言编译成不同的Resource,专


相关文档:

delphi 编写的com 对象 用php调用的实例

delphi 编写的com 对象 用php调用

实例
delphi:
function Tmyxml.Get_xml: WideString;
begin
      Get_xml:='wo shi a lei!';
end;
function Tmyxml.Get_xmldata: WideString;
var
xmlStr:string;
begin
  xmlStr := '<?xml   version="1.0" & ......

Delphi in a Unicode World Part I

 ---
Delphi in a Unicode World Part I: What is Unicode, Why do you need
it, and How do you work with it in Delphi?
By: Nick
Hodges
原文链接:http://dn.codegear.com/article/38437
Abstract: This article discusses Unicode, how Delphi developers
can benefit from using Unicode, and ho ......

Delphi in a Unicode World Part II

Delphi in a Unicode World Part II:  New RTL Features and
Classes to Support Unicode
By: Nick
Hodges
原文链接:http://dn.codegear.com/article/38498
Abstract: This article will cover the new features of the Tiburon
Runtime Library that will help handle Unicode strings.
//
 & ......

改写了一个常用的DELPHI的加解密函数

DELPHI
//////////////////////////////////
Function   EncrypKey   (Src:String;   Key:String):string;
  var  
  idx   :integer;  
  KeyLen   :Integer;  
  KeyPos   :Integer; &nbs ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号