Thymeleaf 从请求或会话获取当前区域设置

en *_*pes 4 html java spring thymeleaf spring-boot

如何获取 thymeleaf 模板中的当前区域设置?

我试过了

<html xmlns:th="http://www.thymeleaf.org" lang="${#locale}" xml:lang="${#locale}" class="no-js">
Run Code Online (Sandbox Code Playgroud)

<html xmlns:th="http://www.thymeleaf.org" lang="${request.locale}" xml:lang="${request.locale}" class="no-js"> 
Run Code Online (Sandbox Code Playgroud)

但两者都不起作用

İsm*_* Y. 10

尝试

<html xmlns:th="http://www.thymeleaf.org"
      th:lang="${#locale.language}" 
      th:xmllang="${#locale.language}" 
      class="no-js">
Run Code Online (Sandbox Code Playgroud)

类似的属性有很多,每个属性都针对特定的XHTML 或 HTML5 属性