3
如何獲取thymeleaf模板中的當前語言環境? Thymeleaf上下文是locale感知的,所以在每個請求中注入locale會很奇怪,是否有一些變量可以在模板中請求?Thmeleaf獲取當前語言環境
<div th:text="${currentLocale}"></div>
如何獲取thymeleaf模板中的當前語言環境? Thymeleaf上下文是locale感知的,所以在每個請求中注入locale會很奇怪,是否有一些變量可以在模板中請求?Thmeleaf獲取當前語言環境
<div th:text="${currentLocale}"></div>
使用#locale表達式:
<div th:text="${#locale}"></div>