From 7fe41283a52e5d08df1365e21e1a1e8f97b1f1e9 Mon Sep 17 00:00:00 2001 From: Omar Al-Ithawi Date: Fri, 18 Aug 2023 17:16:19 +0300 Subject: [PATCH] feat: use `atlas` in `make pull_translations` (#4037) This contribution is part of the [FC-0012 project](https://openedx.atlassian.net/l/cp/XGS0iCcQ) which is sparked by the [Translation Infrastructure update OEP-58](https://open-edx-proposals.readthedocs.io/en/latest/architectural-decisions/oep-0058-arch-translations-management.html#specification). --- Dockerfile | 3 ++- Makefile | 11 +++++++++++ requirements/base.in | 1 + requirements/local.txt | 2 ++ requirements/production.txt | 2 ++ 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index bb3b9109db..657fb542e3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,8 +3,9 @@ FROM ubuntu:focal as app ENV DEBIAN_FRONTEND noninteractive # System requirements. RUN apt update && \ - apt-get install -qy \ + apt-get install -qy \ curl \ + gettext \ # required by bower installer git \ language-pack-en \ diff --git a/Makefile b/Makefile index 836e54cd73..4efc49b7a6 100644 --- a/Makefile +++ b/Makefile @@ -104,8 +104,19 @@ extract_translations: ## Extract strings to be translated, outputting .po and .m cd course_discovery && PYTHONPATH="..:${PYTHONPATH}" django-admin.py compilemessages # This Make target should not be removed since it is relied on by a Jenkins job (`edx-internal/tools-edx-jenkins/translation-jobs.yml`), using `ecommerce-scripts/transifex`. +ifeq ($(OPENEDX_ATLAS_PULL),) pull_translations: ## Pull translations from Transifex tx pull -a -f -t --mode reviewed --minimum-perc=1 +else +# Experimental: OEP-58 Pulls translations using atlas +pull_translations: + find course_discovery/conf/locale -mindepth 1 -maxdepth 1 -type d -exec rm -r {} \; + atlas pull $(OPENEDX_ATLAS_ARGS) translations/course-discovery/course_discovery/conf/locale:course_discovery/conf/locale + python manage.py compilemessages + + @echo "Translations pulled from Transifex and compiled." + @echo "'make static' or 'make static.dev' is required to update the js i18n files." +endif # This Make target should not be removed since it is relied on by a Jenkins job (`edx-internal/tools-edx-jenkins/translation-jobs.yml`), using `ecommerce-scripts/transifex`. push_translations: ## Push source translation files (.po) to Transifex diff --git a/requirements/base.in b/requirements/base.in index 1b18c8b743..4d9ae033ae 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -65,6 +65,7 @@ html2text lxml jsonfield markdown +openedx-atlas pillow pycountry python-dateutil diff --git a/requirements/local.txt b/requirements/local.txt index 1fd2fd3485..8c5cb472ce 100644 --- a/requirements/local.txt +++ b/requirements/local.txt @@ -558,6 +558,8 @@ oauthlib==3.2.2 # social-auth-core openai==0.27.8 # via taxonomy-connector +openedx-atlas==0.4.4 + # via -r requirements/base.in openedx-events==8.5.0 # via # edx-event-bus-kafka diff --git a/requirements/production.txt b/requirements/production.txt index d71f5b29d7..e3b37fbe3b 100644 --- a/requirements/production.txt +++ b/requirements/production.txt @@ -447,6 +447,8 @@ oauthlib==3.2.2 # social-auth-core openai==0.27.8 # via taxonomy-connector +openedx-atlas==0.4.4 + # via -r requirements/base.in openedx-events==8.5.0 # via # edx-event-bus-kafka