How to change the default locale in BIRT
I am working with the BIRT reporting engine and my current task is to implement reporting internationalization. We use webviewer to create and download PDF reports. There is a (__locale) parameter that allows me to specify the language that should be used to generate the report. Everything works fine so far.
However, there is an additional requirement that I was unable to implement. In addition to the language specified by the http parameter, it should also be possible to specify some kind of fallback locale.
Take the following example: There are two properties files common_en_US.properties and common_en_GB.properties. The first language to use must be en_GB (__locale = en_GB). Everything works fine as long as the common_en_GB.properties file exists. But I would also like to tell BIRT to use common_en_US.properties if the en_GB file is not found, which does not work as expected.
I tried to solve this problem manually by setting the default Java locale before doing BIRT because I thought BIRT would use the Java engine to resolve localized strings. Unfortunately this attempt doesn't work.
Is there any other way to do what I would like to do? Can anything be done at all?
Thank you very much! Johannes
a source to share
Therefore, when you specify a locale, BIRT only looks for that locale properties file. The JVM locale is not used by default. When the properties file is not found, the default text applied to the control in the designer is used.
Read more here: BIRT and Internationalization
So what you want to do is create a hierarchy of locales that BIRT does not support. If you are rendering your reports manually (via a servlet or other POJO) you can force the language change in your code via IRunAndRenderTask
(there is a method called setLocale
)
a source to share