Overriding string resources works incorrectly

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Overriding string resources works incorrectly

Sergiy Barlabanov
Hi,
In a page properties file I want to override some string resource from a component properties file. So I append the component ID as a prefix to the original key of the property I want to override:
original key in the SamplePanel is "title". In the page properties file the following property is defined:
samplePanel.title=xxx. "samplePanel" is the ID of the component included in the page. Actually it should work. But it does not. If I switch on debug logs, I see that Wicket tries to resolve the following property key:
samplePanel._wicket_child3._wicket_extend4.title

The problem is, that there are several TransparentWebMarkupContainers along the path from the page to the title message (HomePage includes an instance of ExtendedSamplePanel, which extends SamplePanel).

I do not think, that this is the way it should work, isn't it?
The same applies, if I put other components like Link, WebMarkupContainers in between. In order to override the properties in the page I have to set the key to something like:
samplePanel.someWebMarkupContainer1.someWebMarkupContainer2.title.
The HTML of the ExtendedSamplePanel is something like this:

<wicket:extend>
    <div wicket:id="someWebMarkupContainer1">
        <div wicket:id="someWebMarkupContainer2">
             <wicket:message key="title"/>
        </div>
    </div>
</wicket:extend>

HomePage:

<body>
    <div wicket:id="samplePanel"></div>
</body>

As far as I remember, it did work in Wicket 1.4.x. I could just put "samplePanel.title" into HomePage.properties and it did resolve the property correctly without all those containers in between from ExtendedSamplePanel component tree.

Best regards,
Sergiy
Reply | Threaded
Open this post in threaded view
|

Re: Overriding string resources works incorrectly

Sergiy Barlabanov
Seems that it is because of the usage of wicket:message tag. In order to provide possibility to override component string resources, I have to use StringResourceModel for the title of the samplePanel and specify the correct relative component.