Reputation: 2133
How can I get current locale in thymeleaf template ?
I've tried
<html xmlns:th="http://www.thymeleaf.org" lang="${#locale}" xml:lang="${#locale}" class="no-js">
and
<html xmlns:th="http://www.thymeleaf.org" lang="${request.locale}" xml:lang="${request.locale}" class="no-js">
but none of both works
Upvotes: 4
Views: 3113
Reputation: 3965
Try
<html xmlns:th="http://www.thymeleaf.org"
th:lang="${#locale.language}"
th:xmllang="${#locale.language}"
class="no-js">
There are quite a lot of attributes like these, each of them targeting a specific XHTML or HTML5 attribute.
Upvotes: 10