MessageLocator is a core RSF abstract class that is very similar in functionality to Spring's MessageSource (since it uses the Spring MessageSource), only it features a great many more different signatures supporting a greater flexibility of lookup, as well as having the dependence in the API on the required JDK Locale factored off into a request-scope dependency. The usage and general context of MessageLocator is described on the I18N page.
The most commonly used member of MessageLocator tends to be the plain
public String getMessage(String code)method, which takes a message key and resolves it in a .properties file to a localized message.
The default implementation PonderUtilCore's MessageLocator is in fact a wrapper for a Spring MessageSource. The standard Spring definition in RSF's blank-applicationContext.xml is
<bean id="messageLocator" class="uk.org.ponder.springutil.SpringMessageLocator"> <property name="messageSource" ref="messageSource" /> </bean>where messageSource is
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> <property name="basename" value="WEB-INF/messages/messages" /> <property name="cacheSeconds" value="10" /> </bean>The idea is that users may override the definition of messageSource to refer to the primary Spring resolver of their taste, and then continue to access it through RSF's standard messageLocator.
Since RSF 0.7.1, the use of MessageLocator in user code directly is much less necessary, with the widespread updates to UIMessage and the primitive components.