<i18n dev> Integrated: 8159337: Introduce a method in Locale class to return the language tags as per RFC 5646 convention
Justin Lu
jlu at openjdk.org
Tue May 9 17:18:31 UTC 2023
On Wed, 26 Apr 2023 22:20:37 GMT, Justin Lu <jlu at openjdk.org> wrote:
> 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.
This pull request has now been integrated.
Changeset: 82bcee76
Author: Justin Lu <jlu at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/82bcee76ea6f5a0624c3ed1d7e4a262d59bfbe37
Stats: 279 lines in 3 files changed: 274 ins; 3 del; 2 mod
8159337: Introduce a method in Locale class to return the language tags as per RFC 5646 convention
Reviewed-by: naoto, rriggs
-------------
PR: https://git.openjdk.org/jdk/pull/13679
More information about the i18n-dev
mailing list