fix(i18n): translate DateFilter tooltip for time range values#40286
fix(i18n): translate DateFilter tooltip for time range values#40286miharejec wants to merge 1 commit into
Conversation
The tooltip on the date filter pill was showing untranslated English text (e.g. 'Current day' instead of the localized string). This was because the raw value was used directly without passing it through t() for translation. - Wrap label in t() inside getTooltipTitle for truncated labels - Translate initial tooltipTitle state with t(value) - Translate error fallback tooltipTitle with t(value)
Code Review Agent Run #ac78c5Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #40286 +/- ##
=======================================
Coverage 64.16% 64.16%
=======================================
Files 2591 2591
Lines 138293 138293
Branches 32084 32084
=======================================
Hits 88736 88736
Misses 48027 48027
Partials 1530 1530
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
SUMMARY
The tooltip on the date filter pill (time range selector) was showing untranslated English text instead of the localized string. For example, when using Superset in Slovenian, the tooltip showed "Current day" instead of "Tekoči dan".
This happened because the raw value string (e.g. "Current day", "Last week") was used directly in the tooltip without passing it through t() for translation. The pill label itself was already translated (via t() in the DateLabel component), but the tooltip was missed.
Three places were fixed:
getTooltipTitle(): wrap label in t() so the tooltip shows the translated label when the pill text is truncated
Initial tooltipTitle state: wrap value in t() so the tooltip is translated before the time range API call resolves
Error fallback: wrap value in t() so the tooltip is translated when the API call fails
This affects all time range values shown in the tooltip: Current day/week/month/quarter/year, Last day/week/month/quarter/year, previous calendar week/month/quarter/year, and No filter.
TESTING INSTRUCTIONS
Configure Superset to use a non-English locale that has translations for time range values (e.g. Slovenian, German, Chinese)
Navigate to a dashboard or chart with a time range filter
Set the time range to a value like "Current day" or "Last week"
Hover over the date filter pill to see the tooltip
Verify the tooltip text is translated to the configured locale
Also verify when the pill text is truncated (narrow container) — the bold label in the tooltip should also be translated
ADDITIONAL INFORMATION