valijon
valijon

Reputation: 1444

How to give button label using Thymeleaf from i18n

Currently I am trying to replace the word Save from button label with a value from message_en.properties file.

<input type="submit" value="Save" class="btn btn-primary btn-block"/>

I have tried as below:

<input type="submit" th:text="#{newuser.page.saveBtn}" class="btn btn-primary btn-block"/>

But it's not giving the result I expected. Please help me out to solve the issue.

Upvotes: 2

Views: 8502

Answers (2)

Thomas K&#229;sene
Thomas K&#229;sene

Reputation: 5449

Shouldn't it be like this?

<input type="submit"
    th:value="#{newuser.page.saveBtn}"
    class="btn btn-primary btn-block"/>

Upvotes: 8

Bhushan Uniyal
Bhushan Uniyal

Reputation: 5703

you can use button, it's working for me

<button type="submit" class="btn btn-primary btn-block" th:text="#{newuser.page.saveBtn}"></button>

Upvotes: 3

Related Questions