You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ignacio de Córdoba <ic...@skios.es> on 2009/11/12 19:26:37 UTC

Localized key values in s:select

Hello, 
I wonder if it is possible to make s:select tag localize the content of
option elements. I am using: 

<s:select labelposition="left" key="category" id="category"
list="%{categories}"  listKey="id" listValue="name" emptyOption="true"/> 

I'd like attribute listValue="name" property value if the objects iterated
not to be shown "as is" but to be used as a key to the language property
files... just like the "key" attribute value ("category" in this example) is
localized. 

¿Is it possible or I must pre-populate the list with already localized
strings? 

Thanks, 
Ignacio
-- 
View this message in context: http://old.nabble.com/Localized-key-values-in-s%3Aselect-tp26323814p26323814.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Localized key values in s:select

Posted by Paweł Wielgus <po...@gmail.com>.
Hi Ignacio,
it's possible, just use listValue="getText(name)",
it should work just like that, just add to your properties file a key
that match name value,
so that getText will have something to show.

Best greetings,
Paweł Wielgus.


El día 12 de noviembre de 2009 19:26, Ignacio de Córdoba
<ic...@skios.es> escribió:
>
> Hello,
> I wonder if it is possible to make s:select tag localize the content of
> option elements. I am using:
>
> <s:select labelposition="left" key="category" id="category"
> list="%{categories}"  listKey="id" listValue="name" emptyOption="true"/>
>
> I'd like attribute listValue="name" property value if the objects iterated
> not to be shown "as is" but to be used as a key to the language property
> files... just like the "key" attribute value ("category" in this example) is
> localized.
>
> ¿Is it possible or I must pre-populate the list with already localized
> strings?
>
> Thanks,
> Ignacio
> --
> View this message in context: http://old.nabble.com/Localized-key-values-in-s%3Aselect-tp26323814p26323814.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Localized key values in s:select

Posted by Brian Thompson <el...@gmail.com>.
Try this:

<s:select labelposition="left" key="category" id="category"
list="%{categories}"  listKey="id" listValue="%{getText(name)}"
emptyOption="true"/>



2009/11/12 Ignacio de Córdoba <ic...@skios.es>

>
> Hello,
> I wonder if it is possible to make s:select tag localize the content of
> option elements. I am using:
>
> <s:select labelposition="left" key="category" id="category"
> list="%{categories}"  listKey="id" listValue="name" emptyOption="true"/>
>
> I'd like attribute listValue="name" property value if the objects iterated
> not to be shown "as is" but to be used as a key to the language property
> files... just like the "key" attribute value ("category" in this example)
> is
> localized.
>
> ¿Is it possible or I must pre-populate the list with already localized
> strings?
>
> Thanks,
> Ignacio
> --
> View this message in context:
> http://old.nabble.com/Localized-key-values-in-s%3Aselect-tp26323814p26323814.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>