Skip to content

Commit

Permalink
feat: sync from old transifex project
Browse files Browse the repository at this point in the history
This is a on-demand GitHub Actions workflow which will sync traslations
and their status from the `open-edx/edx-platform` Transifex project
(old) into `open-edx/openedx-translations` OEP-58 project (new).

Refs: FC-0012 OEP-58
  • Loading branch information
OmarIthawi authored and shadinaif committed Sep 18, 2023
1 parent 222bf14 commit 567c216
Show file tree
Hide file tree
Showing 5 changed files with 386 additions and 1 deletion.
141 changes: 141 additions & 0 deletions .github/workflows/sync-translations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: Migrate translations from the old Transifex project

on:
# schedule: # TODO: Maybe before merge
# # https://crontab.guru/#0_0_*_*_1
# # At midnight on Mondays
# - cron: 0 0 * * 1"
workflow_dispatch:
# push:
# branches: [sync_translations] # TODO: Remove before merge

jobs:
migrate-translations:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
batch:
- 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


# if: ${{ !github.event.inputs.resource || github.event.inputs.resource == matrix.new_resource_slug }}
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.batch.new_slug }}
TX_OLD_SLUG: ${{ matrix.batch.old_slug }}
TX_OLD_PROJECT_SLUG: ${{ matrix.batch.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,10 @@
.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
export TX_LANGUAGES := ar,de,fr_CA


piptools:
pip install -q -r requirements/pip_tools.txt
Expand All @@ -12,6 +18,7 @@ upgrade: piptools ## update the requirements/*.txt files with the latest packag
pip-compile --rebuild --upgrade -o requirements/translations.txt requirements/translations.in
pip-compile --rebuild --upgrade -o requirements/transifex.txt requirements/transifex.in
pip-compile --rebuild --upgrade -o requirements/test.txt requirements/test.in
pip-compile --rebuild --upgrade -o requirements/sync.txt requirements/sync.in


transifex_resources_requirements: ## Installs the requirements file
Expand All @@ -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 sync.txt requirements
pip install -q -r requirements/sync.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: 2 additions & 0 deletions requirements/sync.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# requirements for sync_translations script
PyYAML
8 changes: 8 additions & 0 deletions requirements/sync.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --output-file=requirements/sync.txt requirements/sync.in
#
pyyaml==6.0.1
# via -r requirements/sync.in
Loading

0 comments on commit 567c216

Please sign in to comment.