THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block |
---|
summ: You, and $\{otherCount\} others, reviewed '$\{title\}' and rated it $\{rate\}. |
MyPanel.html:
Code Block |
---|
<span wicket:id="summary">Text that will be replaced.</span> |
...
Code Block |
---|
summ.short: Thanks! summ.long: You, and $\{otherCount\} others, reviewed '$\{title\}' and rated it $\{rate\}. Thanks! |
MyPanel.html:
Code Block |
---|
<span wicket:id="summary">Text that will be replaced.</span> |
...
Code Block |
---|
// summary.getMsgPrefs().getStyle() returns "short" or "long" add(new Label("summary", new StringResourceModel("summ.$\{msgPrefs.style\}", this, new Model(summary)))); |
...
Code Block |
---|
add(new Label("summary", getString("summ.$\{msgPrefs.style\}", new Model(summary)))); |
...
If you want to translate a components text containing additional Wicket components (e.g. Links) you can use wicket:message-tag in combination with a container around it. Example a form component label related to a checkbox (label for) containing two linksa link:
Java:
Code Block |
---|
final FormComponentLabel termsAndConditionsCheckLabel = new FormComponentLabel("termsAndConditionsCheckLabel", acceptedTerms); form.add(termsAndConditionsCheckLabel); final Link terms = new Link("terms") { @Override public void onClick() { setResponsePage(TermsOfUsePage.class); } }; termsAndConditionsCheckLabel.add(terms); final Label termsOfUse = new Label("terms_of_use", new ResourceModel("terms_of_use")); termsOfUse.setRenderBodyOnly(true); terms.add(termsOfUse); |
...
Code Block |
---|
summ: You, and $\{othersLink\}, reviewed $\{titleLink\} and rated it $\{rate\}. others: $\{otherCount\} others |
MyPanel.html:
Code Block |
---|
<wicket:message key="summ">Text that will be replaced. <span wicket:id="rate">rate</span> <a href="#" wicket:id="titleLink"> <span wicket:id="titleLabel">label</span></a> <a href="#" wicket:id="othersLink"> <span wicket:id="othersLabel">label<</span></a> </wicket:message> |
...
Code Block |
---|
// Note, we directly add the embedded components // rate, othersLink and titleLink add(new Label("rate", new PropertyModel(summary, "rate"))); Link othLink = new Link("othersLink") \{ .... \} add(othLink); othLink.add(new Label("othersLabel", new StringResourceModel( "others", this, new Model(summary)))); ExternalLink titleLink = new ExternalLink( "titleLink", summary.getTitleUrl()); add(titleLink); titleLink.add(new Label("titleLabel", new PropertyModel(summary, "title"))); |
...
Code Block |
---|
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <entry key="Required">ข้อมูลใน $\{label\} เป็นที่ต้องการ.</entry> </properties> |
...