if you have a component/page you can use component.getstring() if not
you can get the localizer from application and use that, afaik
application.get().getresourcesettings().getlocalizer()

-igor

On Tue, Apr 13, 2010 at 9:33 AM, Alexandros Karypidis <[email protected]> wrote:
> Hi,
>
> How can I have Wicket resolve a key to some localized messages with my own
> code at runtime? The reason I ask is because I have this use case:
>
> 1) I use Java enumerations to strongly-type a RadioChoice control:
> public enum RadioOptions { ONE, TWO, THREE }
>
> 2) I strongly-type a RadioChoice control:
>    public SomePage() {
>        ...
>        RadioOptions radio = RadioOptions.ONE;
>        RadioChoice<RadioOptions> r = new RadioChoice<RadioOptions>(...,
>                Arrays.asList(RadioOptions.values()));
>        ...
>
> 3) Define localized messages in the MyWicketApplication_xx.xml file:
> <entry key="ONE">First option text</entry>
>
> 4) Overload toString() as follows:
> public enum RadioOptions {
>    ONE, TWO, THREE;
>    public String toString() {
>        String key = this.name(); // "ONE", "TWO" or "THREE"
>        return .................; // how do I ask Wicket to search for the
> localized message?
>    }
> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to