我有一份报告,其中我正在尝试本地化。我准备好了资源包。本地化适用于列标题。但不适用于 JasperReports Server 的参数名称。 jrxml和.properties如下。关于为什么参数名称没有反映在所选语言环境中的任何想法都会有很大帮助。我正在使用pt-BR语言环境登录
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="testinterntionalization" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" resourceBundle="testinterntionalization" uuid="c3bdcfb8-c39a-4ce6-b38c-e7f05aa12d1b">
<property name="ireport.jasperserver.url" value="http://54.169.66.240/jasperserver-pro/"/>
<property name="ireport.jasperserver.report.resource" value="/organizations/organization_1/Clients/DEV/testinterntionalization_files/main_jrxml"/>
<property name="ireport.jasperserver.reportUnit" value="/organizations/organization_1/Clients/DEV/testinterntionalization"/>
<!-- some styles here -->
<subDataset name="Dataset1" uuid="1d6f72b2-0f11-41ac-b81e-e83ff3318002">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="mysqldev"/>
<parameter name="Name" class="java.lang.String"/>
<parameter name="Country" class="java.lang.String"/>
<parameter name="State" class="java.lang.String">
<parameterDescription><![CDATA[]]></parameterDescription>
</parameter>
<queryString>
<![CDATA[select * from testinternationalization;]]>
</queryString>
<field name="country" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="state" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="name" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="age" class="java.lang.Integer">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
</subDataset>
<parameter name="Name" class="java.lang.String"/>
<parameter name="Country" class="java.lang.String"/>
<parameter name="State" class="java.lang.String">
<parameterDescription><![CDATA[]]></parameterDescription>
</parameter>
<queryString>
<![CDATA[select * from testinternationalization]]>
</queryString>
<field name="country" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="state" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="name" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="age" class="java.lang.Integer">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<summary>
<band height="200" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<componentElement>
<reportElement x="0" y="100" width="510" height="100" uuid="808bf878-b921-4858-b9d4-4dee5c866c89"/>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="Dataset1" uuid="169432ea-4c71-4fae-ab33-f344d48e7612">
<datasetParameter name="Country">
<datasetParameterExpression><![CDATA[$F{country}]]></datasetParameterExpression>
</datasetParameter>
<datasetParameter name="State">
<datasetParameterExpression><![CDATA[$F{state}]]></datasetParameterExpression>
</datasetParameter>
<datasetParameter name="Name">
<datasetParameterExpression><![CDATA[$F{name}]]></datasetParameterExpression>
</datasetParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column width="100" uuid="6a314d61-4759-4396-9796-bc890f4018d0">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<jr:detailCell style="Table_TD" height="30">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<textField>
<reportElement x="0" y="0" width="100" height="30" uuid="700b5c4a-53ee-4c25-9202-a7cf5960b8f1">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<textFieldExpression><![CDATA[$F{country}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="100" uuid="96d38f9c-1461-4cf6-b43d-5ddc7b031a19">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<jr:detailCell style="Table_TD" height="30">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<textField>
<reportElement x="0" y="0" width="100" height="30" uuid="07dbe77e-5f72-44b8-981c-62f4dd5a7fcd">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<textFieldExpression><![CDATA[$F{state}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="100" uuid="c26b379e-d8aa-4ede-a79c-b4e521f2bd00">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<jr:detailCell style="Table_TD" height="30">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<textField>
<reportElement x="0" y="0" width="100" height="30" uuid="7d71e238-237a-4ff3-83f4-8768995cab50">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="100" uuid="4581f4df-2aa4-474f-925c-c2d7e4cb7795">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<jr:detailCell style="Table_TD" height="30">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<textField>
<reportElement x="0" y="0" width="100" height="30" uuid="50be640f-e779-4ba7-95c7-a92377628278">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<textFieldExpression><![CDATA[$F{age}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
<textField>
<reportElement x="0" y="70" width="100" height="30" uuid="73e572e7-39ab-4366-a8b9-2ef5ecfbcc6d"/>
<textFieldExpression><![CDATA[$R{country}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="100" y="70" width="100" height="30" uuid="0b662ca2-f379-458f-bf5c-e9d3cba4766c"/>
<textFieldExpression><![CDATA[$R{state}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="200" y="70" width="100" height="30" uuid="65697c5f-c12c-4151-98a3-ff9059e98a84"/>
<textFieldExpression><![CDATA[$R{name}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="300" y="70" width="100" height="30" uuid="a043231c-db12-4c08-a8bd-5e058c0acb36"/>
<textFieldExpression><![CDATA[$R{age}]]></textFieldExpression>
</textField>
</band>
</summary>
</jasperReport>
属性文件 - testinterntionalization_pt_BR.properties
# portugese
country:paÃs
state:Estado
name:nome
age:era
net.sf.jasperreports.prompt.label.Country=paÃs
net.sf.jasperreports.prompt.label.State=Estado
net.sf.jasperreports.prompt.label.Name=nome
答案 0 :(得分:1)
我在这里找到了解决问题的方法。
我所要做的就是让输入控件的提示名称使用$ R {}。
在我的情况下,将参数Country更改为$ R {Country},将参数State更改为$ R {State},将参数Name更改为$ R {Name},这样就可以了!!
由于 瑞斯