怎樣製作*_zh_CN.properties中文資源檔

來源:互聯網
上載者:User
利用程式native2asci.exe,它在JDK/BIN 目錄下,使用格式:

native2ascii [-reverse] [-encoding encoding] [inputfile [outputfile]]
 
正轉:To:Unicode
native2ascii -encoding gb2312 source.properties target.properties

反轉:Reverse Unicode To 指定碼
native2ascii -reverse -encoding Big5 source22.properties target2.properties

當然可以寫成批次檔.bat自動轉化

1 先寫系統變數,要將native2asci.exe放到path路徑中:
    set path=  c:/jdk1.5/bin;...

2 建一個run.bat檔案

del ApplicationResources_zh_CN.properties
native2ascii -encoding gb2312 beyond.properties ApplicationResources_zh_CN.properties

3.例子:C:/Tomcat 5.0/webapps/strutsjb9/WEB-INF/classes/beyond.properties

error.login.username=<li>不存在該使用者名稱
error.login.nullusername=<li>使用者名稱不可為空
error.login.password=<li>密碼錯誤
errors.footer=</font></ul>
errors.header=<ul><font color="red">

將run.bat檔案複製到C:/Tomcat 5.0/webapps/strutsjb9/WEB-INF/classes/下,並運行!

然後你再開啟ApplicationResources_zh_CN.properties 就看到效果了

 

 

如:C盤下有個test.properties ,運行命令:

C:/native2ascii -encoding gb2312 test.properties ApplicationResources_zh_CN.properties

就得到中文資源檔

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.