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

   <!-- Answer -->
   To resolve the `scripts/translations/generate_mo_files.sh: no such file or 
directory` error and ensure the `superset/translations` issue is fixed, you 
need to update your Dockerfile to include the necessary steps for handling 
translation files. Here is an updated version of your Dockerfile:
   
   ```dockerfile
   FROM apache/superset:4.0.2
   
   USER root
   
   # Install additional dependencies
   RUN pip install mysqlclient
   RUN pip install Authlib
   
   # Copy initialization scripts
   COPY ./docker-init.sh /superset-init.sh
   COPY docker-bootstrap.sh /app/docker/docker-bootstrap.sh
   
   # Copy Superset configuration
   COPY superset_config.py /app/
   ENV SUPERSET_CONFIG_PATH /app/superset_config.py
   
   # Ensure the translations directory exists and compile translations
   RUN mkdir -p /app/superset/translations
   COPY superset/translations /app/superset/translations
   
   # Compile translations for the backend
   COPY ./scripts/translations/generate_mo_files.sh ./scripts/translations/
   RUN ./scripts/translations/generate_mo_files.sh \
       && chown -R superset:superset /app/superset/translations \
       && rm /app/superset/translations/messages.pot \
       && rm /app/superset/translations/*/LC_MESSAGES/*.po
   
   USER superset
   
   ENTRYPOINT [ "/superset-init.sh" ]
   ```
   
   Ensure that the `generate_mo_files.sh` script is present in the 
`./scripts/translations/` directory and contains the necessary commands to 
compile the `.mo` files. Here is an example of what the `generate_mo_files.sh` 
script might look like:
   
   ```bash
   #!/bin/bash
   
   # Compile .po files to .mo files
   for lang in $(ls /app/superset/translations); do
       msgfmt /app/superset/translations/$lang/LC_MESSAGES/messages.po -o 
/app/superset/translations/$lang/LC_MESSAGES/messages.mo
   done
   ```
   
   By including these steps, you should be able to resolve the 
`ModuleNotFoundError` and ensure that the translation files are correctly 
compiled and available 
<sup>[[1]](https://github.com/apache/superset/blob/master/RELEASING/Dockerfile.from_svn_tarball)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/RELEASING/Dockerfile.from_local_tarball)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
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