多語言版vfp程序設計簡單實現

来源:互联网 发布:北京网络维护培训 编辑:程序博客网 时间:2024/05/21 18:42
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

增加數據表:
langTxt.dbf   //共五個字段,textno--編號;mod_type--模塊代號;tchinese--繁體文字;schinese--簡體文字;english--英文;  用來保存label的各種語言要顯示的文字
langType.dbf   //語言類型,設1為繁體,2為簡體,3為英文;兩個字段,一個字段為類型,一個字段為語言說明
langValue.dbf  //保存當前語言類型,一個字段就夠,設默認值為'1'


新增加一個label類,在init屬性中加入以下代碼:
sele langtxt
locate for allt(textno)==allt(this.name)
if allt(langValue.lang_no)=='1'
 this.caption=allt(tchinese)
else
 if allt(langValue.lang_no)=='2'
  this.caption=allt(schinese)
 else
  this.caption=allt(english)
 endif
endif


然后在程序中用這個新類增加label,label的name值定義和langTxt.textNo的值相對應,這時只要修改langValue.lang_no的值,就可以實現三種語言切換了~~


相同的方法,在langTxt.dbf中增加几個表示語言的字段,init代碼稍加更改,就可以實現更多種語言的程序設計;文本維護并不會很復雜~

設計不是很好,但相信實用,大家如有更好的方法,不妨提出^_^


(以上方法在繁體2000,簡體98,繁體98/vfp6.0繁體 中測試通過.)

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>