Provides access to {@link ResourceBundle}s and their underlying text messages. Implementing classes can delegate {@link TextProviderSupport}. Messages will be searched in multiple resource bundles, starting with the one associated with this particular class (action in most cases), continuing to try the message bundle associated with each superclass as well. It will stop once a bundle is found that contains the given text. This gives a cascading style that allow global texts to be defined for an application base class.
You can override {@link LocaleProvider#getLocale()} to change the behaviour of howto choose locale for the bundles that are returned. Typically you would use the {@link LocaleProvider} interface to get the users configured locale.
When you want to use your own implementation for Struts 2 project you have to define following bean and constant in struts.xml: <bean class="org.demo.MyTextProvider" name="myTextProvider" type="com.opensymphony.xwork2.TextProvider" /> <constant name="struts.xworkTextProvider" value="myTextProvider" />
if you want to also use your implementation for framework's messages define another constant (remember to put into it all framework messages) <constant name="system" value="myTextProvider" />
Take a look on {@link com.opensymphony.xwork2.ActionSupport} for example TextProvider implemntation.
@author Jason Carreira
@author Rainer Hermanns
@see LocaleProvider
@see TextProviderSupport