rusackas opened a new pull request, #45605:
URL: https://github.com/apache/superset/pull/45605

   ## Description
   
   Adopts #39667 (fix(i18n): Add support for Traditional Chinese locale zh_TW 
in dayjs and update locale mappings), by @bestlong.
   
   Flask-Babel locale codes use underscores and mixed case (`zh_TW`, `pt_BR`), 
but dayjs expects lowercase hyphenated names (`zh-tw`, `pt-br`). 
`dayjs.locale()` was called with the raw Flask-Babel code, so `zh_TW` silently 
fell back to English. This adds a `DAYJS_LOCALE_MAPPING` and applies it both in 
`useLocale` and in the bootstrap `preamble.ts` call.
   
   Rebased onto current `master` and fixed the one thing actually failing CI: 
the new test imported `renderHook` from `@testing-library/react-hooks`, which 
isn't a dependency anymore (every other hook test on `master` imports it from 
`@testing-library/react` directly). Swapped that import; the rest of the 
original diff is unchanged.
   
   One of CodeAnt's two review comments on the original PR doesn't hold up: it 
flagged the `preamble.ts` import of `DAYJS_LOCALE_MAPPING` from 
`./hooks/useLocale` as newly pulling React/Redux/dayjs-locale weight into the 
bootstrap bundle, but `preamble.ts` already did a bare `import 
'./hooks/useLocale';` before this PR, so that module was already fully loaded 
on every entrypoint. No change in bundling behavior either way.
   
   Pushing this as a fresh PR rather than to @bestlong's branch directly: the 
fork has drifted far enough from current `master` to touch 
`.github/workflows/asf-allowlist-check.yml`, which a GitHub App token without 
`workflow` scope can't push.
   
   ## BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — i18n fix, no visual change beyond correct zh_TW rendering.
   
   ## TESTING INSTRUCTIONS
   
   1. Set `DEFAULT_LOCALE = 'zh_TW'` in `superset_config.py` (or switch profile 
language to 繁體中文).
   2. Reload — Ant Design components (date pickers, pagination) render in 
Traditional Chinese, and dayjs date formatting follows zh-TW conventions.
   3. `cd superset-frontend && npx jest src/hooks/useLocale.test.tsx` — 16/16 
passing.
   
   ## ADDITIONAL INFORMATION
   
   - [x] Has associated issue: related to i18n locale mapping
   - [ ] Required feature flags:
   - [x] Changes UI
   - [ ] Includes DB Migration
   - [ ] 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]

Reply via email to