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

Konrad Windszus edited comment on SLING-5781 at 6/28/16 10:21 AM:
------------------------------------------------------------------

So basically in the past {{jcr:language}} only supported {{Locale.toString()}} 
compliant strings (while it should have supported BCP 47 compliant strings as 
well).

To support BCP 47 as well all '-' characters should be replaced by '_' first.


was (Author: kwin):
The {{JcrResourceBundle.toLocale}} method should be simplified instead to first 
try to use 
https://docs.oracle.com/javase/7/docs/api/java/util/Locale.Builder.html#setLanguageTag(java.lang.String)
 and then fall back to 
https://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/LocaleUtils.html#toLocale(java.lang.String).
 

So basically in the past {{jcr:language}} only supported Locale.toString() 
compliant strings (while it should have supported BCP 47 compliant strings as 
well).

> [i18n] generating locale from a string is incorrect
> ---------------------------------------------------
>
>                 Key: SLING-5781
>                 URL: https://issues.apache.org/jira/browse/SLING-5781
>             Project: Sling
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: i18n 2.4.6
>            Reporter: Ankit Agarwal
>
> As per sling document here 
> https://sling.apache.org/documentation/bundles/internationalization-support-i18n.html
> parts of locale string are separated by hyphen ("-") like de-DE-MAC but in 
> JCRResourceBundleProvider while extracting locale from a String we are 
> separating parts with underscore ("_") as done here 
> https://github.com/apache/sling/blob/trunk/bundles/extensions/i18n/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java#L586
> Should this be change to separate string on "-" basis ?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to