[ 
https://issues.apache.org/jira/browse/LANG-1172?focusedWorklogId=678855&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-678855
 ]

ASF GitHub Bot logged work on LANG-1172:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 09/Nov/21 02:02
            Start Date: 09/Nov/21 02:02
    Worklog Time Spent: 10m 
      Work Description: c-w commented on a change in pull request #766:
URL: https://github.com/apache/commons-lang/pull/766#discussion_r745230053



##########
File path: src/main/java/org/apache/commons/lang3/LocaleUtils.java
##########
@@ -324,7 +327,7 @@ public static Locale toLocale(final String str) {
             throw new IllegalArgumentException("Invalid locale format: " + 
str);
         }
         final char ch0 = str.charAt(0);
-        if (ch0 == '_') {
+        if (ch0 == '_' || ch0 == '-') {

Review comment:
       Added the constant in 730e156. I'd prefer not to add the helper method 
to avoid changing too much of the structure as part of this fairly minor 
overall change.

##########
File path: src/main/java/org/apache/commons/lang3/LocaleUtils.java
##########
@@ -248,7 +248,9 @@ private static Locale parseLocale(final String str) {
             return new Locale(str);
         }
 
-        final String[] segments = str.split("_", -1);
+        final String[] segments = str.contains("-")
+            ? str.split("-", -1)

Review comment:
       Done in 730e156.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 678855)
    Time Spent: 2h  (was: 1h 50m)

> LocaleUtils.toLocale does not handle extensions
> -----------------------------------------------
>
>                 Key: LANG-1172
>                 URL: https://issues.apache.org/jira/browse/LANG-1172
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 3.3
>            Reporter: David Buhler
>            Priority: Major
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> The {{toLocale()}} method is unable to handle locale strings that have custom 
> extensions that are completely valid according to the [BCP47 
> spec|https://tools.ietf.org/html/bcp47#section-4]. Oracle documentation for 
> sub tag extensions can be [found 
> here|https://docs.oracle.com/javase/tutorial/i18n/locale/extensions.html].
> An example locale string with a custom extension might be {{fr-CA-x-nb}}.
> This issue seems to have been introduced with ticket LANG-915.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to