fix(localization): pybabel doesn't extract plural forms from frontend #22507
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
Currently there is an issue with the plural forms on the frontend. At first, let's take a look at this code:
superset/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndColumnSelect.tsx
Lines 206 to 210 in 7d8fff8
It is expected that while extracting these strings into
.po
file usingbabel-update.sh
they should look like this:or this:
depending on the number of plural forms in the language. For instance, English and French have 2 plural forms and Russian has 3.
But in reality none of the
.po
files contain plural forms. For instance,.po
file for French translations, which has 2 plural formssuperset/superset/translations/fr/LC_MESSAGES/messages.po
Line 25 in 7d8fff8
superset/superset/translations/fr/LC_MESSAGES/messages.po
Lines 4873 to 4874 in 7d8fff8
The solution to this issue is simple and is offered in this PR. This is the only official source I have found to prove my changes, but I found same solutions on some russian websites.
TESTING INSTRUCTIONS
Go to the root directory of superset and run
./scripts/babel-update.sh
.ADDITIONAL INFORMATION