[
https://issues.apache.org/jira/browse/WICKET-4162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13137407#comment-13137407
]
Bertrand Guay-Paquet commented on WICKET-4162:
----------------------------------------------
In response to the first problem:
In fact this is an intentional feature. Consider the case where I subclass
DataTable in my app's jar. I still want to benefit from the strings in
wicket-extensions for it.
In response to the second problem:
You are right. Here is what UploadStatusResource uses to lookup a string
(simplified):
new StringResourceModel(
"UploadStatusResource.status",
(Component)null,
Model.of(info),
"default value").getString();
Down the line, when the JarStringResourceLoader is called, it doesn't have any
practical means of finding which jar should be inspected because the component
is null.
I see 2 options, neither of which I like:
1-Walk up the call stack before Localizer and StringResourceModel to find in
which jar the getString() call originated. I haven't researched this one much
so I am not sure it is even feasible.
2-When the component is null, infer the class whose jar must be inspected based
on the resource key. For example, the key from the example above would need to
be changed to
"org.apache.wicket.extensions.ajax.markup.html.form.upload.UploadStatusResource.status".
To allow for "." in the resource key (e.g. status.success), the inferring
process would need to walk up the key string along '.' character boundaries.
Is there another way?
> Add new StringResourceLoader to allow Wicket extensions to provide
> localization resource bundles
> ------------------------------------------------------------------------------------------------
>
> Key: WICKET-4162
> URL: https://issues.apache.org/jira/browse/WICKET-4162
> Project: Wicket
> Issue Type: New Feature
> Components: wicket
> Affects Versions: 1.5.1
> Reporter: Bertrand Guay-Paquet
> Assignee: Sven Meier
> Labels: extension, localization
> Attachments: jar_resource.patch
>
>
> Issue:
> It is currently not possible to provide default localization resource bundles
> for components in wicket extension modules (e.g. wicket-extensions). See
> issues WICKET-3911 and WICKET-4154 where this was a problem.
> Proposed changes:
> 1-Add a new IStringResourceLoader type (WicketExtensionStringResourceLoader?)
> which checks the root of the jar containing the component for properties in
> extension.properties.
> 2-Insert this new resource loader in the existing default resource loader
> chain:
> ResourceSettings() constructor:
> stringResourceLoaders.add(new ComponentStringResourceLoader());
> stringResourceLoaders.add(new PackageStringResourceLoader());
> stringResourceLoaders.add(new
> ClassStringResourceLoader(application.getClass()));
> // New loader inserted here
> stringResourceLoaders.add(new
> WicketExtensionStringResourceLoader());
> stringResourceLoaders.add(new ValidatorStringResourceLoader());
> 3-Start adding extension.properties files in wicket-extension and friends.
> Questions:
> Is a similar effort already underway?
> Are there any better ideas?
> Should the new loader be inserted at the end of the chain instead?
> Do you prefer other names for the loader or the properties file?
> I am prepared to provide a patch sometime next week if this is agreed on.
--
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