Repository navigation
Conversation
Two of the three DAYJS_LOCALE_MAPPING entries added in #45605 (zh_TW -> zh-tw, pt_BR -> pt-br) are pure case/separator differences between Flask-Babel's locale codes and dayjs's locale names. Replace the static map with a generic normalizer plus a single explicit override for the one entry that's a genuine rename (zh -> zh-cn, since this project imports the zh-cn dayjs locale rather than dayjs's own bare zh locale). Any future locale whose Babel code and dayjs name differ only by case or separator now works without a new map entry, as long as the matching dayjs locale file is imported. Co-Authored-By: Evan Rusackas <evan@preset.io> Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #45834 +/- ##
=======================================
Coverage 84.63% 84.63%
=======================================
Files 3069 3069
Lines 205446 205448 +2
Branches 48306 48305 -1
=======================================
+ Hits 173879 173881 +2
Misses 28277 28277
Partials 3290 3290
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
sadpandajoe
self-requested a review
October 29, 2026 18:30
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
Follow-up to #45605.
DAYJS_LOCALE_MAPPINGhardcoded 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. Onlyzh→zh-cnis a genuine rename: dayjs ships its own barezhlocale, but this project importszh-cnspecifically, so Babel's genericzhcode 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 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
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
🤖 Generated with Claude Code