[
https://issues.apache.org/jira/browse/SLING-8802?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16995547#comment-16995547
]
Jörg Hoh commented on SLING-8802:
---------------------------------
To be formally correct, the documentation only mentions the semantics of
{{getResourceBundle(String,Locale)}}, but not the semantics of
{{getResourceBundle(Locale)}}. But the API docs of the 2-parameter methods
mentions that with the string being {{null}} it returns the same result as the
method with only 1 parameter [1].
That means, that with the current way to deal my proposed change would break
the existing semantics. Extending the API would not work, as I would like to
have exactly that change
(Our usecase: I have an existing application which uses i18n and which comes
with it's own set of resourceBundles. The part of the application we control
needs different translations, thus we specified new ResourceBundles with a
different basename for the same locale, and that works great in our part,
because we explicitly specify the basename. But on the part we don't control no
basename is specified, thus it's reusing "our" translations as well, which
shouldn't happen.)
So, what does it require to actually break the backwards compatibility? From
what I see there have been attempts to achieve the very same behavior already
(SLING-7429), but there hasn't been progress on that.
[1]https://sling.apache.org/apidocs/sling8/org/apache/sling/i18n/ResourceBundleProvider.html#getResourceBundle-java.lang.String-java.util.Locale-
> JcrResourceBundle should not consider dictionaries with a basename, if no
> basename is provided
> ----------------------------------------------------------------------------------------------
>
> Key: SLING-8802
> URL: https://issues.apache.org/jira/browse/SLING-8802
> Project: Sling
> Issue Type: Improvement
> Components: i18n
> Affects Versions: i18n 2.5.14
> Reporter: Jörg Hoh
> Priority: Major
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> In a situation where 2 dictionaries are available (one with a basename
> configured, the other without any basename), the {{JcrResourceBundle}} will
> load (and merge) both if no basename is provided (see [1]).
> This breaks applications where basenames are used to separate multiple
> ResourceBundles from each other, and there are definitely cases where the
> basename is not provided (and thu assumed as {{null}}).
> I would propose to make the behavior consistent and return only dictionaries
> with no basename configured if basename is null.
> [1]
> https://github.com/apache/sling-org-apache-sling-i18n/blob/master/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundle.java#L340
--
This message was sent by Atlassian Jira
(v8.3.4#803005)