Jump to content
Changes to the Jaspersoft community edition download ×

More than one ResourceBundle Object possible?


Recommended Posts

By: Daniel R - doctor_jay

More than one ResourceBundle Object possible?

2006-01-18 00:58

Hi,

 

I need to know if there's a way to pass 2 ResourceBundle objects (one for the set locale and the other as default) to a report. I'd like to have the same behaviour as in a normal java i18n application using property files, i.e. if there's a $R{key} field where the value for _key_ is not set in the ResourceBundle object for the locale set, I'd like to have the value from the default ResourceBundle object for _key_. Any opinions?

 

Greetz

Daniel

 

 

 

 

By: Lucian Chirita - lucianc

RE: More than one ResourceBundle Object possi

2006-01-18 01:25

Hi

 

I don't see any reason the defaults mechanism would not work in JR. How are you setting the resource bundle?

 

Regards,

Lucian

 

 

 

 

By: Daniel R - doctor_jay

RE: More than one ResourceBundle Object possi

2006-01-18 02:08

Hi,

 

I pass my ResourceBundle object as parameter in the report parameters map:

 

map.put(JRParameter.REPORT_RESOURCE_BUNDLE, myBundle);

map.put(JRParameter.REPORT_LOCALE, actualLocale);

 

Greetz

Daniel

 

 

 

 

By: Lucian Chirita - lucianc

RE: More than one ResourceBundle Object possi

2006-01-18 04:46

Try to call myBundle.getString(key) before you fill the report and see whether it fetches the value from the default bundle if the key is not present in the locale bundle.

 

Regards,

Lucian

 

 

 

 

By: Daniel R - doctor_jay

RE: More than one ResourceBundle Object possi

2006-01-18 07:26

OK, didn't work that way. Looks like I have to rely on complete resource data.

 

Greetz Daniel

 

 

 

 

By: Lucian Chirita - lucianc

RE: More than one ResourceBundle Object possi

2006-01-18 07:53

I think you should investigate the reason it doesn't work.

 

Anyway, if you need it, you can easily use two resource bundles in a report by creating another ResourceBundle parameter and writing a method in the report scriptlet that checks both bundles and call this method instead of $R{..} (or send a parameter value that wraps the two resource bundles and has also the logic).

 

Regards,

Lucian

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...