Reputation: 297
I have a report wherein I am trying localization. I have the resource bundles ready. The localization is working for column headers. But not working for the parameter names at JasperReports Server. The jrxml and .properties is as follows. Any ideas on why the parameters names do not reflect in the locale selected would be of great help. I am logging in with pt-BR locale
<?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>
The properties file - 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
Upvotes: 0
Views: 1235
Reputation: 297
I found a solution to my problem here.
All I had to do was make the prompt names for the input controls to use $R{}.
In my case change the parameter Country to $R{Country}, parameter State to $R{State}, and parameter Name to $R{Name} and this worked !!
Thanks Rathi
Upvotes: 1