Skip to content

fix(translations): load date-fns locale for hy-AM - #19493

Open
pcbeingused333 wants to merge 1 commit into
payloadcms:mainfrom
pcbeingused333:fix/translations-hy-date-locale
Open

pcbeingused333 wants to merge 1 commit into
payloadcms:mainfrom
pcbeingused333:fix/translations-hy-date-locale

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

Fixes #19481

Cause: the Armenian language (languages/hy.ts) declares dateFNSKey: 'hy-AM', but importDateFNSLocale has no case for it, so it returns undefined. initTFunction/getRequestI18n propagate that undefined into i18n.dateFNS, and formatDateTitle keeps showing the loading state for dates in the admin.

Fix: add the hy-AM case, loading date-fns/locale/hy, as proposed in the issue. It is the only dateFNSKey without a case; the other keys were checked against the switch.

Test: new importDateFNSLocale.spec.ts resolves every language's dateFNSKey and fails if any returns undefined (fails on main for hy-AM, passes with the fix).

This PR was prepared with the assistance of an AI tool (Claude Code) and submitted by a human contributor.

The Armenian language declares dateFNSKey 'hy-AM' but importDateFNSLocale had no case for it, so i18n.dateFNS was undefined and date titles in the admin stayed on Loading. Add the missing case and a test that checks every language dateFNSKey resolves to a date-fns locale.
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The locale importer now maps hy-AM to the Armenian date-fns locale. A test checks that each unique translation locale key resolves to a defined locale.

Changes: Armenian date locale support

Layer / File(s) Summary
Add Armenian locale mapping
packages/translations/src/importDateFNSLocale.ts, packages/translations/src/importDateFNSLocale.spec.ts
The importer handles hy-AM by loading the hy export. The test checks that each unique translation locale key resolves to a defined locale.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: jacobsfletch

Merge Risk: Minimal · up to 0739d

The Armenian date locale is mapped and covered by the new test. No merge-blocking issue was identified.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title clearly identifies the fix for loading the date-fns locale for hy-AM.
Description check Passed The description explains the missing Armenian locale case, the fix, and the test added for all translation locale keys.
Linked Issues check Passed Issue #19481 requires Armenian admin dates to render instead of remaining in the loading state. importDateFNSLocale now handles hy-AM by importing date-fns/locale/hy and returning hy. The new …
Out of Scope Changes check Passed The only changes add the Armenian locale mapping and a regression test for locale-key coverage. Both directly support issue #19481.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Linked Issues check

Explanation

Issue #19481 requires Armenian admin dates to render instead of remaining in the loading state. importDateFNSLocale now handles hy-AM by importing date-fns/locale/hy and returning hy. The new test checks that every language dateFNSKey resolves to a defined locale.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 5fc8429 and 0739d69.

Files selected for processing: 2

  • packages/translations/src/importDateFNSLocale.spec.ts
  • packages/translations/src/importDateFNSLocale.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Armenian (hy) admin shows "Loading..." for every date: importDateFNSLocale has no 'hy-AM' case

1 participant