如何解决使用数据源而不是资源属性文件的 Birt 报告国际化
我创建了以下报告:
<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.23" id="1">
<property name="createdBy">Eclipse BIRT Designer Version 4.6.0.v201606072122</property>
<simple-property-list name="includeResource">
<value>Resources</value>
</simple-property-list>
<property name="units">in</property>
<method name="beforeFactory"><!
[CDATA[reportContext.getDesignHandle().setStringProperty("locale",params["__locale"].value);]]></method>
<property name="iconFile">/templates/blank_report.gif</property>
<property name="bidiLayoutOrientation">ltr</property>
<property name="imageDPI">96</property>
<parameters>
<scalar-parameter name="__locale" id="8">
<property name="valueType">static</property>
<property name="dataType">string</property>
<property name="distinct">true</property>
<list-property name="selectionList"/>
<property name="paramType">simple</property>
<property name="controlType">text-box</property>
<structure name="format">
<property name="category">Unformatted</property>
</structure>
</scalar-parameter>
</parameters>
<page-setup>
<simple-master-page name="Simple MasterPage" id="2">
<page-footer>
<text id="3">
<property name="contentType">html</property>
<text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property>
</text>
</page-footer>
</simple-master-page>
</page-setup>
<body>
<label id="7">
<text-property name="text" key="offerte.offerte"></text-property>
</label>
<label id="9">
<text-property name="text" key="offerte.klant"></text-property>
</label>
</body>
效果很好,但现在我想使用数据源而不是属性文件。有人知道从哪里开始吗?
解决方法
属性文件是在 BIRT 中支持国际化的“标准”方式,但您可以按自己喜欢的方式进行。
例如,在我们的应用程序中,我们使用的是 SQL 数据库。所有的翻译都存储在表中。输出语言被指定为报告参数。每一个翻译都是在此基础上完成的。
例如,我们从不使用标签。相反,我们使用动态文本项(根据情况使用纯文本或 html。
一个小的 javascript 函数 pr(x) 返回文本 x 的翻译。
如果可能,我们使用 SQL 进行所有日期和数字格式设置(我不知道是否可以动态更改“格式日期”和“格式数字”属性 - 这可能也有效)。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。