Repository navigation
fix(i18n): load the dayjs locale for every language with a catalog - #45982
Merged
Merged
Conversation
dayjs.locale() is a no-op for a locale that was never imported: it leaves
the previous one in place and returns that instead. Only 16 of the 30
languages with a catalog were imported, so relative dates ("3 days ago")
stayed in English for the other 14, even though preamble.ts asks dayjs to
switch for all of them.
Import the 14 missing locales, and override the Serbian pair, which the
two projects name the other way around: dayjs's 'sr' is the Latin script
and 'sr-cyrl' the Cyrillic one, so normalizing the Cyrillic 'sr' catalog
would hand it Latin dates. The 'sr_Latn' entry makes the Latin mapping
explicit rather than relying on dayjs retrying the base language.
Also add 'ta' to the Locale type, which lists every other language with a
catalog.
Co-Authored-By: Claude Opus 5 <[email protected]>
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #45982 +/- ##
=======================================
Coverage 84.91% 84.91%
=======================================
Files 3075 3075
Lines 207823 207830 +7
Branches 48990 48992 +2
=======================================
+ Hits 176467 176480 +13
+ Misses 27994 27988 -6
Partials 3362 3362
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:
|
rusackas
approved these changes
Nov 20, 2026
rusackas
left a comment
Member
There was a problem hiding this comment.
Thanks @antalotec, LGTM! Good catch on the Serbian scripts being flipped between Babel and dayjs, that one would've been easy to miss.
jprinet
added a commit
to jprinet/superset
that referenced
this pull request
Nov 23, 2026
* origin/master: (393 commits) fix(a11y): name the semantic view description input (apache#46458) docs(semantic): explain datasource list modification eligibility (apache#46462) docs(semantic-layer): document NULL-preserving exclusion filters (apache#46447) fix(uploads): skip folder and system entries in columnar ZIP uploads (apache#45617) fix(i18n-es): promote 47 of the zero-context backfill entries (apache#45847) fix(mcp): return structured ChartError on SQLAlchemyError in get_chart_sql (apache#44351) fix(datasets): follow semantic view modification permissions (apache#46448) fix(docker): account for container memory limits in frontend-mem-nag.sh (apache#46373) fix(reports): carry the report's native filters in the email and Slack link (apache#46062) fix(explore): apply the dataset timezone to grained temporal filter values (apache#46175) fix(i18n): enforce the do-not-translate registry across the catalogs (apache#45974) chore(logging): log unparseable virtual dataset SQL at debug in the RLS lookup (apache#46139) fix(i18n): split parameter-suggestion plural into two messages (apache#46049) test(partition-mapping): cover Hive/Impala mirrored SQL, cache outage and migration (apache#46319) perf(dashboard): look up the dashboard once per filter_state read (apache#46314) fix(i18n): load the dayjs locale for every language with a catalog (apache#45982) test(semantic-layer): make date export parametrization deterministic (apache#46449) fix(oauth2): idempotent OAuth2 completion and resilient listener (apache#40292) fix(explore): prevent full table scan when SQL expression is used as x-axis (apache#41339) feat(mcp): radar chart type plugin (apache#43571) ... # Conflicts: # .github/workflows/docker.yml # .github/workflows/superset-frontend.yml
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
dayjs.locale(name)is a silent no-op whennamewas never imported: dayjs keeps thelocale already in effect and returns that name instead of the one asked for. Nothing
throws and nothing is logged.
preamble.tscallsdayjs.locale(toDayjsLocale(lang))for whatever language the user ison, for all 30 languages that have a catalog under
superset/translations/. ButuseLocale.tsimports only 16 of them — the same 16 thatLOCALE_MAPPINGcovers for AntDesign. For the remaining 14, the call does nothing and every relative date renders in
English next to a fully translated UI.
Measured against
masterwith the real dayjs build, starting fromeneach time:arcafafilvmiplrotathtrukensrsrensr_Latnsr-latnen14 of 30. With the imports added, all 30 resolve to a locale that is actually loaded:
fa 3 dies, 3 dni temu, pirms 3 dienām, пре 3 дана, 3 gün önce, and so on.
The Serbian pair needs more than an import. The two projects name the scripts the other
way around:
sr(143,945 Cyrillic chars)sr_Latn(0)sr-cyrl(404 Cyrillic chars)sr(0)So normalizing
sr→srhands the Cyrillic catalog the Latin locale — verified:with the imports in place but no override, the
srcatalog renders pre 3 dana instead ofпре 3 дана.
DAYJS_LOCALE_OVERRIDESfixes that.The
sr_Latnentry is a smaller point, stated for honesty:sr-latnis not a locale dayjsships, and dayjs retries the base language on a suffixed name, so
sr-latnalready lands onsr(Latin) oncesris imported — correct, but by way of an undocumented retry. The entrymakes the intent explicit instead.
Finally,
'ta'is added to theLocaletype in@apache-superset/core, whose own commentsays "every locale with a catalog in superset/translations" and lists the other 29.
Follows #45834, which replaced the hardcoded name map with
toDayjsLocale(). Thatderivation is right for 27 of the 29 codes; this adds the imports those names need, and the
one pair normalization cannot derive. Part of a short run of i18n fixes: #45953 (merged),
#45973 and #45974.
TESTING INSTRUCTIONS
The locale imports are side effects, and
useLocale.test.tsxmocks bothextendedDayjsandevery
dayjs/locale/*module, so a unit test there can only assert the name passed todayjs.locale()— which is what the newtoDayjsLocaletest does. Proving that the localeis really loaded needs the unmocked library:
dayjs.locale()returning something other than what you passed is the tell.ADDITIONAL INFORMATION
Developed at MYSPHERA, S.L.
🤖 Generated with Claude Code