I have some html code:
<div class="brand">
<span class="logo"></span> Title
<small>subtitle</small>
</div>
in tag I can display text from messages.properties (with locales) in that way (spring + thymeleaf)
<small th:text="#{small.text}" />
but I don't know how to display proper language version for Title text.
thanks for advice
The easiest way to accomplish this is to use expression inlining. You can use expressions directly in your html tags, like this:
<h1>
[[#{h1.text}]]
<small>[[#{small.text}]]</small>
</h1>
Depending on the version of thymeleaf your are using, you might have to use the property th:inline="text"
, like this:
<h1 th:inline="text">
[[#{h1.text}]]
<small th:inline="text">[[#{small.text}]]</small>
</h1>
You can do like that :
<div class="brand">
<span class="logo"></span><span th:text="#{title.text}" th:remove="tag"> Title </span>
<small th:text="#{small.text}">subtitle</small>
</div>
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