[
https://issues.apache.org/jira/browse/WICKET-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13135097#comment-13135097
]
Peter Ertl commented on WICKET-4167:
------------------------------------
I see two possible approaches to address your problem:
---------------
The first one is to define your package-scoped properties _without_ prefix
0=bad
1=good
which will work even when nested inside a markup container. Only when you add
prefixes like "testSelect.1" to the key hierarchy-independent lookup will fail.
Maybe you should use more explicit keys to avoid naming collision like
badChoice=This is a bad choice
goodChoice=This is the good choice
---------------
The second approach is to create a custom MyDropDownChoice and add
MyDropDownChoice.properties at the same package with e.g. this content
0=bad
1=good
which will be related to the component and not depend on where the component is
added. So you have nice defaults for your component but still override the
values where you need it.
---------------
I think this issue is not a problem and will close it for now. If you think
this is wrong add a comment to reopen it.
> WebMarkupContainer breaks message-lookup algorithm
> -----------------------------------------------------
>
> Key: WICKET-4167
> URL: https://issues.apache.org/jira/browse/WICKET-4167
> Project: Wicket
> Issue Type: Bug
> Affects Versions: 1.5.2
> Reporter: Andrea Del Bene
> Priority: Minor
> Attachments: QuickStart.zip
>
>
> I've got a little problem with message lookup. The case is the following:
> I've got a simple DropDownChoice (wicket id = testSelect) with some values,
> let's say "0" and "1". I want to localize these value in order to display
> "Sorry, it's bad" for zero and "Ok, its good!" for one. Since I want to reuse
> these bundle in other components and I don't want to insert them into
> Application.properties, the natural choice is to create a package.properties
> file inside common package of my application components. The bundles are the
> following:
> testSelect.0=Sorry, it's bad
> testSelect.1=Ok, its good!
> Ok, everything works fine for my testSelect and wicket supports this kind of
> customization. The problem arise when I decide to not add testSelect directly
> to my page but instead to add it to a WebMarkupContainer which groups other
> form components.
> Unfortunately now testSelect localization stops working. Since
> WebMarkupContainer is not inside my application components package, now
> PackageStringResourceLoader search the right key (ex: testSelect.0) in the
> wrong package (i.e. org.apache.wicket.markup.html).
> Is this a known issue? Can we modify PackageStringResourceLoader in order to
> extend key search across all loaded bundles (or at least across all parents
> bundles)? Any other idea?
> PS: an obvious workaround is to create a subclass of WebMarkupContainer in
> our custom package.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira