<div th:fragment="language">

  <ul class="flex items-center">
    <li class="ml-4">
      <a href="javascript:;" onclick="setLangAndRefresh('zh');"
         th:classappend="${lang} == 'zh' ? 'font-bold' : ''">中文</a>
    </li>
    <li class="ml-4">
      <a href="javascript:;" onclick="setLangAndRefresh('en');"
         th:classappend="${lang} == 'en' ? 'font-bold' : ''">English</a>
    </li>
  </ul>
  <script>
      function setLangAndRefresh(lang) {
          document.cookie = "lang=" + lang + ";max-age=2592000;path=/"
          location.reload()
      }
  </script>

</div>