Reputation: 81
I am using jsf to render my html pages and I am using the nifty resource bundle loading to add i18n to the various pages. The problem I am having is that with outputFormat you can not pass in any "rich" parameters. For instance this sentance:
This my favorite search engine, you should check it out.
It would be nice to do something like this:
<h:outputFormat value="#{bundle.favItemLineWithParam}>
<f:param>
<h:outputFormat value="#{bundle.searchEngine}>
<f:param>
<h:link value="http://google.com">
</f:param>
</h:outputFormat>
</f:param>
</h:outputFormat>
but that is not allowed, it would seem like the only option is to render the links in java with a backing bean or something. Any Ideas?
Upvotes: 4
Views: 1716
Reputation: 1108642
That's not possible. You need to use plain HTML in the bundle value and set escape="false"
.
favItem = This is my favourite <a href="{1}">{0}</a>, you should check it out.
with
<h:outputFormat value="#{bundle.favItem}" escape="false">
<f:param value="search engine" />
<f:param value="http://google.com" />
</h:outputFormat>
Update:
Since version 1.5, it's possible with <o:param>
of JSF utility library OmniFaces:
favItem = This is my favourite {0}, you should check it out.
searchEngine = search engine
with
<h:outputFormat value="#{bundle.favItem}" escape="false">
<o:param><a href="http://google.com">#{bundle.searchEngine}</a></o:param>
</h:outputFormat>
Upvotes: 2