我正在使用DateLabel
和TitleAttributeBehavior
向wicket StringResourceModel
添加弹出窗口。该应用程序需要本地化,它部分工作,但不是100%。
item.add(new DateLabel(componentId, new Model<Date>(sub.getExpiryDate()), new StyleDateConverter(false)) //adds the label with the date
.add(new TitleAttributeBehavior(new StringResourceModel("sub.next.payment.popup", CCBasePage.this, new Model<CCSubscription>(sub)))));
标签本身的格式正确适用于区域设置(德语)。但是弹出测试中的日期不是。
StringResourceModel非常聪明,可以调用getCCNextPaymentAmount()
对象getExpiryDate()
上的CCSubscription
和sub
。
属性文件:
sub.next.payment.popup=Nachste Zahlung ${cCNextPaymentAmount} wird am ${expiryDate} genommen
其中CCSubscription.getExpiryDate()返回Date - unformatted。另请注意,CCBasePage.getLocale()返回“de_DE” - 即组件和会话具有正确的语言环境集。
所以我希望wicket能够在弹出文本中正确格式化日期。
如何让wicket正确格式化弹出窗口中的日期?我正在使用wicket 1.4.22。