Songo
Songo

Reputation: 5736

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?

Upvotes: 1

Views: 1073

Answers (1)

Dave Syer
Dave Syer

Reputation: 58094

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

No there isn't. It's only a single bean definition and it's entirely optional, so I would prefer to leave that in Java.

Upvotes: 1

Related Questions