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-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Behavior and property files
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.schroe...@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-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Behavior and property files
@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 mgrigo...@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.schroe...@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-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Regards - Ernesto Reinaldo Barreiro
Re: Behavior and property files
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 reier...@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 mgrigo...@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.schroe...@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-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Regards - Ernesto Reinaldo Barreiro
Re: Behavior and property files
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 reier...@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 mgrigo...@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.schroe...@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-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Regards - Ernesto Reinaldo Barreiro - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org