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:
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:
The HTML of the ExtendedSamplePanel is something like this:
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.
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.