I think, I found simple workaround your problem.
In faces-config.xml I have defined my el-resolver
Code:
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
version="1.2">
<application>
<!-- Enables Facelets -->
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
<!-- message soruce in el expressions -->
<el-resolver>test.TestResolver</el-resolver>
</application>
</faces-config>
The code for TestResolver look like this:
Code:
public class TestResolver extends SpringBeanFacesELResolver {
private final static Log log = LogFactory.getLog(TestResolver.class);
@Override
public Object getValue(ELContext elContext, Object base, Object property) throws ELException {
if (log.isDebugEnabled())
log.debug("getValue(" + elContext + ", " + base + ", " + property + ")");
if (base instanceof MessageSource && property instanceof String) {
if (log.isDebugEnabled()) {
log.debug("getting message from MessageSource with key: " + property + " for locale: " + getLocale());
}
String result = ((MessageSource) base).getMessage((String) property, null, getLocale());
if (log.isDebugEnabled()) {
log.debug("Result: " + result);
}
if (null != result) {
elContext.setPropertyResolved(true);
}
return result;
}
return super.getValue(elContext, base, property);
}
private Locale getLocale() {
FacesContext context = FacesContext.getCurrentInstance();
return context.getExternalContext().getRequestLocale();
}
}
I don't know if this is the best solution but it does for me. Hope it helps you too.