Hi All,
  Following up on this as LANG-1172 changed the previously declared contract of 
this method.
Prior to 2.13, the logic and javadocs clearly stated that the separator must be 
underscore, but with this change it now also excepts dash.

Javadocs from 2.12:
"This method validates the input strictly. The language code must be lowercase. 
The country code must be uppercase. The separator must be an underscore. The 
length must be correct.”

This changed the contract and breaks code that were previous using this method 
to verify that their locale strings did not have dash, which was sometimes done 
to differentiate between locales and language tags.
However, the new behavior implies that locales and language tags are fully 
interchangeable, which is also not the case.
While I agree it would be useful to have a method that supported conversion of 
both representations, it would be better to provide that as a new method rather 
than break the existing contract.

TY
Josh


Gary D. Gregory - Wednesday, September 4, 2024 6:51:00 AM PDT

[lang][LANG-1172] Back and forth on LocaleUtils.toLocale()
Hi All,

I'd like to settle on the implementation of LocaleUtils.toLocale() one way or 
another and clearly document expectations.

What should we do?

Please see:
- https://issues.apache.org/jira/browse/LANG-1172
- https://github.com/apache/commons-lang/pull/766
- https://github.com/apache/commons-lang/pull/1271

TY!
Gary

Reply via email to