dosubot[bot] commented on issue #31396:
URL: https://github.com/apache/superset/issues/31396#issuecomment-2534936089

   <!-- Answer -->
   To use `pybabel` in the Apache Superset codebase, you can follow these steps:
   
   1. **Extract Translations**: Use `pybabel extract` to extract translatable 
strings from the codebase. This command generates a `.pot` file containing all 
the strings that need translation.
   
      ```sh
      pybabel extract -F superset/translations/babel.cfg -o 
superset/translations/messages.pot --no-location --sort-output 
--copyright-holder=Superset --project=Superset -k _ -k __ -k t -k tn:1,2 -k tct 
.
      ```
   
   2. **Update Translations**: Use `pybabel update` to update the `.po` files 
with the new messages from the `.pot` file.
   
      ```sh
      pybabel update -i superset/translations/messages.pot -d 
superset/translations --ignore-obsolete
      ```
   
   3. **Compile Translations**: After translating the `.po` files, compile them 
into binary `.mo` files.
   
      ```sh
      pybabel compile -d superset/translations
      ```
   
   4. **Initialize New Language**: If you want to add a new language, use the 
`pybabel init` command with the appropriate language code.
   
      ```sh
      pybabel init -i superset/translations/messages.pot -d 
superset/translations -l LANGUAGE_CODE
      ```
   
   These steps are part of the process to manage translations in Superset using 
`pybabel`. The `babel_update.sh` script in the Superset repository automates 
many of these steps 
<sup>[[1]](https://github.com/apache/superset/blob/master/scripts/translations/babel_update.sh)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   
   ---
   <sup>Help Dosu learn! Give it feedback: [Great 
Response](https://app.dosu.dev/response-feedback/65d90a45-7dba-404c-9d06-cd23bd2da255?feedback_type=great_response)
 | [Irrelevant 
Answer](https://app.dosu.dev/response-feedback/65d90a45-7dba-404c-9d06-cd23bd2da255?feedback_type=irrelevant_answer)
 | [Incorrect 
Sources](https://app.dosu.dev/response-feedback/65d90a45-7dba-404c-9d06-cd23bd2da255?feedback_type=incorrect_sources)
 | [Too 
Verbose](https://app.dosu.dev/response-feedback/65d90a45-7dba-404c-9d06-cd23bd2da255?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/65d90a45-7dba-404c-9d06-cd23bd2da255?feedback_type=hallucination)
 | 
[Other](https://app.dosu.dev/response-feedback/65d90a45-7dba-404c-9d06-cd23bd2da255?feedback_type=other)</sup>
   


-- 
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-unsubscr...@superset.apache.org

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


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

Reply via email to