You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Shelah Horvitz <Sh...@blackwave.tv> on 2009/05/04 20:02:17 UTC

Internationalized titles

I want to internationalize the title of my application, so that I would get its value from a properties file, and the HTML would look something like:

<head>
  <title><span wicket:id="appTitle"></span></title>
</head>

It doesn't look like I can use a header contributor to do this sort of thing, so how is it done?

Thanks for your help.

Shelah

RE: Internationalized titles

Posted by Shelah Horvitz <Sh...@blackwave.tv>.
Many thanks!

________________________________________
From: Jeremy Thomerson [jeremy@wickettraining.com]
Sent: Monday, May 04, 2009 2:08 PM
To: users@wicket.apache.org
Subject: Re: Internationalized titles

add(new Label("appTitle", new ResourceModel("your.title.key"));

also, change your html:
<title wicket:id="appTitle">this will be replaced</title>

Of course, if you don't use markup inheritance, you'll need to repeat
this throughout each page.

--
Jeremy Thomerson
http://www.wickettraining.com




On Mon, May 4, 2009 at 1:02 PM, Shelah Horvitz
<Sh...@blackwave.tv> wrote:
> I want to internationalize the title of my application, so that I would get its value from a properties file, and the HTML would look something like:
>
> <head>
>  <title><span wicket:id="appTitle"></span></title>
> </head>
>
> It doesn't look like I can use a header contributor to do this sort of thing, so how is it done?
>
> Thanks for your help.
>
> Shelah
>

---------------------------------------------------------------------
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: Internationalized titles

Posted by Luther Baker <lu...@gmail.com>.
I've setup and used this approach with success as well ...
public class ChildPage extends MasterLayoutPage
{
    public ChildPage()
    {
       super(new Model ...);
    }

One interesting factoid ... depending on how you actually mark this up,
DEVELOPMENT mode can look a bit screwy. It is my experience that the wicket
markup tags actually render in the title bar. I believe that was one problem
I had with using something like

    <title><wicket:message.../></title>

-Luther


On Mon, May 4, 2009 at 5:01 PM, Jeremy Thomerson
<je...@wickettraining.com>wrote:

> Yeah - that's what I've done on several sites.
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
>
> On Mon, May 4, 2009 at 2:38 PM, James Carman
> <jc...@carmanconsulting.com> wrote:
> > One reason would be to let subclasses actually override it with a more
> > complex model, if need be.  The method in the superclass (assuming
> > you're using markup inheritance) would be like this:
> >
> > public IModel<String> getTitleModel()
> > {
> >  return new ResourceModel("page.title", "[TITLE]");
> > }
> >
> > But, subclasses could override this in case they have something else
> > they want to display in the title (with other information from the
> > current page for example).
> >
> > On Mon, May 4, 2009 at 3:33 PM, Martijn Dashorst
> > <ma...@gmail.com> wrote:
> >> why not use a <wicket:message> ?
> >>
> >> Martijn
> >>
> >> On Mon, May 4, 2009 at 8:08 PM, Jeremy Thomerson
> >> <je...@wickettraining.com> wrote:
> >>> add(new Label("appTitle", new ResourceModel("your.title.key"));
> >>>
> >>> also, change your html:
> >>> <title wicket:id="appTitle">this will be replaced</title>
> >>>
> >>> Of course, if you don't use markup inheritance, you'll need to repeat
> >>> this throughout each page.
> >>>
> >>> --
> >>> Jeremy Thomerson
> >>> http://www.wickettraining.com
> >>>
> >>>
> >>>
> >>>
> >>> On Mon, May 4, 2009 at 1:02 PM, Shelah Horvitz
> >>> <Sh...@blackwave.tv> wrote:
> >>>> I want to internationalize the title of my application, so that I
> would get its value from a properties file, and the HTML would look
> something like:
> >>>>
> >>>> <head>
> >>>>  <title><span wicket:id="appTitle"></span></title>
> >>>> </head>
> >>>>
> >>>> It doesn't look like I can use a header contributor to do this sort of
> thing, so how is it done?
> >>>>
> >>>> Thanks for your help.
> >>>>
> >>>> Shelah
> >>>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>
> >>>
> >>
> >>
> >>
> >> --
> >> Become a Wicket expert, learn from the best: http://wicketinaction.com
> >> Apache Wicket 1.3.5 is released
> >> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
> >>
> >> ---------------------------------------------------------------------
> >> 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: Internationalized titles

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Yeah - that's what I've done on several sites.

--
Jeremy Thomerson
http://www.wickettraining.com




On Mon, May 4, 2009 at 2:38 PM, James Carman
<jc...@carmanconsulting.com> wrote:
> One reason would be to let subclasses actually override it with a more
> complex model, if need be.  The method in the superclass (assuming
> you're using markup inheritance) would be like this:
>
> public IModel<String> getTitleModel()
> {
>  return new ResourceModel("page.title", "[TITLE]");
> }
>
> But, subclasses could override this in case they have something else
> they want to display in the title (with other information from the
> current page for example).
>
> On Mon, May 4, 2009 at 3:33 PM, Martijn Dashorst
> <ma...@gmail.com> wrote:
>> why not use a <wicket:message> ?
>>
>> Martijn
>>
>> On Mon, May 4, 2009 at 8:08 PM, Jeremy Thomerson
>> <je...@wickettraining.com> wrote:
>>> add(new Label("appTitle", new ResourceModel("your.title.key"));
>>>
>>> also, change your html:
>>> <title wicket:id="appTitle">this will be replaced</title>
>>>
>>> Of course, if you don't use markup inheritance, you'll need to repeat
>>> this throughout each page.
>>>
>>> --
>>> Jeremy Thomerson
>>> http://www.wickettraining.com
>>>
>>>
>>>
>>>
>>> On Mon, May 4, 2009 at 1:02 PM, Shelah Horvitz
>>> <Sh...@blackwave.tv> wrote:
>>>> I want to internationalize the title of my application, so that I would get its value from a properties file, and the HTML would look something like:
>>>>
>>>> <head>
>>>>  <title><span wicket:id="appTitle"></span></title>
>>>> </head>
>>>>
>>>> It doesn't look like I can use a header contributor to do this sort of thing, so how is it done?
>>>>
>>>> Thanks for your help.
>>>>
>>>> Shelah
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>>
>>
>> --
>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>> Apache Wicket 1.3.5 is released
>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>>
>> ---------------------------------------------------------------------
>> 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: Internationalized titles

Posted by James Carman <jc...@carmanconsulting.com>.
One reason would be to let subclasses actually override it with a more
complex model, if need be.  The method in the superclass (assuming
you're using markup inheritance) would be like this:

public IModel<String> getTitleModel()
{
  return new ResourceModel("page.title", "[TITLE]");
}

But, subclasses could override this in case they have something else
they want to display in the title (with other information from the
current page for example).

On Mon, May 4, 2009 at 3:33 PM, Martijn Dashorst
<ma...@gmail.com> wrote:
> why not use a <wicket:message> ?
>
> Martijn
>
> On Mon, May 4, 2009 at 8:08 PM, Jeremy Thomerson
> <je...@wickettraining.com> wrote:
>> add(new Label("appTitle", new ResourceModel("your.title.key"));
>>
>> also, change your html:
>> <title wicket:id="appTitle">this will be replaced</title>
>>
>> Of course, if you don't use markup inheritance, you'll need to repeat
>> this throughout each page.
>>
>> --
>> Jeremy Thomerson
>> http://www.wickettraining.com
>>
>>
>>
>>
>> On Mon, May 4, 2009 at 1:02 PM, Shelah Horvitz
>> <Sh...@blackwave.tv> wrote:
>>> I want to internationalize the title of my application, so that I would get its value from a properties file, and the HTML would look something like:
>>>
>>> <head>
>>>  <title><span wicket:id="appTitle"></span></title>
>>> </head>
>>>
>>> It doesn't look like I can use a header contributor to do this sort of thing, so how is it done?
>>>
>>> Thanks for your help.
>>>
>>> Shelah
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.3.5 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>
> ---------------------------------------------------------------------
> 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: Internationalized titles

Posted by Martijn Dashorst <ma...@gmail.com>.
why not use a <wicket:message> ?

Martijn

On Mon, May 4, 2009 at 8:08 PM, Jeremy Thomerson
<je...@wickettraining.com> wrote:
> add(new Label("appTitle", new ResourceModel("your.title.key"));
>
> also, change your html:
> <title wicket:id="appTitle">this will be replaced</title>
>
> Of course, if you don't use markup inheritance, you'll need to repeat
> this throughout each page.
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
>
> On Mon, May 4, 2009 at 1:02 PM, Shelah Horvitz
> <Sh...@blackwave.tv> wrote:
>> I want to internationalize the title of my application, so that I would get its value from a properties file, and the HTML would look something like:
>>
>> <head>
>>  <title><span wicket:id="appTitle"></span></title>
>> </head>
>>
>> It doesn't look like I can use a header contributor to do this sort of thing, so how is it done?
>>
>> Thanks for your help.
>>
>> Shelah
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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


Re: Internationalized titles

Posted by Jeremy Thomerson <je...@wickettraining.com>.
add(new Label("appTitle", new ResourceModel("your.title.key"));

also, change your html:
<title wicket:id="appTitle">this will be replaced</title>

Of course, if you don't use markup inheritance, you'll need to repeat
this throughout each page.

--
Jeremy Thomerson
http://www.wickettraining.com




On Mon, May 4, 2009 at 1:02 PM, Shelah Horvitz
<Sh...@blackwave.tv> wrote:
> I want to internationalize the title of my application, so that I would get its value from a properties file, and the HTML would look something like:
>
> <head>
>  <title><span wicket:id="appTitle"></span></title>
> </head>
>
> It doesn't look like I can use a header contributor to do this sort of thing, so how is it done?
>
> Thanks for your help.
>
> Shelah
>

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