-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Translations related to the date range filter #26074
fix: Translations related to the date range filter #26074
Conversation
…percase 'Last year' to backend
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries @rusackas. I'm working through the conflicts now. Quick question as I wanted to verify.
|
I believe so, yes... and I think if you get it wrong, one of the scripts complains :) |
@rusackas. I think I finally got through all the conflicts and re-applied my FR translations. Thanks for your assistance. |
@Ralkion thanks for this! Some pre-commit checks are failing. I'll stamp this but those should be fixed to merge this in |
Thanks. I've managed to fix the pre-commit issue, but I've been struggling with the cypress one. I can't get cypress to run on my local machine (running on Ubuntu in WSL 1 due to corp restrictions). I think I've traced it to this line though (nativeFilters.test.ts#L429). Without being able to run it, I'm not sure why it's finding |
(cherry picked from commit cc2f6f1)
SUMMARY
This PR partially addresses discussion #25994 & issue #26061. It fixes the issue with the date range filter not showing translated values.
The issue was that the front-end client was sending requests that asked for strings like "Last year" and displaying the
timeRange
property in the response. As it stands now, the backend translates the human-readable string into actual dates, along with the requested string in thetimeRange
property (see api.py#L98. The front-end needed to translate the property coming back, but also needed to be sure that it expected the same value it sent (see changes in DateRangeFilter.tsx).One thing I will say is that it was not clear at first how to go about fixing translation issues. I initially did the same as #26010, thinking that updating the .po and .json files was the correct path.
It wasn't until later that I realized that a 'proper' fix would follow the instructions in the docs. Most of this PR is actually the result of trying to resolve the issues that existed in the translation pipeline.
I'm going to outline it here. I know I was confused for a while, and it seems like others were also confused as per the discussion in #26010.
The translation is a multi-step process:
pybabel compile -d superset/translations
What is not addressed by this PR from the original issue is the time-grain values. I've looked into fixing this, but since the front-end is using standard 'select' input fields to display this, there's no good location in the front-end to force a translation. I do have a branch that does the translation in the backend (which is why I had to dig so deep into the translation stuff for the backend .mo files), but that's breaking some integration tests so I need to find another way to do this. I'm open to suggestions if anyone has any.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
After:
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION