Repository navigation
fix(admin): localize date pickers for Danish and Georgian - #3655
Conversation
Danish and Georgian were enabled without a react-day-picker locale mapping, so every Kumo DatePicker in the admin (publish scheduling, publication date, and the content list's date range filter) fell back to enUS: English month and day names and a Sunday week start. Map da and ka to their react-day-picker locales. Add a test that every enabled non-English admin locale maps to a calendar locale other than enUS, so a language enabled without a mapping fails CI.
🦋 Changeset detectedLatest commit: 3a71680 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://noah-angry-matsumoto-0330a5.try.emdashcms.com, https://noah-angry-matsumoto-0330a5-emdash-playground.emdash-cms.workers.dev (commit 3a71680)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/auth-atproto
@emdash-cms/blocks
@emdash-cms/cloudflare
@emdash-cms/contentful-to-portable-text
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/plugin-cli
@emdash-cms/plugin-test
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/registry-loader
@emdash-cms/registry-moderation
@emdash-cms/registry-verification
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-field-kit
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
There was a problem hiding this comment.
This is the right fix for the right problem. Danish and Georgian were already enabled admin locales (packages/admin/src/locales/locales.ts) and the date-fns preview loaders in GeneralSettings.tsx already included both, but getDayPickerLocale fell back to enUS because DAY_PICKER_LOCALES missed da and ka. Mapping those codes to react-day-picker’s locale objects is the minimal, idiomatic change.
I checked:
packages/admin/src/locales/day-picker.ts— new imports and map entries are consistent with the existing pattern.packages/admin/src/components/ContentList.tsxandPublishingDateTimeEditor.tsx— both consumegetDayPickerLocale(i18n.locale)with the exact locale codes fromSUPPORTED_LOCALES, so the map entries will be hit.packages/admin/src/locales/config.tsandlocales.ts— the runtime locale list validates these codes and exposes them;SUPPORTED_LOCALESis the source the test pulls from.packages/admin/tests/locales/day-picker.test.ts— the regression test enumerates every enabled non-English locale and asserts it does not fall back toenUS. It will fail if a locale is ever enabled without a matching day-picker mapping, which is exactly the regression this PR prevents.- The changeset at
.changeset/danish-georgian-date-picker.mdfollows.changeset/README.md: present-tense lead, names the affected UI surfaces, identifies the affected users, and describes the observable fix.
No static issues. The change is limited to the reported bug, includes a meaningful guard test, and does not touch strings, routes, or queries.
|
We should update the docs and agents.md for translators to tell them to add new languages to the picker, or generate the list automatically |
What does this PR do?
Danish (
da) and Georgian (ka) are enabled admin languages, butDAY_PICKER_LOCALESinpackages/admin/src/locales/day-picker.tshad no entry for them, sogetDayPickerLocalefell back toenUS. Admins using either language saw English month and day names, English screen reader labels, and weeks starting on Sunday in every admin date picker: the publish scheduling and publication date dialogs (PublishingDateTimeEditor.tsx) and the content list's date range filter (ContentList.tsx).This maps both codes to react-day-picker's
daandkalocales, which wrap the date-fns locales with translated DayPicker labels. Both start the week on Monday.The new test in
packages/admin/tests/locales/day-picker.test.tschecks every enabled non-English admin locale inSUPPORTED_LOCALES(excludingpseudo) and fails whengetDayPickerLocalereturnsenUS, so a language enabled without a date-picker mapping fails CI. Korean is still disabled, so it isn't mapped here; the test will require a mapping when it's enabled.No linked issue.
Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runmessages.pochanges except in translation PRs — a workflow extracts catalogs on merge tomain. — n/a: this PR adds or changes no strings.AI-generated code disclosure
Screenshots / test output
The publish scheduling dialog with the admin set to Danish. The calendar shows Danish month and day names and starts the week on Monday:
The same dialog with the admin set to Georgian:
Before this change, both languages rendered these calendars with English month and day names and a Sunday week start.
The new test (Vitest, Node environment), run against the pre-fix map and then with the fix: