You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Saumil Mehta <sa...@voltage.com> on 2006/01/03 23:11:05 UTC
Localizing tree2 strings
Hello,
I am wondering if we can use JSF localization when generating tree2 type
components from a backing bean. For example, I can use EL as follows
when I have a NavigationMenuItem.
navMenuItem.setActionListener("#{someBean.someMethod}") [I know the tree
isnt constructed using NavigationMenuItem, but this is an example]
Could I do localization using something similar?
For example, could I do qaNode.getChildren().add(new
TreeNodeBase("document", "#{bundle.pageName}", "commonTiles.jsp",
true));
This would mean that my tree leaves would render localized strings -
very cool.
However, this doesn't work - has anybody had any success with this? Or
do we have to simply do Java i18n to make this work?
Thanks,
-Saumil
Re: Localizing tree2 strings
Posted by Simon Kitching <sk...@apache.org>.
On Tue, 2006-01-03 at 14:11 -0800, Saumil Mehta wrote:
> Hello,
>
>
>
> I am wondering if we can use JSF localization when generating tree2
> type components from a backing bean. For example, I can use EL as
> follows when I have a NavigationMenuItem.
>
>
>
> navMenuItem.setActionListener(“#{someBean.someMethod}”) [I know the
> tree isnt constructed using NavigationMenuItem, but this is an
> example]
>
>
>
> Could I do localization using something similar?
You should be able to do:
Application application = facesContext.getApplication();
ValueBinding vb =
application.createValueBinding(
"#{bundle.pageName}");
navMenuItem.setValueBinding("value", vb);
The component will then execute that expression during the rendering
phase.
Regards,
Simon
Re: Localizing tree2 strings
Posted by "R. Müller" <r....@unicomp-berlin.de>.
Hi,
Saumil Mehta wrote:
> Hello,
>
>
> [...]
>
> For example, could I do qaNode.getChildren().add(new
> TreeNodeBase("document", "#{bundle.pageName}", "commonTiles.jsp", true));
>
why so complicated ?! you're writing a java class, so why not you use
plain old 'ResourceBundle' to localize your stuff. It uses the same
resources as <f:loadBundle> does and is probably much faster in this case...
regards
Ronald