I am working with the BIRT reporting engine and my current task is to implement internationalization for reports. We are using the webviewer to generate and download pdf reports. There is a parameter (__locale) which allows me to specify the locale that should be used to generate a report. So far everything works fine.
There is an additional requirement I have not been able to implement, though. Additionally to the locale which is set by the http parameter there should also be the possibility to specify some kind of fallback locale.
Take the following example: There are two property-files common_en_US.properties and common_en_GB.properties.开发者_C百科 The first locale to be used should be en_GB (__locale=en_GB). Everything works fine if the common_en_GB.properties file exist. But I would also like to tell BIRT to use common_en_US.properties if the en_GB-file cannot be found, which does not work as expected.
I tried to solve this by manually setting the Java default locale before executing BIRT because I thought that BIRT would use the Java mechanism to resolve localized strings. Unfortunately this attempt does not work.
Is there a different way to do what I would like to do? Is it possible to do something like that at all?
Thanks a lot! Johannes
So when you specify a locale, BIRT only looks for that locale's properties file. The default JVM locale is not used. When no properties file is found, the default text applied to the control in the designer is used.
More background here: BIRT & Internationalization
So what you are looking to do is create a hierarchy of locales, which BIRT does not support. If you are rendering your reports manually (via a servlet or other POJO) you can force the locale in code via IRunAndRenderTask
(there is a method called setLocale
)
精彩评论