I'm using thymeleaf with Spring Boot,
<span th:text="#{home.welcome}">Welcome Default Message</span>
When key is not found in messages.properties, I had
??home.welcome_en_US??
I dont want to translate every message in messages.properties. I would like to have "Welcome Default Message" writed in html page when translate key message is not found.
How I can do that?
Maybe not relevant anymore, but the following worked for me. I am running Thymeleaf 3.0.7.RELEASE.
<span th:text="${#strings.defaultString(#messages.msgOrNull('home.welcome'),'Welcome Default Message')}"/>
If message is not found, null is passed to the #strings.defaultString call which when given null parameter will return 'Welcome Default Message'.
More here http://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#strings
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With