My Web-program config is Struts2 and Tomcat 6.0.
and my project is support i18n(International~)
and I use class extends com.opensymphony.xwork2.ActionSupport.
The getText(String) method works, but getTexts() doesn’t work.
public class MyAction extends ActionSupport {
public void textString() {
// print "en" works
String strTemp1 = getText("CURRENT.LOCALE");
System.out.println(strTemp1);
// This doesn't; bundle is null.
ResourceBundle bundle = getTexts();
System.out.println(bundle);
}
}
globalMessage_en.properties
CURRNET.LOCALE = en
This actually works as intended. From the docs of
TextProvider.getTexts()):As you only have a global message resource, it returns
null. If you would have a specific message resource for your action (e.g.MyAction.propertiesin the same directory as your action), it would return a correspondingResourceBundle(PropertyResourceBundle).