在html中判断当前语言,并且在多语言切换之间切换

判断当前国家

${#locale.getCountry().equals('US')}

错误判断方法

${#locale=='en_US'}

<li id="t-profile">
            <th:block th:if="${#locale.getCountry().equals('US')}">
                <a class="has-sub" th:attr="href='/n/lanauage?lang=zh&ph='+${#httpServletRequest.getServletPath()}+'?'+${#httpServletRequest.getQueryString()}"  th:text="#{com_zh}">Chinese</a>
            </th:block>
            <th:block th:if="${#locale.getCountry().equals('CN')}">
                <a  class="has-sub" th:attr="href='/n/lanauage?lang=en&ph='+${#httpServletRequest.getServletPath()}+'?'+${#httpServletRequest.getQueryString()}"  th:text="#{com_en}">English</a>
            </th:block>
        </li>

asoren
404 声望15 粉丝