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

   <!-- Greeting -->
   Hey @EmmanuelCbd! I'm here to help you with your Docker issue. I can assist 
with bugs, questions, and contributions while you wait for a human maintainer. 
Let's tackle this together!
   
   <!-- Answer -->
   To resolve the issue with the `BUILD_TRANSLATIONS` environment variable not 
being recognized during the Docker build process, you need to ensure that the 
variable is correctly declared in the appropriate Dockerfile stage. The problem 
arises because the `ENV` parameter is not propagated across different stages in 
a Dockerfile. 
   
   Here's a clean solution:
   
   1. Declare the `BUILD_TRANSLATIONS` argument at the beginning of the 
Dockerfile.
   2. Set the `ENV` variable in each stage where it's needed.
   
   Here's how you can modify the Dockerfile:
   
   ```dockerfile
   # Declare the argument at the top
   ARG BUILD_TRANSLATIONS="false"
   
   # Use the argument in the python-translation-compiler stage
   FROM python-base AS python-translation-compiler
   ARG BUILD_TRANSLATIONS
   ENV BUILD_TRANSLATIONS=${BUILD_TRANSLATIONS}
   
   # Your existing RUN command
   RUN if [ "$BUILD_TRANSLATIONS" = "true" ]; then \
           pybabel compile -d /app/translations_mo | true; \
       fi; \
       rm -f /app/translations_mo/*/*/*.json;
   ```
   
   When building the Docker image, make sure to pass the `BUILD_TRANSLATIONS` 
argument:
   
   ```bash
   docker build --build-arg BUILD_TRANSLATIONS=true -t your_image_name .
   ```
   
   This setup ensures that the `pybabel compile` command is executed correctly, 
generating the `.mo` files as expected 
<sup>[[1]](https://github.com/apache/superset/blob/master/Dockerfile)</sup>.
   
   Regarding the placeholder errors in the `.po` files, these are common issues 
that occur when placeholders in the translated text do not match those in the 
original text. You will need to manually edit the `messages.po` files to ensure 
that all placeholders are correctly named and formatted 
<sup>[[2]](https://github.com/apache/superset/issues/31396)</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/8c2640b2-aa51-46d4-a435-59fee966c5e4?feedback_type=great_response)
 | [Irrelevant 
Answer](https://app.dosu.dev/response-feedback/8c2640b2-aa51-46d4-a435-59fee966c5e4?feedback_type=irrelevant_answer)
 | [Incorrect 
Sources](https://app.dosu.dev/response-feedback/8c2640b2-aa51-46d4-a435-59fee966c5e4?feedback_type=incorrect_sources)
 | [Too 
Verbose](https://app.dosu.dev/response-feedback/8c2640b2-aa51-46d4-a435-59fee966c5e4?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/8c2640b2-aa51-46d4-a435-59fee966c5e4?feedback_type=hallucination)
 | 
[Other](https://app.dosu.dev/response-feedback/8c2640b2-aa51-46d4-a435-59fee966c5e4?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