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)
language dependent resources
pdo
Currently we are accessing language dependent resources by specifying a resource file in the "includeResource"-Element:
<simple-property-list name="includeResource">
<value>resources/strings/order_report</value>
</simple-property-list>
So the text keys in resources/strings/order_report.properties are used for the language dependent parts of the report. If I want to change the language, I have the selection either to change the report template (e.g. specifying order_report_de_DE) or to change the resource file so that it contains the wished language resource. But my question is, if there is a possibility to control the resource access via a report parameter, e.g. myLocale, and if so, how the access has to be specified for that.
Find more posts tagged with
Comments
JasonW
Sure. Take a look at this page:
http://wiki.eclipse.org/BIRT/FAQ/Internationalization#Q:_Can_the_user_specify_the_report_locale_when_running_the_report.3F
Jason
pdo
<blockquote class='ipsBlockquote' data-author="'JasonW'" data-cid="96871" data-time="1330402795" data-date="27 February 2012 - 09:19 PM"><p>
Sure. Take a look at this page:<br />
<a class='bbc_url' href='
http://wiki.eclipse.org/BIRT/FAQ/Internationalization#Q:_Can_the_user_specify_the_report_locale_when_running_the_report.3F'>http://wiki.eclipse.org/BIRT/FAQ/Internationalization#Q:_Can_the_user_specify_the_report_locale_when_running_the_report.3F</a><br
/>
<br />
Jason<br /></p></blockquote>
<br />
None of the methods proposed there worked in my context. I run a RunAndRenderTask from my Java application.<br />
In my rptdesign:<br />
<simple-property-list name="includeResource"><br />
<value>order_report</value><br />
</simple-property-list><br />
So I have a order_report.properties for the default locale. Furthermore I have order_report_de_DE.properties, if the locale is de_DE. But however, neither setting the locale from the app nor setting the parameter "__locale" to "de_DE" has any effect. Always order_report.properties is taken.<br />
<br />
A further question: java.util.Properties does not support UTF-8, what is very uncomfortable using it for translations into non-latin languages. What alternatives for BIRT?
JasonW
If you are using a runandrender task just set the locale on the task.
task.setLocale(new Locale("en", "US"));
Jason
pdo
Thank you for your reply. But, also this didn't work.
Immediately before running the task, I control the locale with
System.out.println( "task Locale set to: " + task.getLocale().toString());
but only the default properties are taken!
Peter
JasonW
Peter,
Are you setting the resource folder in your code? And does the resource folder contain your properties files? Did you set the report to include the generic properties file?
//config is EngineConfig
config.setResourcePath(resourcePath)
Jason
pdo
Jason,
thank you for your reply. I were very optimistic as I saw that my config resource path was null. So I set it as you told. But the story is always the same! Finally I renamed my default properties into order_report_en_US.properties, but also in this case the locale en_US is taken, independly what locale the task has. (I'm checking this by slightly changing the resource.)
Peter
JasonW
Does the resource folder you configured contain all the different locale properties file? Did you add the default properties file to the report design in general resources. Are you setting the keys on text you want to change based on locale?
Jason
pdo
Jason, my answers in your message ...<br />
<br />
<blockquote class='ipsBlockquote' data-author="'JasonW'" data-cid="98107" data-time="1332359673" data-date="21 March 2012 - 12:54 PM"><p>
Does the resource folder you configured contain all the different locale properties file?<br />
-- yes, at the moment these are order_report_en_US.properties and order_report_de_DE.properties, after I have renamed order_report.properties into order_report_en_US.properties.<br />
Did you add the default properties file to the report design in general resources.<br />
-- as I wrote, my design contains:<br />
<simple-property-list name="includeResource"><br />
<value>order_report</value><br />
</simple-property-list><br />
at the top level of the <report> element.<br />
Are you setting the keys on text you want to change based on locale?<br />
-- this is proven by changing the _en_US resource. But why this resource is taken, even if task.getLocale() returns de_DE?<br />
<br />
Jason<br /></p></blockquote>
<br />
Peter
pdo
<blockquote class='ipsBlockquote' data-author="'pdo'" data-cid="98132" data-time="1332419197" data-date="22 March 2012 - 05:26 AM"><p>
Jason, my answers in your message ...<br />
<br />
<br />
<br />
Peter<br /></p></blockquote>
<br />
<br />
So finally I've found it: In my design there was a line:<br />
<br />
<property name="locale">en_US</property><br />
<br />
This seems to have prohibited all other settings!<br />
<br />
Peter
JasonW
Peter,
Glad to read! By default that property should not be getting set.
Jason
pdo
Jason,
the designs I deal with have been typically developed by copying and changing. So I don't know how the locale clause got in.
Another question: Is there an element to say within the design, if there is no resource for the current locale (set by task.setLocale), take the resource from another locale, instead of the default values in the design?
Peter
JasonW
Peter,
You could probably do this in script. Just check the return value for a lookup.
Jason