Skip to content

Commit

Permalink
Merge pull request #1191 from Zeit-Labs/shadinaif/sync-translations
Browse files Browse the repository at this point in the history
feat: sync from old transifex project
  • Loading branch information
OmarIthawi authored Sep 21, 2023
2 parents 7109c40 + 6bfd6e0 commit 3829e58
Show file tree
Hide file tree
Showing 12 changed files with 561 additions and 11 deletions.
134 changes: 134 additions & 0 deletions .github/workflows/sync-translations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Migrate translations from the old Transifex project

on:
workflow_dispatch:


jobs:
migrate-translations:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
resource:
- new_slug: edx-ora2
old_slug: openassessment
old_project_slug: edx-platform

- new_slug: edx-ora2-js
old_slug: openassessment-js
old_project_slug: edx-platform

- new_slug: edx-proctoring
old_slug: edx-proctoring
old_project_slug: edx-platform

- new_slug: studio-frontend
old_slug: studio-frontend
old_project_slug: edx-platform

- new_slug: donexblock
old_slug: xblock-done
old_project_slug: xblocks

- new_slug: xblock-drag-and-drop-v2
old_slug: drag-and-drop-v2
old_project_slug: xblocks

- new_slug: xblock-free-text-response
old_slug: xblock-free-text-response
old_project_slug: xblocks

- new_slug: course-discovery
old_slug: course_discovery
old_project_slug: edx-platform

- new_slug: course-discovery
old_slug: course_discovery
old_project_slug: edx-platform

- new_slug: course-discovery-js
old_slug: course_discovery-js
old_project_slug: edx-platform

- new_slug: credentials-js
old_slug: credentials-js
old_project_slug: edx-platform

- new_slug: credentials
old_slug: credentials
old_project_slug: edx-platform

- new_slug: frontend-app-account
old_slug: frontend-app-account
old_project_slug: edx-platform

- new_slug: frontend-app-authn
old_slug: frontend-app-authn
old_project_slug: edx-platform

- new_slug: frontend-app-course-authoring
old_slug: frontend-app-course-authoring
old_project_slug: edx-platform

- new_slug: frontend-app-discussions
old_slug: frontend-app-discussions
old_project_slug: edx-platform

- new_slug: frontend-app-ecommerce
old_slug: frontend-app-ecommerce
old_project_slug: edx-platform

- new_slug: frontend-app-gradebook
old_slug: frontend-app-gradebook
old_project_slug: edx-platform

- new_slug: frontend-app-learner-dashboard
old_slug: frontend-app-learner-dashboard
old_project_slug: edx-platform

- new_slug: frontend-app-learner-record
old_slug: frontend-app-learner-record
old_project_slug: edx-platform

- new_slug: frontend-app-learning
old_slug: frontend-app-learning
old_project_slug: edx-platform

- new_slug: frontend-app-profile
old_slug: frontend-app-profile
old_project_slug: edx-platform

- new_slug: frontend-app-program-console
old_slug: frontend-app-program-manager
old_project_slug: edx-platform

- new_slug: frontend-component-footer
old_slug: frontend-component-footer-edx
old_project_slug: edx-platform

- new_slug: frontend-component-header
old_slug: frontend-component-header
old_project_slug: edx-platform

- new_slug: paragon
old_slug: paragon
old_project_slug: edx-platform

steps:
- uses: actions/checkout@v3
- name: setup python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install Python dependencies
run: make sync_requirements

- name: Sync
env:
# `TX_LANGUAGES` list of languages is set in the `Makefile`
TX_NEW_SLUG: ${{ matrix.resource.new_slug }}
TX_OLD_SLUG: ${{ matrix.resource.old_slug }}
TX_OLD_PROJECT_SLUG: ${{ matrix.resource.old_project_slug }}
TX_API_TOKEN: ${{ secrets.TRANSIFEX_API_TOKEN }}
run: make sync_translations
19 changes: 18 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
.PHONY: piptools upgrade fix_transifex_resource_names transifex_resources_requirements validate_translation_files
.PHONY: piptools upgrade fix_transifex_resource_names transifex_resources_requirements validate_translation_files \
sync_translations sync_translations_github_workflow


# Default languages for the sync_translations.py file
# Eventually, this should be all the languages Open edX supports. We're starting with a subset for now.
export TX_LANGUAGES := ar,de,fr_CA


piptools:
pip install -q -r requirements/pip_tools.txt
Expand Down Expand Up @@ -37,3 +44,13 @@ validate_translation_files: ## Run basic validation to ensure files are compila
@echo '-----------------------------------------'
@echo 'Congratulations! Translation files are valid.'
@echo '-----------------------------------------'

sync_requirements: ## install translations.txt requirements
pip install -q -r requirements/translations.txt

sync_translations: ## Syncs from the old projects to the new openedx-translations project
python scripts/sync_translations.py $(SYNC_ARGS)

sync_translations_github_workflow: ## Run with parameters from .github/workflows/sync-translations.yml
make SYNC_ARGS="--simulate-github-workflow $(SYNC_ARGS)" sync_translations

2 changes: 1 addition & 1 deletion requirements/pip.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ wheel==0.41.2
# The following packages are considered to be unsafe in a requirements file:
pip==23.2.1
# via -r requirements/pip.in
setuptools==68.2.0
setuptools==68.2.2
# via -r requirements/pip.in
2 changes: 1 addition & 1 deletion requirements/pip_tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ tomli==2.0.1
# pyproject-hooks
wheel==0.41.2
# via pip-tools
zipp==3.16.2
zipp==3.17.0
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
Expand Down
2 changes: 1 addition & 1 deletion requirements/test.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

pytest
pytest-cov

responses
12 changes: 10 additions & 2 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ gitdb==4.0.10
# via
# -r requirements/transifex.txt
# gitpython
gitpython==3.1.35
gitpython==3.1.36
# via
# -r requirements/transifex.txt
# transifex-client
Expand Down Expand Up @@ -68,21 +68,26 @@ pytz==2023.3.post1
# via
# -r requirements/transifex.txt
# transifex-python
pyyaml==6.0.1
# via responses
regex==2023.8.8
# via
# -r requirements/transifex.txt
# parsimonious
requests==2.31.0
# via
# -r requirements/transifex.txt
# responses
# transifex-client
# transifex-python
responses==0.23.3
# via -r requirements/test.in
six==1.16.0
# via
# -r requirements/transifex.txt
# asttokens
# transifex-client
smmap==5.0.0
smmap==5.0.1
# via
# -r requirements/transifex.txt
# gitdb
Expand All @@ -102,8 +107,11 @@ transifex-client==0.14.4
# via -r requirements/transifex.txt
transifex-python==3.4.0
# via -r requirements/transifex.txt
types-pyyaml==6.0.12.11
# via responses
urllib3==1.26.16
# via
# -r requirements/transifex.txt
# requests
# responses
# transifex-client
4 changes: 2 additions & 2 deletions requirements/transifex.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ future==0.18.3
# via pyseeyou
gitdb==4.0.10
# via gitpython
gitpython==3.1.35
gitpython==3.1.36
# via transifex-client
idna==3.4
# via requests
Expand All @@ -39,7 +39,7 @@ six==1.16.0
# via
# asttokens
# transifex-client
smmap==5.0.0
smmap==5.0.1
# via gitdb
text-unidecode==1.3
# via python-slugify
Expand Down
1 change: 1 addition & 0 deletions requirements/translations.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

# i18n
edx-i18n-tools
pyyaml
8 changes: 5 additions & 3 deletions requirements/translations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ django==3.2.21
# via
# -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt
# edx-i18n-tools
edx-i18n-tools==1.1.0
edx-i18n-tools==1.2.0
# via -r requirements/translations.in
path==16.7.1
# via edx-i18n-tools
Expand All @@ -19,8 +19,10 @@ polib==1.2.0
pytz==2023.3.post1
# via django
pyyaml==6.0.1
# via edx-i18n-tools
# via
# -r requirements/translations.in
# edx-i18n-tools
sqlparse==0.4.4
# via django
typing-extensions==4.7.1
typing-extensions==4.8.0
# via asgiref
Loading

0 comments on commit 3829e58

Please sign in to comment.