You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Christian Schröter <ch...@1und1.de> on 2014/06/23 16:55:05 UTC
Behavior and property files
Hi,
I would like to build a self-contained Behavior including some translations (property files).
All I can think of is doing something like this within the behavior class:
@Override
public void bind(Component c) {
c.getString(„key“);
}
Unfortunately this is anything but a self-contained behavior. Does anyone has a better idea to solve my problem?
Cheers,
Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Behavior and property files
Posted by Christian Schröter <ch...@1und1.de>.
A BehaviorA.properties would solve perfectly my problem. Is there a way to register a BehaviorA.properties file?
Am 23.06.2014 um 17:15 schrieb Ernesto Reinaldo Barreiro <re...@gmail.com>:
> @Martin,
>
> He probably means there is no way to attach properties to a behavior: Like
> PaneA.class and PanelA.properties? I do not think BehaviorA.class and
> BehaviorA.properties will work. Or am I mistaken?
>
> @Christian
>
> Or do you mean something different?
>
>
>
>
> On Mon, Jun 23, 2014 at 5:11 PM, Martin Grigorov <mg...@apache.org>
> wrote:
>
>> Hi,
>>
>> c.getString() is just a shortcut to
>> Application.get().getResourceSettings().getLocalizer().getString() methods.
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>>
>>
>> On Mon, Jun 23, 2014 at 5:55 PM, Christian Schröter <
>> christian.schroeter@1und1.de> wrote:
>>
>>> Hi,
>>>
>>> I would like to build a self-contained Behavior including some
>>> translations (property files).
>>> All I can think of is doing something like this within the behavior
>> class:
>>>
>>> @Override
>>> public void bind(Component c) {
>>> c.getString(„key“);
>>> }
>>>
>>> Unfortunately this is anything but a self-contained behavior. Does anyone
>>> has a better idea to solve my problem?
>>>
>>> Cheers,
>>> Chris
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Behavior and property files
Posted by Martin Grigorov <mg...@apache.org>.
No.
Localizer#getString() works with Component only atm.
Only components have variations.
If the passed component is null then locale and style are taken from the
Session.
Once locale, style and variation are
calculated org.apache.wicket.settings.IResourceSettings#getStringResourceLoaders()
is being used to do the real work.
So you can roll your own BehaviorLocalizer that does the same with Behavior
instead of component.
Martin Grigorov
Wicket Training and Consulting
On Mon, Jun 23, 2014 at 6:15 PM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:
> @Martin,
>
> He probably means there is no way to attach properties to a behavior: Like
> PaneA.class and PanelA.properties? I do not think BehaviorA.class and
> BehaviorA.properties will work. Or am I mistaken?
>
> @Christian
>
> Or do you mean something different?
>
>
>
>
> On Mon, Jun 23, 2014 at 5:11 PM, Martin Grigorov <mg...@apache.org>
> wrote:
>
> > Hi,
> >
> > c.getString() is just a shortcut to
> > Application.get().getResourceSettings().getLocalizer().getString()
> methods.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> >
> >
> > On Mon, Jun 23, 2014 at 5:55 PM, Christian Schröter <
> > christian.schroeter@1und1.de> wrote:
> >
> > > Hi,
> > >
> > > I would like to build a self-contained Behavior including some
> > > translations (property files).
> > > All I can think of is doing something like this within the behavior
> > class:
> > >
> > > @Override
> > > public void bind(Component c) {
> > > c.getString(„key“);
> > > }
> > >
> > > Unfortunately this is anything but a self-contained behavior. Does
> anyone
> > > has a better idea to solve my problem?
> > >
> > > Cheers,
> > > Chris
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
>
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>
Re: Behavior and property files
Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
@Martin,
He probably means there is no way to attach properties to a behavior: Like
PaneA.class and PanelA.properties? I do not think BehaviorA.class and
BehaviorA.properties will work. Or am I mistaken?
@Christian
Or do you mean something different?
On Mon, Jun 23, 2014 at 5:11 PM, Martin Grigorov <mg...@apache.org>
wrote:
> Hi,
>
> c.getString() is just a shortcut to
> Application.get().getResourceSettings().getLocalizer().getString() methods.
>
> Martin Grigorov
> Wicket Training and Consulting
>
>
> On Mon, Jun 23, 2014 at 5:55 PM, Christian Schröter <
> christian.schroeter@1und1.de> wrote:
>
> > Hi,
> >
> > I would like to build a self-contained Behavior including some
> > translations (property files).
> > All I can think of is doing something like this within the behavior
> class:
> >
> > @Override
> > public void bind(Component c) {
> > c.getString(„key“);
> > }
> >
> > Unfortunately this is anything but a self-contained behavior. Does anyone
> > has a better idea to solve my problem?
> >
> > Cheers,
> > Chris
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
--
Regards - Ernesto Reinaldo Barreiro
Re: Behavior and property files
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
c.getString() is just a shortcut to
Application.get().getResourceSettings().getLocalizer().getString() methods.
Martin Grigorov
Wicket Training and Consulting
On Mon, Jun 23, 2014 at 5:55 PM, Christian Schröter <
christian.schroeter@1und1.de> wrote:
> Hi,
>
> I would like to build a self-contained Behavior including some
> translations (property files).
> All I can think of is doing something like this within the behavior class:
>
> @Override
> public void bind(Component c) {
> c.getString(„key“);
> }
>
> Unfortunately this is anything but a self-contained behavior. Does anyone
> has a better idea to solve my problem?
>
> Cheers,
> Chris
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>