12

How do I put a localized message on the face of a submit button? I am using Wicket, and normally to use a localized message, I'd use something like <wicket:message key="message-key"/>

I have an HTML button defined as <input type="submit" value="login"/>

I want to localize/internationalize the value 'login'

Any ideas?

Pops
  • 30,199
  • 37
  • 136
  • 151
joshua
  • 4,118
  • 3
  • 40
  • 53

2 Answers2

27

From https://cwiki.apache.org/confluence/display/WICKET/General+i18n+in+Wicket:

If you want to use Wicket's i18n in other HTML elements, for example:

<input type="submit" value="Search"/>

You can't use the <wicket:message/> component, you should use the following:

<input type="submit" wicket:message="value:page.search"/>
Dennis G
  • 21,405
  • 19
  • 96
  • 133
Geoff Reedy
  • 34,891
  • 3
  • 56
  • 79
3

An alternative to using wicket:message="value:yourPropertyName" would be to set a ResourceModel with the button in your Java code. It has the same effect.

Button b = new Button("wicketButtonName", new ResourceModel("yourPropertyName"));
Gaʀʀʏ
  • 4,372
  • 3
  • 39
  • 59