You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/12/22 13:41:29 UTC

[GitHub] [superset] artemonsh opened a new pull request, #22507: fix(localization): Babel does not extract plural forms from frontend

artemonsh opened a new pull request, #22507:
URL: https://github.com/apache/superset/pull/22507

   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   Currently there is an issue with the plural forms on the frontend. At first, let's take a look at this code: https://github.com/apache/superset/blob/7d8fff87b55a2276b7e287772a654c3c63f5b2ce/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndColumnSelect.tsx#L206-L210 
   It is expected that while extracting these strings into `.po` file using `babel-update.sh` they should look like this:
   ```
   msgid "Drop a column here or click"
   msgid_plural "Drop columns here or click"
   msgstr[0] ""
   msgstr[1] ""
   ```
   or this:
   ```
   msgid "Drop a column here or click"
   msgid_plural "Drop columns here or click"
   msgstr[0] ""
   msgstr[1] ""
   msgstr[2] ""
   ```
   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 forms https://github.com/apache/superset/blob/7d8fff87b55a2276b7e287772a654c3c63f5b2ce/superset/translations/fr/LC_MESSAGES/messages.po#L25 does not contain the desired syntax for translating both of forms: https://github.com/apache/superset/blob/7d8fff87b55a2276b7e287772a654c3c63f5b2ce/superset/translations/fr/LC_MESSAGES/messages.po#L4873-L4874
   
   The solution to this issue is simple and is offered in this PR.
   
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   Go to the root directory of superset and run `./scripts/babel-update.sh`.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [x] Has associated issue: https://github.com/apache/superset/issues/21701
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] villebro commented on a diff in pull request #22507: fix(localization): pybabel doesn't extract plural forms from frontend

Posted by GitBox <gi...@apache.org>.
villebro commented on code in PR #22507:
URL: https://github.com/apache/superset/pull/22507#discussion_r1059625319


##########
scripts/babel_update.sh:
##########
@@ -45,7 +45,7 @@ pybabel extract \
   --sort-output \
   --copyright-holder=Superset \
   --project=Superset \
-  -k _ -k __ -k t -k tn -k tct .
+  -k _ -k __ -k t -k tn:1,2 -k tct .

Review Comment:
   Bycatch - we probably don't need `-k tct` here as I don't believe we even have such a translator function, but I suppose it doesn't matter that much.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] villebro merged pull request #22507: fix(localization): pybabel doesn't extract plural forms from frontend

Posted by GitBox <gi...@apache.org>.
villebro merged PR #22507:
URL: https://github.com/apache/superset/pull/22507


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org