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

Justin Lu jlu at openjdk.org
Mon May 8 19:44:36 UTC 2023

> Please review this PR which adds the method `caseFoldLanguageTag(String languageTag)` to java.util.Locale.
> This method case folds a language tag to adhere to _[section 2.1.1. Formatting of Language Tags of RFC5646](https://www.rfc-editor.org/rfc/rfc5646.html#section-2.1)_. This format is defined as _"All subtags, including extension and private use subtags, use lowercase letters with two exceptions: two-letter and four-letter subtags that neither appear at the start of the tag nor occur after singletons.  Such two-letter subtags are all uppercase ... and four-letter subtags are titlecase."_.
> In order to match the behavior of existing language tag related Locale methods, this method matches the 2.1.1 RFC5646 specification with the following **exceptions**:
> - Will not case fold variant subtags
> - Will not case fold private use subtags prefixed by "lvariant"
> As an example, `caseFoldLanguageTag("ja-kana-jp-x-lvariant-Oracle-JDK-Standard-Edition")` returns _"ja-Kana-JP-x-lvariant-Oracle-JDK-Standard-Edition"_. Further examples can be seen in the test file.

Justin Lu has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 24 additional commits since the last revision:

 - Adjust file name to match class name
 - Merge branch 'master' into JDK-8159337-Langtags-RFC5646
 - Review: SBldr should be pre allocated with input tag
 - Review: drop wwildcard import and replace subtags[i] with subtag
 - Review: Include multiple singleton extensions in test
 - Review comment: parseSts should be local
 - 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
 - ... and 14 more: https://git.openjdk.org/jdk/compare/23ccc4b0...4795fb77


  - all: https://git.openjdk.org/jdk/pull/13679/files
  - new: https://git.openjdk.org/jdk/pull/13679/files/96781281..4795fb77

 - full: https://webrevs.openjdk.org/?repo=jdk&pr=13679&range=06
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13679&range=05-06

  Stats: 341635 lines in 3619 files changed: 284475 ins; 34553 del; 22607 mod
  Patch: https://git.openjdk.org/jdk/pull/13679.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13679/head:pull/13679

PR: https://git.openjdk.org/jdk/pull/13679

More information about the i18n-dev mailing list