dimanche 15 mars 2015

Configure internationalization from application.properties in spring boot

I was wondering if I can configure how spring boot handles internationalization using the application.properties file instead of writing it in code.


For example: To define a LocaleChangeInterceptor I have to declare a bean like this:



<bean id="localeChangeInterceptor"
class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="lang" />
</bean>


However, a look at the most used properties in the documentation shows only 3 values that can be configured for internationalization:



# INTERNATIONALIZATION (MessageSourceAutoConfiguration)
spring.messages.basename=messages
spring.messages.cache-seconds=-1
spring.messages.encoding=UTF-8


So is there a way to achieve this? is there a convention on how to map this to a properties file?


Aucun commentaire:

Enregistrer un commentaire