I have problem configuring Spring MessageSource to ignore my system locale. When I call getMessage with null locale parameter I want my MessageSource to choose default property file messages.properties. Instead it chooses messages_en.properties. When I change the name of this property file to messages_fr.properties then default property file is choosen. My system locale is 'en'. So it seems like MessageSource ignores the fallbackToSystemLocale property which I set to false.
This behavior is same with Spring version 4.1.4 as well as 4.1.5.
MessageSource configuration:
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="fallbackToSystemLocale" value="false"></property>
<property name="basenames">
<list>
<value>locale/messages</value>
</list>
</property>
<property name="defaultEncoding" value="UTF-8"></property>
</bean>
Getting message:
String message = messageSource.getMessage("user.email.notFound", new Object[] {email}, null);
Thanks for any advice!
Aucun commentaire:
Enregistrer un commentaire