croutledge Posted May 8, 2009 Share Posted May 8, 2009 In our Web Application we are using a table to hold text used in our JSP pages (column headings, output boxes, etc) for each page and a language.For examplecode, displayText, language, groupwelcome, Welcome, en_GB, UIWelcomePageNow on each Form we pull the full the entire list for the current page and language and use them. Will i be able to do something similar in a report?I need to be able to call a java operation passing the code, group and language and then use the correct display text. But if i do this for each label then it could be consuming. Or would it be easier to pass a list (Map) to the report and use it that way.A lot of our reports will be ran from Java code and supplied with either a db connection or a JRBeanCollectionDataSource dependant on how we created the report in the first place.Any suggestions? CheersCarlPost Edited by croutledge at 05/08/2009 05:54 Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted May 8, 2009 Share Posted May 8, 2009 It's up to you. First of all you have to replace your static labels with textfields to be able to use a java expression to define the text, then you can implement your localization mechanism (a map sounds rasonable) or use what JasperReports already provides for internationalization (your should just pass as parameter the Locale to use and provide the correct resource bundle).Giulio Link to comment Share on other sites More sharing options...
croutledge Posted May 11, 2009 Author Share Posted May 11, 2009 Thanks for the reply Giulio, So would i be able to pass in a map as a parameter and then use display text from that map for textfields on my report? Link to comment Share on other sites More sharing options...
dman Posted May 12, 2009 Share Posted May 12, 2009 Given your report is called “MyReport”, create a resource file “MyReport.properties” (or “MyReport_en.properties”, “MyReport_de.properties”, … ) . Within the properties file define then whatever you want to internationalize, e.g. “reportName=Mein Bericht”. Define the ‘resource bundle’ property (“<pathtoyourresourcedir>.MyReport”) in iR and use your localized value for your text field expr. like this “$R{reportName}”.Maybe you’ll have to add the resources path under options | classpath. HTH,dman Post Edited by dman at 05/12/2009 09:14 Link to comment Share on other sites More sharing options...
croutledge Posted May 12, 2009 Author Share Posted May 12, 2009 Thanks for the reply dman. This is one option i can look into. We did one of our original J2EE projects with property files but felt it was limited in that a whole project would need to be released to add a new set of language data. So in our latest J2EE project we have used a db table to drive this and just look the information up from there. So because we have a lot of data already in a table that we could use in a report i would like to do just that. Cheers Carl 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