You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Sjoerd Schunselaar <s....@gmail.com> on 2009/08/13 14:34:21 UTC
multilangual dropdown
Hello all,
I have a dropdown which is generated from Java code.
Currently my code reads a property file, sets the values in an object
and places all the objects in an arraylist.
Each object has a toString method, so the value is correctly shown in
the dropdown.
Now I want to show a value dependant on the language.
I already have implemented multilingual text in the site with
(wicket:message) and MessageLabel, but I think thats not possible for
this dropdown.
Does anyone know whether this is possible?
Thank you,
Sjoerd
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: multilangual dropdown
Posted by Sjoerd Schunselaar <s....@gmail.com>.
Thank you for your quick response.
It's working now! Thank you!
On Thu, Aug 13, 2009 at 3:04 PM, Mathias
Nilsson<wi...@gmail.com> wrote:
>
> You can have all the objects have an getResourceKey method.
> Override the displayvalue of IChoiceRenderer and show the value.
>
> Example
>
> myproperties_sv.properties
> value1=ett test
>
> myProperties_en.properties
> value1=A test
>
> The Object
> class MyObject{
> private String getResourceKey;
> .. getters and setters
> }
>
> new IChoiceRenderer(){
> public Object getDisplayValue( Object obj ){
> if( obj instanceof MyObject ){
>
> // The this in getLocalizer must be a component class
> return getLocalizer().getString( ((MyObject)obj).getResourceKey() ,
> this );
> }
> return null;
> }
> }
>
> Set the local and you can display the value
> --
> View this message in context: http://www.nabble.com/multilangual-dropdown-tp24954084p24954218.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: multilangual dropdown
Posted by Mathias Nilsson <wi...@gmail.com>.
You can have all the objects have an getResourceKey method.
Override the displayvalue of IChoiceRenderer and show the value.
Example
myproperties_sv.properties
value1=ett test
myProperties_en.properties
value1=A test
The Object
class MyObject{
private String getResourceKey;
.. getters and setters
}
new IChoiceRenderer(){
public Object getDisplayValue( Object obj ){
if( obj instanceof MyObject ){
// The this in getLocalizer must be a component class
return getLocalizer().getString( ((MyObject)obj).getResourceKey() ,
this );
}
return null;
}
}
Set the local and you can display the value
--
View this message in context: http://www.nabble.com/multilangual-dropdown-tp24954084p24954218.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org