Reputation: 5749
I use spring boot 2 with thymeleaf.
I use internalization in javascript
<script type="text/javascript" th:inline="javascript">
$("div.samples-toolbars").html('<div><input type="checkbox" id="testDoneInclude" name="testDoneInclude" class="form-check-input" /><label for="testDoneInclude" class="form-check-label">[[#{testDoneInclude}]]</label></div>');
</script>
Result is "Test done include"
don't want to have "
any idea
Upvotes: 0
Views: 25
Reputation: 20487
Separate the variables into their own statements. (I think you're confusing the inline JavaScript mechanism when you try and include it in something that's already a string.)
<script type="text/javascript" th:inline="javascript">
var text = /*[[#{testDoneInclude}]]*/ "";
$("div.samples-toolbars").html('<div><input type="checkbox" id="testDoneInclude" name="testDoneInclude" class="form-check-input" /><label for="testDoneInclude" class="form-check-label">' + text + '</label></div>');
</script>
If something like that doesn't work, you must have the quotes as part of the testDoneInclude
variable.
Upvotes: 1