[ 
https://issues.apache.org/jira/browse/SLING-2536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13584302#comment-13584302
 ] 

Alexander Klimetschek commented on SLING-2536:
----------------------------------------------

No, it does not return the en dictionary - it sets some parent bundles (see 
below). You probably want to change the default locale from "en" to something 
else that you do not provide dictionaries in the JCR repository for (osgi 
config "locale.default" of 
org.apache.sling.i18n.impl.JcrResourceBundleProvider).

AFAIK, it's this ancestry for "de-ch-foo" – which has country + a made up 
variant (root at bottom):
- "de-ch-foo" bundle
- "de-ch" bundle
- "de" bundle
- default locale ("en" ootb)
- root resource bundle => returns key itself

If you really need a "classic" resource bundle mechanism, you probably want to 
hook in your custom ResourceBundleProvider service (with a higher service rank) 
so that it ends up in SlingHttpServletRequest.getResourceBundle() (or directly 
use that other mechanism in the JSP/tag/UI layer).

https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/i18n/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java
                
> JcrResourceBundle breaks the contract of getLocale
> --------------------------------------------------
>
>                 Key: SLING-2536
>                 URL: https://issues.apache.org/jira/browse/SLING-2536
>             Project: Sling
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: i18n 2.2.2
>            Reporter: Endolf
>
> The javadoc for getLocale state that it should return the locale of this 
> bundle or the locale of the fallback. Currently JcrResourceBundle always 
> returns the requested locale even if there is no mix:language for that locale.
> e.g. Only a mix:language with a jcr:language en is in the jcr, a request for 
> a resource bundle of sv will return a ResourceBundle object where getLocale 
> returns sv. This should return en according to the javadoc.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to