<i18n dev> RFR: 8329691: Support `nonlikelyScript` parent locale inheritance

Naoto Sato naoto at openjdk.org
Mon May 6 18:00:21 UTC 2024


This PR is to implement the `nonlikelyScript` feature that went into CLDR version 45 for migration purposes. In its release note, it states (https://cldr.unicode.org/index/downloads/cldr-45):

Migration
Changes to parentLocales require upgrading implementations that use that element. In particular, they need to support the new nonlikelyScript value, and use the appropriate explicit inheritance for each type of inheritance. The v44 list of locales that inherit directly from root is retained for this release, but will disappear in the future. So implementations should move as quickly as possible to support the new value

For example in `Russian` locales fallback, its likely script is `Cyrl` (Cyrillic). Thus Russian locales with non-likely script, such as 'ru-Latn' (Russian in Latin script) should fallback directly to `root`, bypassing `ru` (Russian). CLDR has explicit parent locales for this nonlikely scripts, such as `zh-Hant` -> `root` already, but the release note suggests this will go away, and JDK needs to logically handle these non-likely script inheritance cases.

To implement this behavior, CLDRConverter build tool now generates the `LocaleDataMetaInfo` for java.base module with the new `likelyScriptMap`, which maps the script to its likely languages. Since the map is big, it is lazily initialized when needed. The map is used at runtime to determine the parent locale fallback based on implicit/explicit nonlikely Script inheritance.

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

Commit messages:
 - cleanup
 - added tests
 - static AVAILABLE_LOCALES
 - initial commit

Changes: https://git.openjdk.org/jdk/pull/19108/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19108&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8329691
  Stats: 287 lines in 5 files changed: 211 ins; 31 del; 45 mod
  Patch: https://git.openjdk.org/jdk/pull/19108.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19108/head:pull/19108

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


More information about the i18n-dev mailing list