在我的国际资源中,代码是
:
post_badge_format = You've earned the "{0}" badge for {1}.
在我的java
代码中:
String messageContent = MessageFormat.format(messageType, paramValues);
messageContent的预期值应该是这样的:
You've earned the "XXX" badge for XXX.
但是messageContent的实际值是这样的:
You've earned the "{0}" badge for {1}.
为什么?
答案 0 :(得分:3)
在国际资源中,代码应该是这样的:
post_badge_format = You've earned the "'{0}'" badge for '{1}'.
答案 1 :(得分:0)
您应该使用ActionSupport:
public String getText(String aTextName, List args)
在您的操作中,假设它从ActionSupport扩展,请将其替换为:
String messageContent = getText(messageType, paramValues);