开发者

Localizing HTML submit button label in Wicket

开发者 https://www.devze.com 2023-01-24 08:43 出处:网络
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\"/>

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?


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"/>


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"));
0

精彩评论

暂无评论...
验证码 换一张
取 消