历史 | 登录     查看当前页的打印版本.  
问题详情 (XML | Word | Printable)

Key: EASYJWEB-33
类型: 新增功能 新增功能
状态: Resolved Resolved
解决: Fixed
优先级: Major Major
开发者: daxia
报告人: tianyi
投票: 0
关注人: 1
操作

复制 问题
创建 子任务
如果你是 登录 你不能看到更多操作.
easyjweb

让多国语言支持xml格式属性文件

创建: 18/一月/08 11:00 上午   更新: 18/一月/08 11:11 上午
模块: 页面渲染及视图处理
影响版本:
修复版本:

外部引用:
我们非常高兴的宣布,EasyJWeb-1.1今日正式对外发布,这个版本主要对EasyJWeb的Ajax支持作较大的改进。


 描述  « Hide
多国语言只支持propertoes文件,但有时候需要使用xml文件来做多国语言,最好能加上xml文件的支持。

 所有   备注   改动记录      排列顺序:
daxia - 18/一月/08 11:08 上午
已经添加了该功能。
只需要在EasyJWeb的配置文件中添加一个指定多国语言属性文件类型的配置,把该值设置为xml,如下所示:
<property name="com.easyjweb.propertiesType">xml</property><!--多国语言属性文件类型-->

然后就可以在应用中直接使用xml格式的多国语言属性文件了。比如针对hello.ejf,在WEB-INF\applicationResources目录下包含一个hello.xml及hello_en.xml文件,hello.xml的文件内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>属性文件</comment>
<entry key="hello">你好!</entry>
</properties>

hello_en.xml的文件内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>属性文件</comment>
<entry key="hello">hi,how are you!</entry>
</properties>

页面中使用多国语言hello:
$lang.get("hello")


daxia - 18/一月/08 11:11 上午
注意,一个系统中只能选择使用一种类型的属性格式文件,不能混合普通属性.properties及xml格式属性文件,EasyJWeb默认的是使用普通属性文件。

包含该功能的代码在SVN中,last commit revision为830。

下面是包含其它节点的easyjweb配置文件:
<easyjf-web xmlns="http://www.easyjf.com/schema/easyjf/web"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.easyjf.com/schema/easyjf/web http://www.easyjf.com/schema/easyjf/web/easyjf-web-0.0.1.xsd ">
<framework-setting>
<property name="com.easyjweb.propertiesType">xml</property><!--多国语言属性文件类型-->
<property name="com.easyjweb.defaultActionPackages">
com.easyjf.simpleblog.mvc
</property><!--设置自加Action扫描的路径,根据你的情况调整-->
</framework-setting>

</easyjf-web>