Skip to content

test(@formatjs/intl-displaynames): add conformance tests - #5909

Closed
longlho wants to merge 1 commit into
mainfrom
01-14-test_formatjs_intl-displaynames_add_conformance_tests
Closed

longlho wants to merge 1 commit into
mainfrom
01-14-test_formatjs_intl-displaynames_add_conformance_tests

Conversation

@longlho

@longlho longlho commented Jan 15, 2026 •

Copy link
Copy Markdown
Member

TL;DR

Added ICU4J conformance testing to validate FormatJS locale handling behavior against the reference implementation.

What changed?

  • Added ICU4J as a dependency via http_file in MODULE.bazel
  • Created a new Java-based conformance test in conformance-tests/icu4j/ directory
  • Added detailed documentation in ICUConformanceTest.java explaining the test cases
  • Enhanced the documentation in intl-displaynames/should-polyfill.ts to better explain the script code canonicalization bug

How to test?

Run the ICU4J conformance test to validate FormatJS behavior:

bazel run //conformance-tests/icu4j:icu_conformance_test

The test validates:

  1. Locale canonicalization (getCanonicalLocales)
  2. Script code normalization (DisplayNames)
  3. Variant handling (Intl.Locale.variants)
  4. Lowercase script code handling (related to GH intl-displaynames shouldPolyfill incorrectly indicates that polyfill is required #5889)
  5. DisplayNames functionality

Why make this change?

This change adds a reference implementation test to ensure FormatJS correctly implements the ECMA-402 specification for locale handling. It specifically addresses issues like script code canonicalization (GH #5889) by comparing FormatJS behavior against ICU4J, which is the reference implementation used by browsers. This helps ensure consistent behavior across platforms and validates our polyfill implementations.

longlho commented Jan 15, 2026 •

Copy link
Copy Markdown
Member Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • main - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has required the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@graphite-app
graphite-app Bot changed the base branch from 01-14-feat_formatjs_intl-locale_support_variants_per_latest_spec to graphite-base/5909 January 15, 2026 02:40
@longlho
longlho force-pushed the graphite-base/5909 branch from 7a28be5 to 931c3dc Compare January 15, 2026 02:41
@longlho
longlho force-pushed the 01-14-test_formatjs_intl-displaynames_add_conformance_tests branch from bfe8143 to 548ac6b Compare January 15, 2026 02:41
@graphite-app
graphite-app Bot changed the base branch from graphite-base/5909 to main January 15, 2026 02:41
@graphite-app

graphite-app Bot commented Jan 15, 2026 •

Copy link
Copy Markdown

Merge activity

  • Jan 15, 2:41 AM UTC: Graphite rebased this pull request, because this pull request is set to merge when ready.
  • Jan 15, 3:31 AM UTC: longlho added this pull request to the Graphite merge queue.
  • Jan 15, 3:31 AM UTC: CI is running for this pull request on a draft pull request (#5911) due to your merge queue CI optimization settings.
  • Jan 15, 4:01 AM UTC: Merged by the Graphite merge queue via draft PR: #5911.

@longlho
longlho force-pushed the 01-14-test_formatjs_intl-displaynames_add_conformance_tests branch from 548ac6b to 835e2c9 Compare January 15, 2026 03:22
graphite-app Bot pushed a commit that referenced this pull request Jan 15, 2026
### TL;DR

Added ICU4J conformance testing to validate FormatJS locale handling behavior against the reference implementation.

### What changed?

- Added ICU4J as a dependency via `http_file` in `MODULE.bazel`
- Created a new Java-based conformance test in `conformance-tests/icu4j/` directory
- Added detailed documentation in `ICUConformanceTest.java` explaining the test cases
- Enhanced the documentation in `intl-displaynames/should-polyfill.ts` to better explain the script code canonicalization bug

### How to test?

Run the ICU4J conformance test to validate FormatJS behavior:

```bash
bazel run //conformance-tests/icu4j:icu_conformance_test
```

The test validates:
1. Locale canonicalization (getCanonicalLocales)
2. Script code normalization (DisplayNames)
3. Variant handling (Intl.Locale.variants)
4. Lowercase script code handling (related to GH #5889)
5. DisplayNames functionality

### Why make this change?

This change adds a reference implementation test to ensure FormatJS correctly implements the ECMA-402 specification for locale handling. It specifically addresses issues like script code canonicalization (GH #5889) by comparing FormatJS behavior against ICU4J, which is the reference implementation used by browsers. This helps ensure consistent behavior across platforms and validates our polyfill implementations.
@graphite-app graphite-app Bot closed this Jan 15, 2026
@graphite-app
graphite-app Bot deleted the 01-14-test_formatjs_intl-displaynames_add_conformance_tests branch January 15, 2026 04:01
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