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

ava项目中.properties中文资源文件相关资料 




怎样制作*_zh_CN.properties 中文资源文件。

原文网址:http://www.java3z.com/cwbwebhome/article/article2/2377.html?id=1033



利用程序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 就看到效果了



===============
一个简便好用的插件:

源代码才50K的eclipse中文properties编辑插件


原文网址:http://www.blogjava.net/lifesting/archive/2008/03/31/189772.html
相关下载:本站下载中心
---------------
源代码才50K的eclipse中文properties编辑插件
下载插件源代码(eclipse 3.3)

下载eclipse 3.2 binary下载后改后缀zip为jar,然后放到eclipse/plugins目录


eclipse内置一个properties editor但是只支持latin-1编码,调用native2ascii太麻烦,sourceforge上有一个很强大的properties editor,日本人搞得,肯定支持中文了,但是版本太老,3.1,还有很多没有什么多大用处的swing, jbuild支持等,我稍微改了一下,做了一个最小化的编辑器。

严正申明,此软件属于研究性质,版权属于原作者:http://propedit.sourceforge.jp/index_en.html

效果:



下载后将工程导入到workspace中,export成plugin即可。


======================
Java Properties 文件中文乱码 Eclipse
原文网址:http://blog.chinaunix.net/u/29351/showart_654038.html


Java Properties 文件中文乱码 Eclipse
在使用Java Properties读取properties文件时中文是乱码
原因是由于Java Properties的load方法读取文件内容是使用的是 ISO 8859-1 字符编码;也就是每个字节是一个 Latin1 字符。
解决办法,我在网上看到,,有的说要用jdk到native2ascii进行编码转化,
我也转了,还是不行.可能是由于我的project使用的UTF-8,转换时还要制定参数,我也没深研究
在网上找到的另个方法是使用Eclipse的插件:_Poperties Editor
--------------<一下摘自http://lam.javaeye.com/blog/158710>---------------
安装方法:在线安装Poperties Editor
启动eclipse,点菜单Help -> SoftWare Updates -> find and install->
选中Search for new features to install ->next->点击 New Remote site
->给这个更新站点取个名字 如:propedit,url填写http://propedit.sourceforge.jp/eclipse/updates即可。
->点击ok->选中刚才新加的站点名称,点击finish
->他会自动找出与你所用的eclipse版本相适应的插件全部选中->后面只要选择install all即可
->最后会提示你重起你的eclipse
所有的properties文件名的前面都有一个绿色的p字
----------------------------------------------
一个不必再使用native2ascii编码的eclipse插件

原文网址:http://opas.javaeye.com/blog/165560

和大家分享一个不错的编写properties文件的Eclipse插件(plugin),有了它我们在编辑一些简体中文、繁体中文等Unicode文本 时,就不必再使用native2ascii编码了。您可以通过Eclipse中的软件升级(Software Update)安装此插件,步骤如下:

1、展开Eclipse的Help菜单,将鼠标移到Software Update子项,在出现的子菜单中点击Find and Install;
2、在Install/Update对话框中选择Search for new features to install,点击Next;
3、在Install对话框中点击New Remote Site;
4、在New Update Site对话框的Name填入“PropEdit”或其它任意非空字符串,在URL中填入http://propedit.sourceforge.jp/eclipse/updates/;
5、在Site to include to search列表中,除上一步加入的site外的其它选项去掉,点击Finsih;
6、在弹出的Updates对话框中的Select the features to install列表中将所有结尾为“3.1.x”的选项去掉(适用于Eclipse 3.2版本的朋友);
7、点击Finish关闭对话框;
8、在下载后,同意安装,再按提示重启Eclipse,在工具条看到形似vi的按钮表示安装成功,插件可用。此时,Eclpise中所有properties文件的文件名前有绿色的P的图标作为标识。


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

原文网址:http://www.diybl.com

1.在你的ApplicationResources.properties文件目录里新建一个a.txt文件
2.打开cmd
3.输入native2ascii
4.进入到ApplicationResources.properties文件所在目录
5.运行: native2ascii a.txt ApplicationResources.properties

这样就可以得到a.txt文件里中文的Unicode码文件----ApplicationResources_new.properties。也就是说 你可以直接在a.txt里写入,修改中文,然后在如上编辑一次a.txt文件,即可在 ApplicationResources_new.properties文件中一次性写入中文的Unicode码。
还可以运用 native2ascii -encoding gb2312 命令还能将其转换为其他字符格式。

还有一个一个Eclipse的properties文件的插件,update sites里加一项。
PropertiesEdtior http://propedit.sourceforge.jp/eclipse/updates/ 可以自动转化。

posted on 2010-11-25 17:57 想飞就飞 阅读(2470) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航:
 

公告


导航

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

统计

常用链接

留言簿(13)

我参与的团队

随笔分类(69)

随笔档案(68)

最新随笔

搜索

积分与排名

最新评论

阅读排行榜

评论排行榜