wmolzahn Posted March 23, 2011 Share Posted March 23, 2011 Hi,I'm working with iReport 4.0.0 and jasperreports 4.0.0 and I have the problem that language-switching due to the runtime parameter REPORT_LOCALE does not work. Nevertheless what I fill in that parameter - the result is always the same: jasperreport uses the default-locale of my system.The report works as desired if I switch the locale of my windows-pc - but the parameter is always ignored.All I want to do is to transfer the REPORT_LOCALE parameter into the report. I added an additional test-output ($P{REPORT_LOCALE}.toString( ))in the report in order to see whether the arriving parameter value is corresponding to the sending value - and it is!! I can change the REPORT_LOCALE value - but my report does not handle it!! My report always uses the property file according to my system default. It seems that the runtime environment does not evaluate the parameter correctly ??!!Does anyone know this bug and can help me?Sincerly WilfriedCode:void executeReportJrxml(String name) throws SQLException { // Datenbank Connection conn = null; try { conn = DriverManager.getConnection("jdbc:oracle:thin:@...", "...", "..."); } catch (SQLException sqle) { ErrorHandler.handle(BaseLibErrorCodes.ERR_COMMON_ERROR, "Cannot connect to DB", sqle); } JasperPrint printout = null; try { // compilierten Report erzeugen InputStream strm = TimeScheduleChartCustomizer.class.getResourceAsStream(name + ".jrxml"); if (strm == null) { ErrorHandler.handle(BaseLibErrorCodes.ERR_COMMON_ERROR, "Could not find report" + name + ".jrxml"); return; } JasperReport report = JasperCompileManager.compileReport(strm); // Parameter festlegen und den Report ausfüllen parameters.put(JRParameter.REPORT_LOCALE, new Locale("en", "US")); parameters.put("REPORT_TIMEZONE", sessionUser.getTimezone()); parameters.put("SUBREPORT_DIR", "com/eon/aim/reports/"); parameters.put("REPORT_USER", sessionUser.getName()); parameters.put("REPORT_USERPARAM_01", "70748,1270345,770382"); parameters.put("REPORT_USERPARAM_02", Timestamp.valueOf("2010-01-01 00:00:00")); printout = JasperFillManager.fillReport(report, parameters, conn); } catch (JRException jre) { ErrorHandler.handle(BaseLibErrorCodes.ERR_COMMON_ERROR, "Problems with JasperReport", jre); } finally { conn.close(); } // und ausgeben JasperViewer.viewReport(printout); }} Link to comment Share on other sites More sharing options...
danielnb Posted March 23, 2011 Share Posted March 23, 2011 i think i cant help. but it works fine to me, what i do is create to properties file reports_pt_BR.propertiesreports_en_US.properties and pass the parametersparameters.put("REPORT_RESOURCE_BUNDLE", bundle); parameters.put("REPORT_LOCALE", locale); then it always worked for me, if i want to pass this to a subreport in Resource Bundle i put only reports Dont know if this will help. xD Link to comment Share on other sites More sharing options...
wmolzahn Posted March 24, 2011 Author Share Posted March 24, 2011 Hi,I will try this as soon as possible - thank you for your help.Wilfried Link to comment Share on other sites More sharing options...
wmolzahn Posted March 29, 2011 Author Share Posted March 29, 2011 Hi,it works greatly - thank you very much for your proposal to use the REPORT_RESOURCE_BUNDLE parameter.SincerlyWilfried Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now