<th:block  th:fragment="option(el)" xmlns:th="http://www.thymeleaf.org"><option th:if="${el.label().code() != null}" th:value="${el.value()}" th:text="${#strings.defaultString(#messages.msgOrNull(el.label().code()),el.label().defaultMessage())}" th:selected="${el.selected()}" th:disabled="${el.disabled()}"></option><option th:unless="${el.label().code() != null}" th:value="${el.value()}" th:text="${el.label().defaultMessage()}" th:selected="${el.selected()}" th:disabled="${el.disabled()}"></option></th:block>