Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: extract from edx-platform #541

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 36 additions & 3 deletions .github/workflows/extract-translation-source-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
- completion
- course-discovery
- credentials
- edx-platform
- DoneXBlock
- edx-ace
- edx-bulk-grades
Expand Down Expand Up @@ -82,15 +83,40 @@ jobs:
repository: openedx/${{ matrix.repo }}
path: translations/${{ matrix.repo }}

# Sets up Python

- name: prepare the environment with edx-platform specific changes
if: matrix.repo.repo_name == 'edx-platform'
run: |
# This is needed for edx-platform base.txt packages
sudo apt install -y libxml2-dev libxmlsec1-dev libxslt1-dev

# Remove unwanted `en` django/djangojs po files
rm -rf translations/${{ matrix.repo.repo_name }}/conf/locale/en
mkdir -p translations/${{ matrix.repo.repo_name }}/conf/locale/en/LC_MESSAGES

# Setup Python
- name: setup python
uses: actions/setup-python@v4
id: setup_python
with:
python-version: '3.8'
cache: pip
# Using wild-card for `edx-platf*rm` -> `edx-platform` which separates its dependencies from other repos
cache-dependency-path: |
requirements/translations.txt
translations/edx-platf*rm/requirements/edx/base.txt

# Installs Python requirements from translations.txt
- name: install requirements
run: pip install -r requirements/translations.txt
run: |
# Install requirements for all packages
pip install -r requirements/translations.txt

EDX_BASE_REQS=translations/edx-platform/requirements/edx/base.txt
if test -f $EDX_BASE_REQS; then
# Install edx-platform specific apps (e.g. wiki) which is required to extrat translations from
pip install -r $EDX_BASE_REQS
fi

# Extracts the translation source files
- name: extract translation source files
Expand All @@ -115,7 +141,8 @@ jobs:
cd translations/${{ matrix.repo }}
# finds the directory containing the english locale usually located in
# */*/conf/locale/en
EN_DIR=$(find . -type d -regex ".+conf\/locale\/en$")
EN_DIR=$(find . -type d -regex ".+conf\/locale\/en$" | head -n 1)
echo "EN_DIR=$EN_DIR" >> $GITHUB_ENV
# If the directory is not found, exit with an error. This can happen if we add a repository that doesn't
# comply with OEP-58, or it still doesn't have any translations yet
if [ -z "$EN_DIR" ]; then
Expand All @@ -125,8 +152,14 @@ jobs:
fi
# remove translations/${{ matrix.repo }}/.git so we don't commit a submodule
rm -rf .git

# All repositories except for edx-platform follows the standard Django i18n pattern
- name: add repo translation source files openedx-translations
if: matrix.repo.repo_name != 'edx-platform'
run: |
# finds the django.po and djangojs.po files generated by make
# extract_translations into EN_DIR and adds them
cd translations/${{ matrix.repo.repo_name }}
DJANGO_PATH=$(find $EN_DIR -name 'django.po')
DJANGOJS_PATH=$(find $EN_DIR -name 'djangojs.po')
############## Special support for XBlocks
Expand Down