Skip to content

Commit

Permalink
fix: re-pull Atlas translations for mounted edx-platform
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kdmccormick committed Mar 21, 2024
1 parent 404332b commit d913781
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions tutor/templates/build/openedx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 }} \
Expand Down
15 changes: 15 additions & 0 deletions tutor/templates/jobs/init/mounted-directories.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit d913781

Please sign in to comment.