• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Customizing ReloadableResourceBundleMessageSource

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using Spring3 along with JSTL. This is regarding Internationalization.
In my JSP I've defined -
<fmt:message key="error.name.100"/>
and I am using ReloadableResourceBundleMessageSource class of Spring to achieve Internationalization.
I want to customize the ReloadableResourceBundleMessageSource so that it will pick up value of key 'error.name.100' if present, else it will pick up value for key 'error.name'.
Similarly if key 'error.address.100' is not present, it will pick value of key 'error.address'
Can this be achievable?
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not an 100% sure. You might have to go inside the SPring code to figure out the best way to extend it. I took a brief look and can see couple of ways

a) There is a protected method inside ReloadableResourceBundleMessageSource that converts the file into a PropertiesHolder object. You can override it to customize your property generation
b) Implement a ProxyMessageSOurce that can wrap ReloadableResourceBundleMessageSource. The proxy can modify the key of the property when ReloadableResourceBundleMessageSource doesn;t return a result.
 
To do a great right, do a little wrong - shakepeare. twisted little ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic