RFR: 8357275: Locale.Builder.setLanguageTag should mention conversions made on language tag [v2]

Justin Lu jlu at openjdk.org
Tue May 20 23:24:33 UTC 2025


On Tue, 20 May 2025 23:02:45 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> Justin Lu has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   setLanguageTag should mention all conversions, not just extlang
>
> src/java.base/share/classes/java/util/Locale.java line 1837:
> 
>> 1835:      *     Locale.forLanguageTag("en-abc-def-us").toString(); // returns "abc_US"
>> 1836:      *     Locale.forLanguageTag("zh-yue-gan-cmn-czh-CN").toString();
>> 1837:      *     // returns "yue"; the rest of the tag is considered ill-formed
> 
> I'd rather not use "ill-formed" here, or change the wording, as "the rest of the tag" implies subtags other than "yue" which include "zh." If this "zh" is considered ill-formed, following "yue" should be discarded according to the prior definition.

OK, I'd like to keep "ill-formed" because it allows the example to have meaning for both `[for/set]LanguageTag`.
I updated the wording so that it is clear that "czh", (the fourth extlang) and subsequent subtags are what is considered ill-formed.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25309#discussion_r2099018994


More information about the core-libs-dev mailing list