This content has been marked as final.
Show 1 reply
-
1. Re: Link Title and Parameterized Resource Messages
glwittel-proofpoint Dec 30, 2008 4:58 PM (in response to glwittel-proofpoint)Awesome thanks! I've documented what I did in case others are interested:
Since we're using Facelets I used the following taglib function to call our formatter function:
<function> <function-name>formatMessage</function-name <function-class>com.somecompany.util.JSFUtils</function-class> <!-- The actual signature is fn(String, Object...) but varargs ... is not supported correctly by the reflection functions in: com.sun.facelets.compiler.TagLibraryConfig.java: com.sun.facelets.util.ReflectionUtil.forName() --> <function-signature>java.lang.String getMessageFromFacesBundle(java.lang.String, java.lang.Object[])</function-signature> </function>
In the library JSFUtils, the function pulls the ResourceBundle's message and runs MessageFormat as described:
java.text.MessageFormat.format(msg, parameters);
Where msg is a String containing the text retrieved from the bundle, and parameters is the Object... parameterAfter this its just a matter of using the taglib:
... title="#{myns:formatMessage('message.idstring', param1)}"
-Greg