hi guys
in my report i use different methods for the localization.
for simple values, i use the built-in BIRT feature and two seperate resource files, one for english and one for german (i.e. myReport_de_DE.properties and myReport_en_US.properties). then i localize the field values via the "Properties > Localization" dialogue.
for elements containing "composite" values, such as messages using variables, i'm localizing the values via scripting.
first, in the report's initialize method i set the global variable lc used as locale:
then, in the element to be localized i use for instance:
in the report preview everything is displayed as expected, i can switch between different locales via "Preferences > Report Design > Preview > Choose your locale", the output is localized as desired.
the problem appears when i generate the report via the ReportEngine API in the java code. when rendering the report i call "runAndRenderTask.setLocale(reportLocale);" for the RunAndRenderTask. My "locale" parameter is set correctly within my parameter map which i pass to the report design via "runAndRenderTask.setParameterValues(mapReportParams);".
when the report is generated (either as html or pdf output), all values localized via scripting (i.e. via "getMessage(...)") are OK, but the localization via the built-in feature fails. It seems that the locale passed to the RunAndRenderTask is just ignored, instead that the system's locale is used.
so do you have any hints on how to fix this behaviour?
thanks in advance for any help, regards
bartek
in my report i use different methods for the localization.
for simple values, i use the built-in BIRT feature and two seperate resource files, one for english and one for german (i.e. myReport_de_DE.properties and myReport_en_US.properties). then i localize the field values via the "Properties > Localization" dialogue.
for elements containing "composite" values, such as messages using variables, i'm localizing the values via scripting.
first, in the report's initialize method i set the global variable lc used as locale:
var l = params["locale"].value; var arrL = l.split("_", 2); lc = new Locale(arrL[0], arrL[1]);
then, in the element to be localized i use for instance:
importPackage( Packages.java.util ); arrParams = new Array(2); arrParams[0] = params["A"].value; arrParams[1] = params["B"].value; reportContext.getMessage("msg_AB", lc, arrParams);
in the report preview everything is displayed as expected, i can switch between different locales via "Preferences > Report Design > Preview > Choose your locale", the output is localized as desired.
the problem appears when i generate the report via the ReportEngine API in the java code. when rendering the report i call "runAndRenderTask.setLocale(reportLocale);" for the RunAndRenderTask. My "locale" parameter is set correctly within my parameter map which i pass to the report design via "runAndRenderTask.setParameterValues(mapReportParams);".
when the report is generated (either as html or pdf output), all values localized via scripting (i.e. via "getMessage(...)") are OK, but the localization via the built-in feature fails. It seems that the locale passed to the RunAndRenderTask is just ignored, instead that the system's locale is used.
so do you have any hints on how to fix this behaviour?
thanks in advance for any help, regards
bartek