You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Konrad Windszus (JIRA)" <ji...@apache.org> on 2018/10/09 19:43:00 UTC
[jira] [Comment Edited] (SLING-7429) Improve basename handling
[ https://issues.apache.org/jira/browse/SLING-7429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16644001#comment-16644001 ]
Konrad Windszus edited comment on SLING-7429 at 10/9/18 7:43 PM:
-----------------------------------------------------------------
There are already two methods within {{ResourceBundleProvider}} (https://github.com/apache/sling-org-apache-sling-i18n/blob/master/src/main/java/org/apache/sling/i18n/ResourceBundleProvider.java)
# {{ResourceBundle getResourceBundle(Locale locale);}} and
# {{ResourceBundle getResourceBundle(String baseName, Locale locale);}}
The 2nd one states in the javadoc
{code}
* @param baseName The base name for the resource bundle. If this is
* <code>null</code>, the same resource bundle will be
* returned as when calling the
* {@link #getResourceBundle(Locale)} method.
{code}
So in fact in the javadoc there is not even a reference to the empty string. Even in the code I don't find any reference (at least any longer). It seems that this commit https://github.com/apache/sling-org-apache-sling-i18n/commit/14fd345666afccdf990a625a5517b57571213c99#diff-4a73b3fae7dd1d27c037456858d5e603 slightly changed the semantics anyway. Prior to this commit it was rather
# {{null}} and {{""}} behave the same, afterwards
# selects messages of mix:language nodes which have sling:basename properties with the empty value.
Unfortunately there doesn't seem to be a good IT validating the empty string semantics for the base name.
Let me first come up with an IT validating my assumptions based on code inspection.
was (Author: kwin):
There are already two methods within {{ResourceBundleProvider}} (https://github.com/apache/sling-org-apache-sling-i18n/blob/master/src/main/java/org/apache/sling/i18n/ResourceBundleProvider.java)
# {{ResourceBundle getResourceBundle(Locale locale);}} and
# {{ResourceBundle getResourceBundle(String baseName, Locale locale);}}
The 2nd one states in the javadoc
{code}
* @param baseName The base name for the resource bundle. If this is
* <code>null</code>, the same resource bundle will be
* returned as when calling the
* {@link #getResourceBundle(Locale)} method.
{code}
So in fact in the javadoc there is not even a reference to the empty string. Even in the code I don't find any reference (at least any longer). It seems that this commit https://github.com/apache/sling-org-apache-sling-i18n/commit/14fd345666afccdf990a625a5517b57571213c99#diff-4a73b3fae7dd1d27c037456858d5e603 slightly changed the semantics anyway. Prior to this commit it was rather
# {null} and {""} behave the same, afterwards
# selects messages of mix:language nodes which have sling:basename properties with the empty value.
Unfortunately there doesn't seem to be a good IT validating the empty string semantics for the base name.
Let me first come up with an IT validating my assumptions based on code inspection.
> Improve basename handling
> -------------------------
>
> Key: SLING-7429
> URL: https://issues.apache.org/jira/browse/SLING-7429
> Project: Sling
> Issue Type: Improvement
> Components: i18n
> Affects Versions: i18n 2.5.12
> Reporter: Konrad Windszus
> Priority: Major
>
> Right now the basename handling according to https://sling.apache.org/documentation/bundles/internationalization-support-i18n.html#resourcebundle-with-base-names is as follows
> {quote}
> The base name argument can take one three values:
> # {{null}}, selects messages of mix:language nodes ignoring the existence or absence of sling:basename properties
> # Empty String, selects messages of mix:language nodes which have sling:basename properties, ignoring the actual values
> # Any other Value, selects messages of mix:language nodes whose sling:basename properties has any value which matches the base name string
> {quote}
> I think it should somehow be also possible for a client to explicitly select a resource bundle which is not having the {{sling:basename}} property set.
> This was originally triggered from https://issues.apache.org/jira/browse/SLING-7421?focusedCommentId=16335686&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16335686.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)