制作*_zh_CN.properties 中文資源文件

          ava項(xiàng)目中.properties中文資源文件相關(guān)資料 




          怎樣制作*_zh_CN.properties 中文資源文件。

          原文網(wǎng)址:http://www.java3z.com/cwbwebhome/article/article2/2377.html?id=1033



          利用程序native2asci.exe,它在JDK/BIN 目錄下,使用格式:

          native2ascii [-reverse] [-encoding encoding] [inputfile [outputfile]]

          正轉(zhuǎn):To:Unicode
          native2ascii -encoding gb2312 source.properties target.properties

          反轉(zhuǎn):Reverse Unicode To 指定碼
          native2ascii -reverse -encoding Big5 source22.properties target2.properties

          當(dāng)然可以寫成批處理文件.bat自動(dòng)轉(zhuǎn)化

          1 先寫系統(tǒng)變量,要將native2asci.exe放到path路徑中:
          set path= c:\jdk1.5\bin;...

          2 建一個(gè)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>密碼錯(cuò)誤
          errors.footer=</font></ul>
          errors.header=<ul><font color="red">

          將run.bat文件復(fù)制到C:\Tomcat 5.0\webapps\strutsjb9\WEB-INF\classes\下,并運(yùn)行!

          然后你再打開(kāi)ApplicationResources_zh_CN.properties 就看到效果了



          ===============
          一個(gè)簡(jiǎn)便好用的插件:

          源代碼才50K的eclipse中文properties編輯插件


          原文網(wǎng)址:http://www.aygfsteel.com/lifesting/archive/2008/03/31/189772.html
          相關(guān)下載:本站下載中心
          ---------------
          源代碼才50K的eclipse中文properties編輯插件
          下載插件源代碼(eclipse 3.3)

          下載eclipse 3.2 binary下載后改后綴zip為jar,然后放到eclipse/plugins目錄


          eclipse內(nèi)置一個(gè)properties editor但是只支持latin-1編碼,調(diào)用native2ascii太麻煩,sourceforge上有一個(gè)很強(qiáng)大的properties editor,日本人搞得,肯定支持中文了,但是版本太老,3.1,還有很多沒(méi)有什么多大用處的swing, jbuild支持等,我稍微改了一下,做了一個(gè)最小化的編輯器。

          嚴(yán)正申明,此軟件屬于研究性質(zhì),版權(quán)屬于原作者:http://propedit.sourceforge.jp/index_en.html

          效果:



          下載后將工程導(dǎo)入到workspace中,export成plugin即可。


          ======================
          Java Properties 文件中文亂碼 Eclipse
          原文網(wǎng)址:http://blog.chinaunix.net/u/29351/showart_654038.html


          Java Properties 文件中文亂碼 Eclipse
          在使用Java Properties讀取properties文件時(shí)中文是亂碼
          原因是由于Java Properties的load方法讀取文件內(nèi)容是使用的是 ISO 8859-1 字符編碼;也就是每個(gè)字節(jié)是一個(gè) Latin1 字符。
          解決辦法,我在網(wǎng)上看到,,有的說(shuō)要用jdk到native2ascii進(jìn)行編碼轉(zhuǎn)化,
          我也轉(zhuǎn)了,還是不行.可能是由于我的project使用的UTF-8,轉(zhuǎn)換時(shí)還要制定參數(shù),我也沒(méi)深研究
          在網(wǎng)上找到的另個(gè)方法是使用Eclipse的插件:_Poperties Editor
          --------------<一下摘自http://lam.javaeye.com/blog/158710>---------------
          安裝方法:在線安裝Poperties Editor
          啟動(dòng)eclipse,點(diǎn)菜單Help -> SoftWare Updates -> find and install->
          選中Search for new features to install ->next->點(diǎn)擊 New Remote site
          ->給這個(gè)更新站點(diǎn)取個(gè)名字 如:propedit,url填寫http://propedit.sourceforge.jp/eclipse/updates即可。
          ->點(diǎn)擊ok->選中剛才新加的站點(diǎn)名稱,點(diǎn)擊finish
          ->他會(huì)自動(dòng)找出與你所用的eclipse版本相適應(yīng)的插件全部選中->后面只要選擇install all即可
          ->最后會(huì)提示你重起你的eclipse
          所有的properties文件名的前面都有一個(gè)綠色的p字
          ----------------------------------------------
          一個(gè)不必再使用native2ascii編碼的eclipse插件

          原文網(wǎng)址:http://opas.javaeye.com/blog/165560

          和大家分享一個(gè)不錯(cuò)的編寫properties文件的Eclipse插件(plugin),有了它我們?cè)诰庉嬕恍┖?jiǎn)體中文、繁體中文等Unicode文本 時(shí),就不必再使用native2ascii編碼了。您可以通過(guò)Eclipse中的軟件升級(jí)(Software Update)安裝此插件,步驟如下:

          1、展開(kāi)Eclipse的Help菜單,將鼠標(biāo)移到Software Update子項(xiàng),在出現(xiàn)的子菜單中點(diǎn)擊Find and Install;
          2、在Install/Update對(duì)話框中選擇Search for new features to install,點(diǎn)擊Next;
          3、在Install對(duì)話框中點(diǎn)擊New Remote Site;
          4、在New Update Site對(duì)話框的Name填入“PropEdit”或其它任意非空字符串,在URL中填入http://propedit.sourceforge.jp/eclipse/updates/;
          5、在Site to include to search列表中,除上一步加入的site外的其它選項(xiàng)去掉,點(diǎn)擊Finsih;
          6、在彈出的Updates對(duì)話框中的Select the features to install列表中將所有結(jié)尾為“3.1.x”的選項(xiàng)去掉(適用于Eclipse 3.2版本的朋友);
          7、點(diǎn)擊Finish關(guān)閉對(duì)話框;
          8、在下載后,同意安裝,再按提示重啟Eclipse,在工具條看到形似vi的按鈕表示安裝成功,插件可用。此時(shí),Eclpise中所有properties文件的文件名前有綠色的P的圖標(biāo)作為標(biāo)識(shí)。


          ========================
          如何在ApplicationResources.properties中輸入中文

          原文網(wǎng)址:http://www.diybl.com

          1.在你的ApplicationResources.properties文件目錄里新建一個(gè)a.txt文件
          2.打開(kāi)cmd
          3.輸入native2ascii
          4.進(jìn)入到ApplicationResources.properties文件所在目錄
          5.運(yùn)行: native2ascii a.txt ApplicationResources.properties

          這樣就可以得到a.txt文件里中文的Unicode碼文件----ApplicationResources_new.properties。也就是說(shuō) 你可以直接在a.txt里寫入,修改中文,然后在如上編輯一次a.txt文件,即可在 ApplicationResources_new.properties文件中一次性寫入中文的Unicode碼。
          還可以運(yùn)用 native2ascii -encoding gb2312 命令還能將其轉(zhuǎn)換為其他字符格式。

          還有一個(gè)一個(gè)Eclipse的properties文件的插件,update sites里加一項(xiàng)。
          PropertiesEdtior http://propedit.sourceforge.jp/eclipse/updates/ 可以自動(dòng)轉(zhuǎn)化。

          posted on 2010-11-25 17:57 想飛就飛 閱讀(2506) 評(píng)論(0)  編輯  收藏


          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           

          公告


          導(dǎo)航

          <2010年11月>
          31123456
          78910111213
          14151617181920
          21222324252627
          2829301234
          567891011

          統(tǒng)計(jì)

          常用鏈接

          留言簿(13)

          我參與的團(tuán)隊(duì)

          隨筆分類(69)

          隨筆檔案(68)

          最新隨筆

          搜索

          積分與排名

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 河池市| 东海县| 京山县| 丽江市| 孟连| 阳信县| 葵青区| 镇江市| 射洪县| 拉萨市| 无为县| 广元市| 临澧县| 宁阳县| 五大连池市| 新晃| 翁牛特旗| 临猗县| 青海省| 修水县| 武强县| 顺平县| 乌兰县| 厦门市| 南开区| 襄城县| 和平区| 宜黄县| 合水县| 武定县| 安陆市| 永川市| 中超| 龙南县| 莱芜市| 大悟县| 和平县| 肇源县| 广河县| 定西市| 大厂|