<i18n dev> RFR: 8159337: Introduce a method in Locale class to return the language tags as per RFC 5646 convention [v4]

Justin Lu jlu at openjdk.org
Wed May 3 20:32:29 UTC 2023


On Wed, 3 May 2023 19:13:58 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Justin Lu has updated the pull request incrementally with four additional commits since the last revision:
>> 
>>  - Review comment: Replace wellFormed with parseSts to pass errorMsg to exception
>>  - Review comment: Adjust method names
>>  - Review comment: Use assertThrows and correct IAE to ILE
>>  - Review comment: improve legacy_tags id
>
> src/java.base/share/classes/sun/util/locale/LanguageTag.java line 446:
> 
>> 444:                 } else if (subtags[i].equals(PRIVUSE_VARIANT_PREFIX)) {
>> 445:                     privUseVarFound = true;
>> 446:                 }
> 
> These flags can become true but inside the loop cannot become false again.
> Is that correct?  For example, I think there can be multiple extension singletons.

That was intentional as the booleans represent if a private prefix, singleton prefix, or "lvariant" has been found in general (not that the current position is the suffix of one of those prefixes).

Consider if there is a multiple extension singleton (eg: `a-BBB-CCC-DDD`)

Once singletonFound is set to `true`, it is assumed all further subtags should be lowercased unless it is a private use prefixed by "lvariant". Thus it would be folded to `a-bbb-ccc-ddd` as expected.

Did that address your point?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13679#discussion_r1184224520


More information about the i18n-dev mailing list