Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Report engine seems to ignore __locale
TimB
<p>Hi,</p>
<p>I have to make a report multi-lingual. If I run the report in the designer and set the __locale parameter to various languages, everything works as expected - BIRT finds the language resource property files, dates get formatted according to the locale, etc.</p>
<p>However, when I run the same report on our server, passing a __locale parameter, the locale doesn't change. I put this script into the Report Design > Initialize script to see what's going on:</p>
<pre class="_prettyXprint">
importPackage(Packages.java.lang);
locale = reportContext.getLocale();
lang = locale.getLanguage();
country = locale.getCountry();
System.out.println("lang:" + lang);
System.out.println("country:" + country);
System.out.println("__locale:" + params["__locale"].value);</pre>
<p>Output:</p>
<pre class="_prettyXprint">
lang:en
country:US
__locale:fr_FR</pre>
<p>So, the report receives the __locale parameter, but chooses to ignore it! Any ideas?</p>
<p> </p>
<p>Thanks,</p>
<p>Tim</p>
<p> </p>
<p>
</p>
<p> </p>
Find more posts tagged with
Comments
Clement Wong
<p>In your output, how come you're not displaying the value of the "locale" variable?</p>
<p> </p>
<p>I just ran the attached report in BIRT 4.6.0 under Tomcat 8 with the following URL:</p>
<pre class="_prettyXprint _lang-">
http://localhost:8080/birt460/frameset?__report=OSBIRT460_SimpleReport.rptdesign&__locale=fr_CA
</pre>
<p>And I'm getting the following, as expected:</p>
<pre class="_prettyXprint _lang-">
lang:fr
country:CA
locale:fr_CA
</pre>
<p>With out the __locale parameter, I'm seeing:</p>
<pre class="_prettyXprint _lang-">
lang:en
country:US
locale:en_US
</pre>
<p>What version of OS BIRT are you using?</p>
<p> </p>
<p> </p>
TimB
<p>I just solved my issue.</p>
<p> </p>
<p>We have 2 websites using Birt. One uses the Birt viewer (and __locale works), but the other has it's own engine. What I misunderstood was the special parameter __locale is only special to the Birt viewer. If you are generating reports with your own engine, __locale is just another parameter and you need to set the locale using IRunAndRenderTask.setLocale(locale) .</p>
<p> </p>
<p>This distinction wasn't clear in the other posts I had read.</p>
TimB
<p>Thanks for responding, Clement!</p>