-
Notifications
You must be signed in to change notification settings - Fork 19
Localized message output improvements #517
Comments
Reported by peter_hilton |
peter_hilton said: |
@edburns said: |
@edburns said: |
mojavelinux said: Ideally the category for this issue should be i18n, if it existed. |
@edburns said: |
@edburns said: |
rogerk said: |
1 similar comment
rogerk said: |
@arjantijms said: Define a map as managed bean:
Define a custom Facelets tag that uses the Tomahawk library:
Use on a Facelet as:
|
@edburns said: |
Marked as won't fix on Friday, January 24th 2014, 12:57:07 pm |
@manfredriem said: |
This issue was imported from java.net JIRA JAVASERVERFACES_SPEC_PUBLIC-517 |
The JSF 1.2 approach to language localisation using a message bundle
does not easily support several common cases.
1. Parameterised message used in an attribute value:
<h:commandLink value="Delete #
{name}
" ...
If the message file defines 'msg=Delete
{0}
' then you normally use
h:outputFormat with a nested f:param to format the parameterised
message. However, then there is no obvious way to use the result in an
attribute value. Currently, you probably have to write your own JSTL
function, such as the following syntax a JSTL varargs function:
<h:commandLink value="#
{f:outputFormat('msg', name)}
" ...
2. Formatted message parameter:
Last updated <h:outputText value="#
{date}" converter="customDate"/>
If the message file defines 'msg=Last updated {0,date}' then there is no
obvious way to format the date using the custom JSF converter instead of
the standard date formatting. It also seems impossible to format the
date before passing it to h:outputFormat because the a nested f:param
takes its value from an attribute.
Again, you could work-around this with a JSTL converter function, e.g.
<h:outputFormat value="#{msg}">
<f:param value="#{f:convert('customDate', date)}"/>
</h:outputFormat>
Perhaps something like the following syntax makes sense:
<h:outputFormat value="#{msg}">
<f:param value="#{date}
" converter="customDate"/>
</h:outputFormat>
3. JSF component in message:
See the <h:commandLink ... >related items</h:commandLink>
This is similar to the 'formatted message parameter' case, but in this
case you need to be able to format a parameterised message by passing a
JSF component (the link) as a parameter. Again, h:outputFormat does
not support this.
Perhaps something like the following syntax makes sense:
<h:outputFormat value="#
{msg}
">
<f:param>
<h:commandLink ... >
<h:outputText value="#
{msg2}
"/>
</h:commandLink>
</f:param>
</h:outputFormat>
Environment
Operating System: All
Platform: All
Affected Versions
[2.0]
The text was updated successfully, but these errors were encountered: