Reputation: 1267
I trying to use Spring's localization bundle with Thymeleaf templates. It works well if it is used in normal templates, but fails if I apply th:include attribute at container tag.
I put the view code to Gist: https://gist.github.com/hron84/386bbf855148a601a3dc
The problematic localization is at line 4 and line 10. In the line 10 I see the correct expansion ("New machine") but in line 4, i just get "null" as the page title.
Could you please point me what do I wrong?
Upvotes: 1
Views: 686
Reputation: 583
As Martin says, your th:include is replacing your title tag, you should do somthing like this:
<head>
<title th:text="#{page.title.machine.new}"> </title>
<dif th:include="widgets/_head :: head" th:remove="tag"></dif>
</head>
The th:remove="tag" will remove the dif tag.
The Thymeleaf website has some usefull documentation about the th:include and th:replace tags.
Upvotes: 1
Reputation: 10075
With th:include your are replacing the inner conten, ie the title tag, with the content fetched from the fragment. As you did not post the head fragment template i cannot give you more hints for that one. I suspect your title tag in the head fragment is doing something different for the title tag?
Upvotes: 0