Discussions
Categories
Choose a Product
THRUST SERVICES
CORE APPS
CE PRODUCTS
...
Quick Links
POPULAR
HELPFUL TIPS
Groups
My Links
FOR SIGNED IN MEMBERS:
Back to website
Home
Designing Analytics Reports
Localization problem
Migrateduser
hi guys<br />
<br />
in my report i use different methods for the localization.<br />
<br />
for simple values, i use the built-in BIRT feature and two seperate resource files, one for english and one for german (i.e. myReport_de_DE.properties and myReport_en_US.properties). then i localize the field values via the "Properties > Localization" dialogue. <br />
<br />
for elements containing "composite" values, such as messages using variables, i'm localizing the values via scripting. <br />
<br />
first, in the report's <em class='bbc'>initialize</em> method i set the global variable <em class='bbc'>lc</em> used as locale:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>var l = params["locale"].value;
var arrL = l.split("_", 2);
lc = new Locale(arrL[0], arrL[1]);
</pre>
then, in the element to be localized i use for instance: <br />
<pre class='_prettyXprint _lang-auto _linenums:0'>importPackage( Packages.java.util );
arrParams = new Array(2); arrParams[0] = params["A"].value; arrParams[1] = params["B"].value;
reportContext.getMessage("msg_AB", lc, arrParams);
</pre>
<br />
in the report preview everything is displayed as expected, i can switch between different locales via "Preferences > Report Design > Preview > Choose your locale", the output is localized as desired.<br />
<br />
the problem appears when i generate the report via the ReportEngine API in the java code. when rendering the report i call "<em class='bbc'>runAndRenderTask.setLocale(reportLocale);</em>" for the <em class='bbc'>RunAndRenderTask</em>. My "<em class='bbc'>locale</em>" parameter is set correctly within my parameter map which i pass to the report design via "<em class='bbc'>runAndRenderTask.setParameterValues(mapReportParams);</em>". <br />
<br />
when the report is generated (either as html or pdf output), all values localized via scripting (i.e. via "getMessage(...)") are OK, but the localization via the built-in feature fails. It seems that the locale passed to the RunAndRenderTask is just ignored, instead that the system's locale is used. <br />
<br />
so do you have any hints on how to fix this behaviour?<br />
<br />
thanks in advance for any help, regards<br />
bartek
Find more posts tagged with
Comments
There are no comments yet