Localizing HTML submit button label in Wicket
Asked Answered
P

2

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?

Pluvious answered 11/11, 2010 at 15:44 Comment(0)
D
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"/>
Davit answered 11/11, 2010 at 16:7 Comment(1)
Page not found on URL you requested.Imprecate
R
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"));
Renaerenaissance answered 13/3, 2013 at 15:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.