Reputation: 6581
i want to provide the text on my page in a language the user understands. Since i don't speak every language on the world and i don't trust google transalte that much ;) i want to use a default language.
I thought I could just provide every language i know in a messages_en.properties or messages_de.properties and for every language i didn't provide like this the default messages.properties is used.
It turns out that this is not the case. The two explicitly provided languages do work as expected but if i try to visit my site when set my browsers language for example to polish, it shows german instead of english which is used in my messages.properties.
I didn't do any specific configuration to use internationalization. I just use the thymeleaf-starter and reference my messages by th:text="#{my.property}"
Do i have to configure anything to make messages.properties the default?
Upvotes: 1
Views: 2238
Reputation: 6581
Okay i just figured out what the problem was.
There is a property spring.messages.fallback-to-system-locale
which defaults to true
. That's why the german messages were picked for a unknown language.
When setting it to false
it defaults to the message.properties.
Upvotes: 3