You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Lon Varscsak <lo...@gmail.com> on 2016/10/06 02:28:59 UTC

Localizer in bundle

Hey all,

How can I get a localized string (from a properties file) inside of a
library I have without the use of a Component.  I have a controller class
(nothing to do with components), but I’d like to have this class (In a
non-application jar) return an error message to the application localized
(with dynamic values), but I can’t see how to do it.  Localizer only allows
passing in a component (and not just any class).

Ideas?

Thanks!

-Lon

Re: Localizer in bundle

Posted by Martin Grigorov <mg...@apache.org>.
You may find this interesting: http://rincl.io/intro

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, Oct 6, 2016 at 5:12 AM, Martin Grigorov <mg...@apache.org>
wrote:

> The Component may specify custom locale and/or variation.
> java.lang.Class cannot :)
>
> On Oct 6, 2016 6:02 AM, "Lon Varscsak" <lo...@gmail.com> wrote:
>
>> Yeah, the properties file aren’t in the application’s package.  It would
>> be
>> handy if Localizer just used a Class instead of a Component.  However,
>> your
>> info was enough of a push to get me where I needed (in combination with
>> ConvertingPropertyVariableInterpolator).
>>
>> Thanks!
>>
>> -Lon
>>
>> On Wed, Oct 5, 2016 at 7:38 PM, Martin Grigorov <
>> martin.grigorov@gmail.com>
>> wrote:
>>
>> > Hi,
>> >
>> > The component could be null. In this case it will fallback to
>> > YourApplication.properties.
>> > I guess this won't work for you too.
>> >
>> > Why don't you just use ResourceBundle?
>> >
>> > On Oct 6, 2016 5:29 AM, "Lon Varscsak" <lo...@gmail.com> wrote:
>> >
>> > > Hey all,
>> > >
>> > > How can I get a localized string (from a properties file) inside of a
>> > > library I have without the use of a Component.  I have a controller
>> class
>> > > (nothing to do with components), but I’d like to have this class (In a
>> > > non-application jar) return an error message to the application
>> localized
>> > > (with dynamic values), but I can’t see how to do it.  Localizer only
>> > allows
>> > > passing in a component (and not just any class).
>> > >
>> > > Ideas?
>> > >
>> > > Thanks!
>> > >
>> > > -Lon
>> > >
>> >
>>
>

Re: Localizer in bundle

Posted by Martin Grigorov <mg...@apache.org>.
The Component may specify custom locale and/or variation.
java.lang.Class cannot :)

On Oct 6, 2016 6:02 AM, "Lon Varscsak" <lo...@gmail.com> wrote:

> Yeah, the properties file aren’t in the application’s package.  It would be
> handy if Localizer just used a Class instead of a Component.  However, your
> info was enough of a push to get me where I needed (in combination with
> ConvertingPropertyVariableInterpolator).
>
> Thanks!
>
> -Lon
>
> On Wed, Oct 5, 2016 at 7:38 PM, Martin Grigorov <martin.grigorov@gmail.com
> >
> wrote:
>
> > Hi,
> >
> > The component could be null. In this case it will fallback to
> > YourApplication.properties.
> > I guess this won't work for you too.
> >
> > Why don't you just use ResourceBundle?
> >
> > On Oct 6, 2016 5:29 AM, "Lon Varscsak" <lo...@gmail.com> wrote:
> >
> > > Hey all,
> > >
> > > How can I get a localized string (from a properties file) inside of a
> > > library I have without the use of a Component.  I have a controller
> class
> > > (nothing to do with components), but I’d like to have this class (In a
> > > non-application jar) return an error message to the application
> localized
> > > (with dynamic values), but I can’t see how to do it.  Localizer only
> > allows
> > > passing in a component (and not just any class).
> > >
> > > Ideas?
> > >
> > > Thanks!
> > >
> > > -Lon
> > >
> >
>

Re: Localizer in bundle

Posted by Lon Varscsak <lo...@gmail.com>.
Yeah, the properties file aren’t in the application’s package.  It would be
handy if Localizer just used a Class instead of a Component.  However, your
info was enough of a push to get me where I needed (in combination with
ConvertingPropertyVariableInterpolator).

Thanks!

-Lon

On Wed, Oct 5, 2016 at 7:38 PM, Martin Grigorov <ma...@gmail.com>
wrote:

> Hi,
>
> The component could be null. In this case it will fallback to
> YourApplication.properties.
> I guess this won't work for you too.
>
> Why don't you just use ResourceBundle?
>
> On Oct 6, 2016 5:29 AM, "Lon Varscsak" <lo...@gmail.com> wrote:
>
> > Hey all,
> >
> > How can I get a localized string (from a properties file) inside of a
> > library I have without the use of a Component.  I have a controller class
> > (nothing to do with components), but I’d like to have this class (In a
> > non-application jar) return an error message to the application localized
> > (with dynamic values), but I can’t see how to do it.  Localizer only
> allows
> > passing in a component (and not just any class).
> >
> > Ideas?
> >
> > Thanks!
> >
> > -Lon
> >
>

Re: Localizer in bundle

Posted by Martin Grigorov <ma...@gmail.com>.
Hi,

The component could be null. In this case it will fallback to
YourApplication.properties.
I guess this won't work for you too.

Why don't you just use ResourceBundle?

On Oct 6, 2016 5:29 AM, "Lon Varscsak" <lo...@gmail.com> wrote:

> Hey all,
>
> How can I get a localized string (from a properties file) inside of a
> library I have without the use of a Component.  I have a controller class
> (nothing to do with components), but I’d like to have this class (In a
> non-application jar) return an error message to the application localized
> (with dynamic values), but I can’t see how to do it.  Localizer only allows
> passing in a component (and not just any class).
>
> Ideas?
>
> Thanks!
>
> -Lon
>