...
Resource Bundle Search Order
Resource bundles are searched in the following order:
ActionClass
.propertiesInterface
.properties (every interface and sub-interface)BaseClass
.properties (all the way to Object.properties)- ModelDriven's model (if implements ModelDriven), for the model object repeat from 1
- package.properties (of the directory where class is located and every parent directory all the way to the root directory)
- search up the i18n message key hierarchy itself
- global resource properties
This is how it is implemented in a default implementation of the LocalizedTextProvider
interface. You can provide your own implementation using TextProvider
and TextProviderFactory
interfaces.
Wiki Markup |
---|
{snippet:id=searchorder|javadoc=true|url=com.opensymphony.xwork2.util/LocalizedTextUtil.java} |
Tip | ||
---|---|---|
| ||
To clarify #5, while traversing the package hierarchy, Struts 2 will look for a file package.properties: com/ If |
Default action's class
If you configure action as follow
...
Global Resources (struts.custom.i18n.resources) in struts.properties
{snippet:id=globalresource|javadoc=true|url=com.opensymphony.xwork2.util.LocalizedTextUtil}A global resource bundle could be specified programmatically, as well as the locale. Wiki Markup
Formatting Dates and Numbers
...