From d91378117c15b32a8c28ccd732481f1b7b99baf3 Mon Sep 17 00:00:00 2001 From: "Kyle D. McCormick" Date: Thu, 21 Mar 2024 17:24:26 -0400 Subject: [PATCH] fix: re-pull Atlas translations for mounted edx-platform The new Atlas-based translations system stores important translations artifacts in edx-platform. Unfortunately, when edx-platform is bind-mounted, these translations artifacts are overwritten. This means that edx-platform developers will see 404s on various i18n-related assets in Django-rendered LMS and CMS pages. We work around this in the same way we do for static assets, egg_info, and node_modules: Just re-generate the translations artifacts as part of the dev init job, via mounted-directories.sh. This is a waste of time and bandwidth, but it's the system we have, for now at least. --- tutor/templates/build/openedx/Dockerfile | 1 + tutor/templates/jobs/init/mounted-directories.sh | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/tutor/templates/build/openedx/Dockerfile b/tutor/templates/build/openedx/Dockerfile index ebefd7e019..f2bc5d85a5 100644 --- a/tutor/templates/build/openedx/Dockerfile +++ b/tutor/templates/build/openedx/Dockerfile @@ -186,6 +186,7 @@ COPY --chown=app:app settings/lms/*.py ./lms/envs/tutor/ COPY --chown=app:app settings/cms/*.py ./cms/envs/tutor/ # Pull latest translations via atlas +RUN rm -rf conf/locale conf/plugins-locale RUN ./manage.py lms --settings=tutor.i18n pull_plugin_translations --verbose --repository='{{ ATLAS_REPOSITORY }}' --revision='{{ ATLAS_REVISION }}' {{ ATLAS_OPTIONS }} RUN ./manage.py lms --settings=tutor.i18n pull_xblock_translations --repository='{{ ATLAS_REPOSITORY }}' --revision='{{ ATLAS_REVISION }}' {{ ATLAS_OPTIONS }} RUN atlas pull --repository='{{ ATLAS_REPOSITORY }}' --revision='{{ ATLAS_REVISION }}' {{ ATLAS_OPTIONS }} \ diff --git a/tutor/templates/jobs/init/mounted-directories.sh b/tutor/templates/jobs/init/mounted-directories.sh index e10dc7b7c9..612e5eaf99 100644 --- a/tutor/templates/jobs/init/mounted-directories.sh +++ b/tutor/templates/jobs/init/mounted-directories.sh @@ -36,6 +36,21 @@ pip install -e . # Regenerate node_modules npm clean-install +# Pull latest translations via atlas +rm -rf conf/locale conf/plugins-locale +./manage.py lms pull_plugin_translations --verbose --repository='{{ ATLAS_REPOSITORY }}' --revision='{{ ATLAS_REVISION }}' {{ ATLAS_OPTIONS }} +./manage.py lms pull_xblock_translations --repository='{{ ATLAS_REPOSITORY }}' --revision='{{ ATLAS_REVISION }}' {{ ATLAS_OPTIONS }} +rm -rf conf/locale +atlas pull --repository='{{ ATLAS_REPOSITORY }}' --revision='{{ ATLAS_REVISION }}' {{ ATLAS_OPTIONS }} \ + translations/edx-platform/conf/locale:conf/locale \ + translations/studio-frontend/src/i18n/messages:conf/plugins-locale/studio-frontend +./manage.py lms compile_xblock_translations +./manage.py cms compile_xblock_translations +./manage.py lms compile_plugin_translations +./manage.py lms compilemessages -v1 +./manage.py lms compilejsi18n +./manage.py cms compilejsi18n + # Regenerate static assets. openedx-assets build --env=dev