clandestino Posted September 1, 2010 Share Posted September 1, 2010 I am using jasperreports to display reports in croatian (default language of application) and english.I have 2 properties files: messages.properties and messages_en_US.properties. My messages.properties file contains croatian words, and messages_en_US.properties contains english words. The thing is wheater I set croatian locale or no local at all, jasper reads text from my messages_en_US.properties file, and not the default one messages.properties. Only if I explicitly rename messages.properties to messages_hr_HR.properties the code down works fine and jasper generates croatian text. Locale locale = new Locale("hr","HR");params.put(JRParameter.REPORT_LOCALE, locale);What can I do so the jasper reads the deafult messages.properties (croatian) file instead messages_en_US.properties, but so that I don't need to rename messages.properties to messages_hr_HR.properties? Link to comment Share on other sites More sharing options...
clandestino Posted September 1, 2010 Author Share Posted September 1, 2010 I managed this to work this out by renaming messages_en_US.properties to messages_en_GB.properties. This isn't the best fix, but works for me. Link to comment Share on other sites More sharing options...
kingananth007 Posted September 27, 2010 Share Posted September 27, 2010 cant digest the way you fixed that...also there is a standard in naming convention try to adhere to it. Link to comment Share on other sites More sharing options...
lucianc Posted September 29, 2010 Share Posted September 29, 2010 kingananth007Wrote: cant digest the way you fixed that...also there is a standard in naming convention try to adhere to it. Take a look at ResourceBundle.getBundle, which JR uses to load report resource bundles. Note that the resource bundle which corresponds to the default JVM locale is preferred over the base resource bundle, so if your default locale is en_US, messages_en_US.properties is going to be used and not messages.properties.If the default JR mechanism doesn't work as you expect, you can load a java.util.ResourceBunle instance yourself and pass it to the report via the JRParameter.REPORT_RESOURCE_BUNDLE parameter.HTH,Lucian 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