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

Naoto Sato naoto at openjdk.org
Tue May 20 23:05:52 UTC 2025


On Tue, 20 May 2025 17:19:32 GMT, Justin Lu <jlu at openjdk.org> wrote:

>> It is not clear that `Locale.Builder.setLanguageTag(String)` accepts _extlang_ subtags in the input as well as what behavior occurs. Additionally, both this method and `Locale.forLanguageTag(String)` should mention their behavior when more than three _extlang_ subtags are provided. This PR clarifies the lack of context in the specification.
>
> 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.

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

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


More information about the i18n-dev mailing list