You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Marek Šabo <ms...@buk.cvut.cz> on 2010/01/25 15:33:33 UTC

Localization properties overriding

Hi all,

I have a question regarding property binding when using localized 
property files, consider following:

UserHomePage page has one property for localization and that is 
"title=User's Home" which is then used in markup as:

<head>
<title><wicket:message key=""title" /></title>
</head>
...

This page has inside an UserAddPanel with form with following properties:

formContainer.uaForm.title=Title
formContainer.uaForm.name=First Name
...

for markup:

<wicket:panel>
<div wicket:id="formContainer">
<form wicket:id="uaForm">
<label for="title"><wicket:message key="title" /></label>
<label for="name"><wicket:message key="name" /></label>
...

The name and other labels are generated fine (no reason not to) but the 
title is set to "User's Home" which is not desired. I would understood 
this behavior if I hadn't defined such 'fine-grained' property as 
formContainer.uaForm.title but why is it overriden when there is precise 
declaration on lower level?
Is there a way to achieve behavior which I described or do I have to 
rename title in form to something else?

TIA,

Marek

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


Re: Localization properties overriding

Posted by Marek Šabo <ms...@buk.cvut.cz>.
Hi,

well I see where was the misunderstanding. The FIRST result found. What 
I'm used to when going from top to down is the LAST definition takes 
effect. Well maybe I will see to it when I will do some modules but for 
now I'll just rename it and won't use single name properties anymore to 
avoid this kind of problems.

Thanks


On 01/25/2010 04:05 PM, Erik van Oosten wrote:
> The search for any given property key is top-down, the first result is 
> found.
>
> Why? As I said, to allow an override of the component (which may be 
> third party).
>
> Regards,
>    Erik.
>
>
> Marek Šabo wrote:
>> Hi Erik,
>>
>> I understand this - I use it eg. HomePage has title=Home, 
>> UserHomePage has title=User's Home etc... and it works top->down as 
>> expected.
>>
>> But why does this topmost property title, that should bind itself to 
>> key=title of wicket:messages attached to page component itself, got 
>> bounded to title two levels deeper in hierarchy precisely defined in 
>> lower most level (top->down should use the last found, shouldn't 
>> it?). According to what happens my UserHomePage should read only 
>> "Home Page" in it's title
>>
>> Sorry to bother, regards,
>> Marek
>>
>>
>> On 01/25/2010 03:39 PM, Erik van Oosten wrote:
>>> He Marek,
>>>
>>> The idea of Wicket i18n is that when you use a component, you can 
>>> override its default texts with your own. That's why the lookup is 
>>> top-down and not bottom-up.
>>>
>>> To solve this you'll need to use a more fine-grained name for the 
>>> home page's title.
>>>
>>> Regards,
>>>    Erik.
>>>
>>>
>>>
>>> Marek Šabo write:
>>>> Hi all,
>>>>
>>>> I have a question regarding property binding when using localized 
>>>> property files, consider following:
>>>>
>>>> UserHomePage page has one property for localization and that is 
>>>> "title=User's Home" which is then used in markup as:
>>>>
>>>> <head>
>>>> <title><wicket:message key=""title" /></title>
>>>> </head>
>>>> ...
>>>>
>>>> This page has inside an UserAddPanel with form with following 
>>>> properties:
>>>>
>>>> formContainer.uaForm.title=Title
>>>> formContainer.uaForm.name=First Name
>>>> ...
>>>>
>>>> for markup:
>>>>
>>>> <wicket:panel>
>>>> <div wicket:id="formContainer">
>>>> <form wicket:id="uaForm">
>>>> <label for="title"><wicket:message key="title" /></label>
>>>> <label for="name"><wicket:message key="name" /></label>
>>>> ...
>>>>
>>>> The name and other labels are generated fine (no reason not to) but 
>>>> the title is set to "User's Home" which is not desired. I would 
>>>> understood this behavior if I hadn't defined such 'fine-grained' 
>>>> property as formContainer.uaForm.title but why is it overriden when 
>>>> there is precise declaration on lower level?
>>>> Is there a way to achieve behavior which I described or do I have 
>>>> to rename title in form to something else?
>>>>
>>>> TIA,
>>>>
>>>> Marek
>


-- 
Marek Šabo
Chief Server Manager
Club SU CTU Buben
Bubenečská Kolej
Terronská 28, Prague 16000
XMPP: zeratul021@gmail.com


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


Re: Localization properties overriding

Posted by Erik van Oosten <e....@grons.nl>.
The search for any given property key is top-down, the first result is 
found.

Why? As I said, to allow an override of the component (which may be 
third party).

Regards,
    Erik.


Marek Šabo wrote:
> Hi Erik,
>
> I understand this - I use it eg. HomePage has title=Home, UserHomePage 
> has title=User's Home etc... and it works top->down as expected.
>
> But why does this topmost property title, that should bind itself to 
> key=title of wicket:messages attached to page component itself, got 
> bounded to title two levels deeper in hierarchy precisely defined in 
> lower most level (top->down should use the last found, shouldn't it?). 
> According to what happens my UserHomePage should read only "Home Page" 
> in it's title
>
> Sorry to bother, regards,
> Marek
>
>
> On 01/25/2010 03:39 PM, Erik van Oosten wrote:
>> He Marek,
>>
>> The idea of Wicket i18n is that when you use a component, you can 
>> override its default texts with your own. That's why the lookup is 
>> top-down and not bottom-up.
>>
>> To solve this you'll need to use a more fine-grained name for the 
>> home page's title.
>>
>> Regards,
>>    Erik.
>>
>>
>>
>> Marek Šabo write:
>>> Hi all,
>>>
>>> I have a question regarding property binding when using localized 
>>> property files, consider following:
>>>
>>> UserHomePage page has one property for localization and that is 
>>> "title=User's Home" which is then used in markup as:
>>>
>>> <head>
>>> <title><wicket:message key=""title" /></title>
>>> </head>
>>> ...
>>>
>>> This page has inside an UserAddPanel with form with following 
>>> properties:
>>>
>>> formContainer.uaForm.title=Title
>>> formContainer.uaForm.name=First Name
>>> ...
>>>
>>> for markup:
>>>
>>> <wicket:panel>
>>> <div wicket:id="formContainer">
>>> <form wicket:id="uaForm">
>>> <label for="title"><wicket:message key="title" /></label>
>>> <label for="name"><wicket:message key="name" /></label>
>>> ...
>>>
>>> The name and other labels are generated fine (no reason not to) but 
>>> the title is set to "User's Home" which is not desired. I would 
>>> understood this behavior if I hadn't defined such 'fine-grained' 
>>> property as formContainer.uaForm.title but why is it overriden when 
>>> there is precise declaration on lower level?
>>> Is there a way to achieve behavior which I described or do I have to 
>>> rename title in form to something else?
>>>
>>> TIA,
>>>
>>> Marek

-- 
Erik van Oosten
http://day-to-day-stuff.blogspot.com/



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


Re: Localization properties overriding

Posted by Marek Šabo <ms...@buk.cvut.cz>.
Hi Erik,

I understand this - I use it eg. HomePage has title=Home, UserHomePage 
has title=User's Home etc... and it works top->down as expected.

But why does this topmost property title, that should bind itself to 
key=title of wicket:messages attached to page component itself, got 
bounded to title two levels deeper in hierarchy precisely defined in 
lower most level (top->down should use the last found, shouldn't it?). 
According to what happens my UserHomePage should read only "Home Page" 
in it's title

Sorry to bother, regards,
Marek


On 01/25/2010 03:39 PM, Erik van Oosten wrote:
> He Marek,
>
> The idea of Wicket i18n is that when you use a component, you can 
> override its default texts with your own. That's why the lookup is 
> top-down and not bottom-up.
>
> To solve this you'll need to use a more fine-grained name for the home 
> page's title.
>
> Regards,
>    Erik.
>
>
>
> Marek Šabo write:
>> Hi all,
>>
>> I have a question regarding property binding when using localized 
>> property files, consider following:
>>
>> UserHomePage page has one property for localization and that is 
>> "title=User's Home" which is then used in markup as:
>>
>> <head>
>> <title><wicket:message key=""title" /></title>
>> </head>
>> ...
>>
>> This page has inside an UserAddPanel with form with following 
>> properties:
>>
>> formContainer.uaForm.title=Title
>> formContainer.uaForm.name=First Name
>> ...
>>
>> for markup:
>>
>> <wicket:panel>
>> <div wicket:id="formContainer">
>> <form wicket:id="uaForm">
>> <label for="title"><wicket:message key="title" /></label>
>> <label for="name"><wicket:message key="name" /></label>
>> ...
>>
>> The name and other labels are generated fine (no reason not to) but 
>> the title is set to "User's Home" which is not desired. I would 
>> understood this behavior if I hadn't defined such 'fine-grained' 
>> property as formContainer.uaForm.title but why is it overriden when 
>> there is precise declaration on lower level?
>> Is there a way to achieve behavior which I described or do I have to 
>> rename title in form to something else?
>>
>> TIA,
>>
>> Marek
>>
>>
>


-- 
Marek Šabo
Chief Server Manager
Club SU CTU Buben
Bubenečská Kolej
Terronská 28, Prague 16000
XMPP: zeratul021@gmail.com


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


Re: Localization properties overriding

Posted by Erik van Oosten <e....@grons.nl>.
He Marek,

The idea of Wicket i18n is that when you use a component, you can 
override its default texts with your own. That's why the lookup is 
top-down and not bottom-up.

To solve this you'll need to use a more fine-grained name for the home 
page's title.

Regards,
    Erik.



Marek Šabo write:
> Hi all,
>
> I have a question regarding property binding when using localized 
> property files, consider following:
>
> UserHomePage page has one property for localization and that is 
> "title=User's Home" which is then used in markup as:
>
> <head>
> <title><wicket:message key=""title" /></title>
> </head>
> ...
>
> This page has inside an UserAddPanel with form with following properties:
>
> formContainer.uaForm.title=Title
> formContainer.uaForm.name=First Name
> ...
>
> for markup:
>
> <wicket:panel>
> <div wicket:id="formContainer">
> <form wicket:id="uaForm">
> <label for="title"><wicket:message key="title" /></label>
> <label for="name"><wicket:message key="name" /></label>
> ...
>
> The name and other labels are generated fine (no reason not to) but 
> the title is set to "User's Home" which is not desired. I would 
> understood this behavior if I hadn't defined such 'fine-grained' 
> property as formContainer.uaForm.title but why is it overriden when 
> there is precise declaration on lower level?
> Is there a way to achieve behavior which I described or do I have to 
> rename title in form to something else?
>
> TIA,
>
> Marek
>
>

-- 
Erik van Oosten
http://day-to-day-stuff.blogspot.com/



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