aspose file tools*
The moose likes Spring and the fly likes Using Resource Bundle in XML Config file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Using Resource Bundle in XML Config file" Watch "Using Resource Bundle in XML Config file" New topic
Author

Using Resource Bundle in XML Config file

M A Mujeeb
Greenhorn

Joined: Aug 05, 2010
Posts: 11
I have followed this thread

http://forum.springsource.org/showthread.php?t=73426

and was successful in accessing the resource bundle in the xml file. However the problem i face is accessing a language specific resource bundle.




I am only able to access the latest specified property ie; resource_ar.properties;

When I set locale to FR, I should be able to access resource_fr.properties; How do i do this? How do i make the xml file access locale specific resource file dynamically.

Thanks.
Mark Secrist
Ranch Hand

Joined: Jul 01, 2003
Posts: 89
I don't believe PropertyPlaceholderConfigurer was meant to be used in an I18N scenario. In this case, you probably want to consider something from the resource bundle interfaces like ResourceBundleMessageSource or ReloadableResourceBundleMessageSource. In that case, you may need to find another way to set the property on your beans as it won't work in the context of the XML config file processing.
M A Mujeeb
Greenhorn

Joined: Aug 05, 2010
Posts: 11
Mark,

Thanks for your input. I feel you are right.
Raghu Devatha
Ranch Hand

Joined: Feb 10, 2009
Posts: 39
Why does one want to inject multiple i18n resource bundles. Should that not be part of implementation.
Unrelated but, I was just curious.

As I understand, PropertyPlaceholderConfigurer is for injecting the application properties. I guess org.springframework.context.support.ResourceBundleMessageSource should be used for loading i18n messages.


dR
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using Resource Bundle in XML Config file