Skip to content

CLDR-19944 Materialize root intervalFormatItem ↑↑↑ in production data and exclude root fallback in JSON - #6305

Draft
sffc wants to merge 1 commit into
unicode-org:mainfrom
sffc:CLDR-19944
Draft

sffc wants to merge 1 commit into
unicode-org:mainfrom
sffc:CLDR-19944

Conversation

@sffc

@sffc sffc commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

CLDR-19944

  • This PR completes the ticket.

Note

Draft PR — Option 1 Prototype Pending TC Decision on CLDR-19944

This Draft PR implements Option 1 on CLDR-19944 (enforcing UTS #35 Part 4 Step 1 across GenerateProductionData, Ldml2JsonConverter, and ICU). Because Survey Tool, GenerateProductionData, cldr-json, ICU4C, ICU4J, and ICU4X all currently inherit intervalFormatItem from root (and no implementation has enforced Step 1 since 2016), CLDR-19944 also puts forward Option 2 for TC consideration: updating UTS #35 to match what every implementation already does instead of changing CLDR, ICU4C, ICU4J, and CLDR JSON (along with Survey Tool / CheckDates data-quality improvements applicable under either option).

Summary

Implements CLDR-19944 so that both GenerateProductionData (production XML, consumed by ICU) and Ldml2JsonConverter (resolved CLDR JSON, consumed directly by ICU4X) match UTS #35 Part 4 Step 1 (intervalFormatItem does not inherit from root for non-root locales) and preserve what vetters explicitly approved via ↑↑↑ in the Survey Tool:

  1. GenerateProductionData.java:
    • Materializes explicitly present ↑↑↑ (INHERITANCE_MARKER) intervalFormatItem entries whose Bailey value comes from root (when ADD_ROOT is enabled), preserving original non-distinguishing attributes such as draft (so draft="unconfirmed" / draft="provisional" entries continue to be filtered appropriately downstream).
    • Leaves truly absent (unvetted) paths absent, preserving the distinction between vetted ↑↑↑ and missing data.
    • Deduplicates across non-root parent locales (e.g., es_419 → es) and lateral calendar aliases (e.g., buddhist → generic, islamic-civil → islamic → generic), respecting draft precedence, coverage inclusion, and alt attributes, and emits descendant anti-shadowing overrides when an ancestor's materialized aliased path would otherwise shadow a child's override on the alias target.
    • Also resets FILE_MATCH and skippedPreBasicLocales at the start of main(...) so repeated in-JVM invocations do not leak static state.
  2. LdmlConvertRules.java, Ldml2JsonConverter.java, and VerifyJson.java:
    • Excludes root-sourced intervalFormatItem paths for non-root locales in resolved mode via getSourceLocaleIdExtended(path, null, /*skipInheritanceMarker=*/false).
    • Produces identical vetter-faithful resolved JSON whether run on raw common/main/ or on production/common/main/.
    • Preserves und (root) itself, intervalFormatFallback, intervalFormatRanges, non-root parent inheritance, and lateral calendar aliases (buddhist → generic, dangi → chinese, islamic-civil → islamic → generic).
  3. Tests:
    • Added GenerateProductionDataTest and Ldml2JsonConverterTest covering materialization, draft precedence, parent/lateral/multi-hop alias deduplication, descendant anti-shadowing, alt="variant", -r false, ∅∅∅, and raw-vs-production JSON parity.

Question for Reviewers — Lateral / Child Deduplication in GenerateProductionData

When a locale has ↑↑↑ on both an aliased calendar and its alias target (e.g., nl.xml has ↑↑↑ on both generic/.../H/H and buddhist/islamic/islamic-civil .../H/H), or when both a parent and child locale have ↑↑↑ (e.g., es.xml and es_419.xml both have gregorian/.../y/y = ↑↑↑):

This PR currently deduplicates those entries (materializing only at the ancestor/alias target when it survives with >= draft status, plus emitting an anti-shadowing override if a child overrides the alias target differently). This keeps production XML and ICU .txt bundles smaller and aligns with CLDR's sparse inheritance model, while producing identical resolved output.

Would reviewers prefer to keep this deduplication (as implemented), or materialize unconditionally at every ↑↑↑ intervalFormatItem path for simpler code at the cost of extra entries in child locales and aliased calendars?

Verification

  • mvn -f tools/pom.xml -pl cldr-code spotless:check — clean.
  • mvn -f tools/pom.xml -pl cldr-code test -Dtest=GenerateProductionDataTest,Ldml2JsonConverterTest,LdmlConvertRulesTest,GenerateDateTimeTestDataTest — all passing.
  • Full-repository GenerateProductionData across all 1,149 locales in common/main/ succeeded with zero CompareResolved diffs on intervalFormat paths and zero missing contributed/approved intervalFormatItem entries in VerifyJson.

Related


🤖 This pull request was created by an AI agent working with @sffc.

ALLOW_MANY_COMMITS=true

… and exclude root fallback in JSON

Per UTS unicode-org#35 Part 4 Step 1, intervalFormatItem entries do not inherit from root
for non-root locales. Previously:
- GenerateProductionData stripped explicitly vetted ↑↑↑ (INHERITANCE_MARKER)
  intervalFormatItem entries whose Bailey value came from root, making them
  indistinguishable from absent (unvetted) paths in production XML and ICU.
- Ldml2JsonConverter (resolved mode) inherited absent intervalFormatItem entries
  from root into non-root CLDR JSON bundles.

Changes:
- GenerateProductionData: materialize explicit ↑↑↑ intervalFormatItem entries
  whose Bailey value comes from root (preserving original non-distinguishing
  attributes such as draft), with parent-locale and lateral-calendar-alias
  deduplication, draft-precedence checks, and descendant anti-shadowing.
- LdmlConvertRules / Ldml2JsonConverter / VerifyJson: exclude root-sourced
  intervalFormatItem paths for non-root locales in resolved mode using
  getSourceLocaleIdExtended(path, null, false) so resolved JSON matches what
  vetters approved and is identical on raw and production XML.
- Add unit tests in GenerateProductionDataTest and Ldml2JsonConverterTest.

Co-authored-by: Gemini <176961590+gemini-code-assist[bot]@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant