I would like to mimic the Grails way of resolving i18n messages.
In WEB-INF/i18n/ I have the following directories:
admin/messages_EN.properties
admin/messages_FR.properties
website/messages_EN.properties
website/messages_FR.properties
please ignore the language endings ( EN and FR ) in this example
in my xml configuration I currently have:
<!-- Register the welcome.properties -->
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="defaultEncoding" value="utf-8" />
<property name="basename" value="/WEB-INF/i18n/" />
</bean>
What I am looking for here, is a way to tell Spring to look for .properties files under i18n but without explicitly telling it what each subdirectory is. That is without a list of basenames that points to /WEB-INF/i18n/admin/ and /WEB-INF/i18n/website/
I want the WEB-INF/i18n/ directory to be dynamic, and that bundles ( directories ) can be created without having to remodify the xml configuration file.
I am not trying to solve this particular example with admin and website sub directories
Is this possible?
Thanks!
ReloadableResourceBundleMessageSource
to introduce some sort ofdiscover
property that causes the message source to search thebasename
directory, instead of loading files directly. –Paul Grime Jun 20 at 10:51