mgruner Posted December 3, 2009 Share Posted December 3, 2009 Hello,I'm currently working on making my reports multi-lingual. I would like my users to choose the language on starting point of the report. Therefore I created a Input-Control in my Report with the Name "REPORT_LOCALE" hoping that it would pass the given locale to the report.When starting the report via "Run report unit" from IReport everything works like a charm: The locale gets recognized and uses the right resource bundles for that. When I use the Jaspersoft Jasperserver web interface the report ignores my parameter and uses the locale which the user did chose to login to the web interface.Are there any ideas around how I may change that behavior?Cheers, micha Link to comment Share on other sites More sharing options...
swood Posted December 18, 2009 Share Posted December 18, 2009 That is a bug. JasperServer is overriding the parameter you set. Please log it in the tracker. ShermanJaspersoft Link to comment Share on other sites More sharing options...
swood Posted December 18, 2009 Share Posted December 18, 2009 No, I am wrong. If you have an input control that has the same name as a JasperReports internal parameter, the input control value will override any defaults JasperServer puts in. From Teodor: "this would not work for REPORT_LOCALE as you cannot create an input control that would deliver java.util.Locale objects as values". iReport is doing something special for REPORT_LOCALE to make it work. Let me ask about some more details with my folks. ShermanJaspersoft Link to comment Share on other sites More sharing options...
mlabonte Posted February 17, 2010 Share Posted February 17, 2010 I'm facing the exact same problem with REPORT_LOCALE. Any news? Will it be fixed, is there any workaround? Thanks Link to comment Share on other sites More sharing options...
mgruner Posted February 18, 2010 Author Share Posted February 18, 2010 mlabonteWrote: I'm facing the exact same problem with REPORT_LOCALE. Any news? Will it be fixed, is there any workaround? Thanks Well, the official answer is given by Sherman.If you like to you may download the community edition source code and look for occurences of "REPORT_LOCALE" within the code (there are only 5 pieces as far as I remember). Then you could adapt the IReport code to the JAsper-Server Web-frontend. (In IReport they look if the REPORT_LOCALE variable is set. If it is set they create a REPORT_LOCALE object from the string given if not they default to the system locale.)As Sherman noted this is rather a hack than a straight forward approach. Unfortunately I did never implement this as I left the project where this thing was needed and had not enough time to do it as a private project. ;)Good luck!Michael Link to comment Share on other sites More sharing options...
swood Posted February 19, 2010 Share Posted February 19, 2010 Logged as an enhancement request http://jasperforge.org/projects/jasperserver/tracker/view.php?id=4583 ShermanJaspersoft Link to comment Share on other sites More sharing options...
mlabonte Posted February 19, 2010 Share Posted February 19, 2010 fyi, Found 2 ways to do it: - using 'reportLocale' parameter (instead of REPORT_LOCALE). It's in the user manual! - passing header 'Accept-Language' with the right language code Link to comment Share on other sites More sharing options...
asimail Posted February 22, 2010 Share Posted February 22, 2010 I made the following code change to make this work: jasperserver-ce\jasperserver\jasperserver-war-jar\src\main\java\com\jaspersoft\jasperserver\war\action\ViewReportAction.java Code: protected void setReportLocaleParameter(RequestContext context, Map parameterValues) {// Locale locale = (Locale) context.getFlowScope().get(getAttributeReportLocale(), Locale.class); Locale locale = null; String myLocale = null; if(parameterValues.containsKey("reportLocale")){ myLocale = (String) parameterValues.get("reportLocale"); } if (myLocale != null){ locale = LocaleHelper.getInstance().getLocale(myLocale); }else{ locale = (Locale) context.getFlowScope().get(getAttributeReportLocale(), Locale.class); } if (locale != null) { parameterValues.put(JRParameter.REPORT_LOCALE, locale); } } Link to comment Share on other sites More sharing options...
pumaking Posted October 23, 2012 Share Posted October 23, 2012 Hello,is there a solution for this without changing the code now?I also tried using the "reportLocale" parameter without success. 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