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)
Setting locale before the generation of the report
frenchGuy
Hi,<br />
<br />
I try to change the Locale used by the report before the generation. This is a sample of code from my engine :<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
runtask.setRenderOption(renderOptions.get(i));
Locale locale = new Locale("en", "US");
runtask.setLocale(locale);
runtask.run();
</pre>
<br />
In my rptdesign, I set the following properties files in the ressources menu of the report property editor :<br />
translation/graphs-reports/fr_FR (file in ressource folder : translation/graphs-reports/fr_FR.properties)<br />
translation/master-page_fr_FR (file in ressource folder : translation/graphs-reports/master-page_fr_FR.properties)<br />
<br />
Two other files are also existing in the translation folders :<br />
translation/graphs-reports/en_US.properties<br />
translation/master-page_en_US.properties<br />
<br />
The problem is that I am always getting the report in french according to the values specified in the files *fr_FR.properties.<br />
I also tried to include the four properties files in the rptdesign resources. But nothing changed.<br />
<br />
Any idea?<br />
<br />
Thanks!
Find more posts tagged with
Comments
mwilliams
Hi Mat,
When you deploy the viewer, you could just set the locale with the URL parameter __locale.
mwilliams
Another way to do this in your java would be:
IRunAndRenderTask task = engine.createRunAndRenderTask(design);
task.setLocale(ULocale.FRENCH);
Hope one of these help.
frenchGuy
I don't use the viewer to generate the reports.
I have a custom scheduler in java that responds to our specific needs.
I tried this :
runtask.setLocale(ULocale.ENGLISH);
runtask.run();
and this :
runtask.setLocale(ULocale.US);
runtask.run();
And nothing changed.
Is my way to specify the properties files correct? I've attached a screenshot of my property editor.
Thanks Michael.
frenchGuy
Sorry, I forgot the screenshot.
frenchGuy
only the properties files in the top of the list are taken in account.
If I change the order in the resource menu, my report is generated in English, even if I set the locale french.
frenchGuy
I found the problem.
You need to specify a default properties file (with default values) in the ressource tab. For example :
myresource.properties
Then in the same folder than myresource.properties, you can have several properties files :
myresource_fr_FR.properties
myresource_en_US.properties
myresource_de_DE.properties
My mistake was that I didn't know that I must have a default properties file, I specified myresource_fr_FR.properties directly in the resources.
Thanks Michael!
mwilliams
Ah, that'll do it!
As always, let us know whenever you have questions! Good luck!