Mondrian国际化

Mondrian国际化
在Schema里的Dimension、Level、Measure标签都有一个caption属性,在shecma里有个measuresCaption属性,Hierarchy里有个allMemberCaption属性都是国际化显示用的。格式为:caption="%{}"
通过以下几个步骤便可实现国际化
一、修改Schema如下
.
<Dimension foreignKey="TIME_ID" name="TIME">
<Hierarchy hasAll="true" allMemberName="All time" primaryKey="TIME_ID" allMemberCaption="%{compensation.dimension.time.allmember.caption}">
<Table name="TIME_TO_MONTH">
</Table>
<Level name="YEAR" table="TIME_TO_MONTH" column="YEAR" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
</Level>
<Level name="QUARTER" table="TIME_TO_MONTH" column="QUARTER" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
</Level>
<Level name="MONTH" table="TIME_TO_MONTH" column="MONTH" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
</Level>
</Hierarchy>
</Dimension>
<Measure name="UOT1" column="UOT1" caption="%{compension.measure.uot1.caption}" datatype="Numeric" formatString="#,##0.###" aggregator="sum">
</Measure>

二、在WEB Application 的classes里创建对应的国际化文件,命名如下locale_zh_CN.properties
compensation.dimension.time.allmember.caption=\u5168\u90e8\u65f6\u95f4
compensation.dimension.position.allmember.caption=\u5168\u90e8\u8d44\u4f4d
compension.measure.uot1.caption=1.5\u500d\u52a0\u73ed\u65f6\u6570
compension.measure.uot2.caption=2\u500d\u52a0\u73ed\u65f6\u6570
compension.measure.uot3.caption=3\u500d\u52a0\u73ed\u65f6\u6570
三、在classes里添加mondrian.properties文件(默认是在WEB-INF下),并添加下面两个属性
Locale:用于指定要使用的语言
mondrian.rolap.localePropFile:国际化文件绝对路径
Locale=zh_CN
mondrian.rolap.localePropFile=D:\\JAVA\\Tomcat5.5\\webapps\\mondrian\\WEB-INF\\classes\\locale.properties
四、在显示的页面上的<jp>标签里添加dynLocale="zh_CN" dynResolver="mondrian.i18n.LocalizingDynamicSchemaProcessor"
<jp:mondrianQuery id="query01" jdbcDriver="oracle.jdbc.OracleDriver" dynLocale="zh_CN" dynResolver="mondrian.i18n.LocalizingDynamicSchemaProcessor" jdbcUrl="jdbc:oracle:thin:@*.*.*.*:1521:wiptest" jdbcUser="oee" jdbcPassword="oee" catalogUri="/WEB-INF/queries/Compensation.xml">
select {[Measures].[UOT1],[Measures].[UOT2],[Measures].[UOT3]} ON columns,
{([TIME].[All time],[POSITION].[All position], [DEPT]) } on rows
FROM [Compensation]
</jp:mondrianQuery>
关于国际化功能实现相关代码在LocalizingDynamicSchemaProcessor和MondrianProperties两个类里。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值