You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Robin Sander <ro...@gmx.net> on 2009/08/04 16:14:42 UTC

Label i18n in 1.4 final

Hello,

I'm trying to add internationalization to my wicket application using  
Wicket 1.4 final.
In order to customize labels I don't use wicket:message but use Label  
subclasses.

So, both the Wiki page "General i18n in Wicket" an Wicket in Action  
state that I may define
a property file for a page, say Index.properties and define any label  
resource in this file.

So far so good, it seems to work as long as I don't have a label  
nested in a panel or in a form!
Say I have a page Index and a panel Sidebar like this:

public class Sidebar extends Panel {
	public Sidebar(final String id) {
		super(id);
		add(new Label("header", new ResourceModel("header")));
		...
        }
}

public class Index extends WebPage {
	public Index() {
		super();
		add(new Sidebar("sidebar"));
        }
}

Now, if I define

sidebar.header = Sidebar Header!

in a file 'Index.properties' a MissingResourceException is thrown.
Does anybody know how to do it right?

regards,

Robin.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Label i18n in 1.4 final

Posted by Robin Sander <ro...@gmx.net>.
Yes, you're right!!
In case of a simple label there seem to be too many name parts for my  
understanding.
So, I always need a last part for the ResourceModel, right?
(like <panel-idt>.<label-id>.<resource-key>)

Imagine a form with many textfields each with a  
SimpleFormComponentLabel and
an additional Label. So I have to define something like:

form.name.label.text
form.name.hint.text
form....

and so on in a Page.properties file.
If I use Application.properties only I can ommit the last part so for  
now I will stick
with Application.properties...

thanks!


On 04.08.2009, at 19:12, Sven Meier wrote:

> Shouldn't that be:
>
> sidebar.header.header = Sidebar Header!
>
> ??
>
> Sven
>
> On Di, 2009-08-04 at 16:53 +0200, Robin Sander wrote:
>> sidebar.header = Sidebar Header!
>
>
> ---------------------------------------------------------------------
> 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: Label i18n in 1.4 final

Posted by Sven Meier <sv...@meiers.net>.
Shouldn't that be:

sidebar.header.header = Sidebar Header!

??

Sven

On Di, 2009-08-04 at 16:53 +0200, Robin Sander wrote:
> sidebar.header = Sidebar Header!


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Label i18n in 1.4 final

Posted by Robin Sander <ro...@gmx.net>.
Hi Craig,

yes you're right, this would work but I wanted to get an understanding  
of the algorithm and
tried the examples mentioned in the wiki page. In addition I dont  
don't like find-grained
property-files and at the moment I'm using one big  
Application.properties file with the full
class-name of a component as a prefix (so the keys are changed too  
during
refactoring)



On 04.08.2009, at 18:42, Craig McIlwee wrote:

> Have you tried creating a properties file for the panel,  
> Sidebar.properties?  By putting the value in your Index.properties  
> aren't you kind of breaking encapsulation by adding knowledge of the  
> panel's inner workings to the page?
>
> -----Original Message-----
> From: Robin Sander [mailto:robin.sander@gmx.net]
> Sent: Tuesday, August 04, 2009 10:54 AM
> To: users@wicket.apache.org
> Subject: Re: Label i18n in 1.4 final
>
>
> Hi,
>
> yes, this does work but would interfere with a page-level label called
> "header", doesn't it?
> That's why the component-path up to the page is used as a prefix, I
> thought...
>
>
> On 04.08.2009, at 16:21, Eyal Golan wrote:
>
>> As far as I remember, you need to call the proprty 'header'
>>
>> header = Sidebar Header!
>>
>>
>>
>> Eyal Golan
>> egolan74@gmail.com
>>
>> Visit: http://jvdrums.sourceforge.net/
>> LinkedIn: http://www.linkedin.com/in/egolan74
>>
>> P  Save a tree. Please don't print this e-mail unless it's really
>> necessary
>>
>>
>> On Tue, Aug 4, 2009 at 5:14 PM, Robin Sander <ro...@gmx.net>
>> wrote:
>>
>>>
>>> Hello,
>>>
>>> I'm trying to add internationalization to my wicket application  
>>> using
>>> Wicket 1.4 final.
>>> In order to customize labels I don't use wicket:message but use  
>>> Label
>>> subclasses.
>>>
>>> So, both the Wiki page "General i18n in Wicket" an Wicket in Action
>>> state
>>> that I may define
>>> a property file for a page, say Index.properties and define any  
>>> label
>>> resource in this file.
>>>
>>> So far so good, it seems to work as long as I don't have a label
>>> nested in
>>> a panel or in a form!
>>> Say I have a page Index and a panel Sidebar like this:
>>>
>>> public class Sidebar extends Panel {
>>>      public Sidebar(final String id) {
>>>              super(id);
>>>              add(new Label("header", new ResourceModel("header")));
>>>              ...
>>>     }
>>> }
>>>
>>> public class Index extends WebPage {
>>>      public Index() {
>>>              super();
>>>              add(new Sidebar("sidebar"));
>>>     }
>>> }
>>>
>>> Now, if I define
>>>
>>> sidebar.header = Sidebar Header!
>>>
>>> in a file 'Index.properties' a MissingResourceException is thrown.
>>> Does anybody know how to do it right?
>>>
>>> regards,
>>>
>>> Robin.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>
>
>
>
> ---------------------------------------------------------------------
> 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: Label i18n in 1.4 final

Posted by Craig McIlwee <cr...@openroadsconsulting.com>.
Have you tried creating a properties file for the panel, Sidebar.properties?  By putting the value in your Index.properties aren't you kind of breaking encapsulation by adding knowledge of the panel's inner workings to the page?

-----Original Message-----
From: Robin Sander [mailto:robin.sander@gmx.net] 
Sent: Tuesday, August 04, 2009 10:54 AM
To: users@wicket.apache.org
Subject: Re: Label i18n in 1.4 final


Hi,

yes, this does work but would interfere with a page-level label called  
"header", doesn't it?
That's why the component-path up to the page is used as a prefix, I  
thought...


On 04.08.2009, at 16:21, Eyal Golan wrote:

> As far as I remember, you need to call the proprty 'header'
>
> header = Sidebar Header!
>
>
>
> Eyal Golan
> egolan74@gmail.com
>
> Visit: http://jvdrums.sourceforge.net/
> LinkedIn: http://www.linkedin.com/in/egolan74
>
> P  Save a tree. Please don't print this e-mail unless it's really  
> necessary
>
>
> On Tue, Aug 4, 2009 at 5:14 PM, Robin Sander <ro...@gmx.net>  
> wrote:
>
>>
>> Hello,
>>
>> I'm trying to add internationalization to my wicket application using
>> Wicket 1.4 final.
>> In order to customize labels I don't use wicket:message but use Label
>> subclasses.
>>
>> So, both the Wiki page "General i18n in Wicket" an Wicket in Action  
>> state
>> that I may define
>> a property file for a page, say Index.properties and define any label
>> resource in this file.
>>
>> So far so good, it seems to work as long as I don't have a label  
>> nested in
>> a panel or in a form!
>> Say I have a page Index and a panel Sidebar like this:
>>
>> public class Sidebar extends Panel {
>>       public Sidebar(final String id) {
>>               super(id);
>>               add(new Label("header", new ResourceModel("header")));
>>               ...
>>      }
>> }
>>
>> public class Index extends WebPage {
>>       public Index() {
>>               super();
>>               add(new Sidebar("sidebar"));
>>      }
>> }
>>
>> Now, if I define
>>
>> sidebar.header = Sidebar Header!
>>
>> in a file 'Index.properties' a MissingResourceException is thrown.
>> Does anybody know how to do it right?
>>
>> regards,
>>
>> Robin.
>>
>>
>> ---------------------------------------------------------------------
>> 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




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Label i18n in 1.4 final

Posted by Robin Sander <ro...@gmx.net>.
Hi,

yes, this does work but would interfere with a page-level label called  
"header", doesn't it?
That's why the component-path up to the page is used as a prefix, I  
thought...


On 04.08.2009, at 16:21, Eyal Golan wrote:

> As far as I remember, you need to call the proprty 'header'
>
> header = Sidebar Header!
>
>
>
> Eyal Golan
> egolan74@gmail.com
>
> Visit: http://jvdrums.sourceforge.net/
> LinkedIn: http://www.linkedin.com/in/egolan74
>
> P  Save a tree. Please don't print this e-mail unless it's really  
> necessary
>
>
> On Tue, Aug 4, 2009 at 5:14 PM, Robin Sander <ro...@gmx.net>  
> wrote:
>
>>
>> Hello,
>>
>> I'm trying to add internationalization to my wicket application using
>> Wicket 1.4 final.
>> In order to customize labels I don't use wicket:message but use Label
>> subclasses.
>>
>> So, both the Wiki page "General i18n in Wicket" an Wicket in Action  
>> state
>> that I may define
>> a property file for a page, say Index.properties and define any label
>> resource in this file.
>>
>> So far so good, it seems to work as long as I don't have a label  
>> nested in
>> a panel or in a form!
>> Say I have a page Index and a panel Sidebar like this:
>>
>> public class Sidebar extends Panel {
>>       public Sidebar(final String id) {
>>               super(id);
>>               add(new Label("header", new ResourceModel("header")));
>>               ...
>>      }
>> }
>>
>> public class Index extends WebPage {
>>       public Index() {
>>               super();
>>               add(new Sidebar("sidebar"));
>>      }
>> }
>>
>> Now, if I define
>>
>> sidebar.header = Sidebar Header!
>>
>> in a file 'Index.properties' a MissingResourceException is thrown.
>> Does anybody know how to do it right?
>>
>> regards,
>>
>> Robin.
>>
>>
>> ---------------------------------------------------------------------
>> 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: Label i18n in 1.4 final

Posted by Eyal Golan <eg...@gmail.com>.
As far as I remember, you need to call the proprty 'header'

header = Sidebar Header!



Eyal Golan
egolan74@gmail.com

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary


On Tue, Aug 4, 2009 at 5:14 PM, Robin Sander <ro...@gmx.net> wrote:

>
> Hello,
>
> I'm trying to add internationalization to my wicket application using
> Wicket 1.4 final.
> In order to customize labels I don't use wicket:message but use Label
> subclasses.
>
> So, both the Wiki page "General i18n in Wicket" an Wicket in Action state
> that I may define
> a property file for a page, say Index.properties and define any label
> resource in this file.
>
> So far so good, it seems to work as long as I don't have a label nested in
> a panel or in a form!
> Say I have a page Index and a panel Sidebar like this:
>
> public class Sidebar extends Panel {
>        public Sidebar(final String id) {
>                super(id);
>                add(new Label("header", new ResourceModel("header")));
>                ...
>       }
> }
>
> public class Index extends WebPage {
>        public Index() {
>                super();
>                add(new Sidebar("sidebar"));
>       }
> }
>
> Now, if I define
>
> sidebar.header = Sidebar Header!
>
> in a file 'Index.properties' a MissingResourceException is thrown.
> Does anybody know how to do it right?
>
> regards,
>
> Robin.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>