rusackas opened a new pull request, #45834: URL: https://github.com/apache/superset/pull/45834
### SUMMARY Follow-up to #45605. `DAYJS_LOCALE_MAPPING` hardcoded three Flask-Babel→dayjs locale name conversions, but two of them (`zh_TW` → `zh-tw`, `pt_BR` → `pt-br`) are pure case/separator reformatting — `'zh_TW'.toLowerCase().replace(/_/g, '-')` already produces the exact registered dayjs locale name. Only `zh` → `zh-cn` is a genuine rename: dayjs ships its own bare `zh` locale, but this project imports `zh-cn` specifically, so Babel's generic `zh` code needs an explicit redirect. Replaced the three-entry map with a `toDayjsLocale()` helper: a one-entry override map for the genuine rename, falling back to the generic normalization for everything else. Same behavior today, but any future locale whose Babel code and dayjs name differ only by case/separator now works automatically, without a new map entry, as long as the matching dayjs locale file is imported. Also filed [iamkun/dayjs#3345](https://github.com/iamkun/dayjs/issues/3345) upstream — dayjs's own locale resolver already lowercases input and has a hyphen-split fallback for unmatched names, it just never treats `_` as a separator, so any app feeding it gettext/ICU-style locale codes directly hits the same silent-fallback trap Superset did here. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A — internal refactor, no behavior change. ### TESTING INSTRUCTIONS ``` cd superset-frontend npx jest src/hooks/useLocale.test.tsx src/preamble.test.ts ``` 26/26 passing. Same manual check as #45605 still applies: set `DEFAULT_LOCALE = 'zh_TW'` and confirm Ant Design components and dayjs date formatting still render in Traditional Chinese. ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] Introduces new feature or API - [ ] Removes existing feature or API 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
