From d5561c32186e8b1d9cb590ef2cc37dbc7cfa49d1 Mon Sep 17 00:00:00 2001 From: Shadi Naif Date: Wed, 20 Sep 2023 17:11:14 +0300 Subject: [PATCH] revert: allow pulling translations by module name rather than repo name #353 it's no longer needed because we can pull with glob patterns now see https://github.com/openedx/openedx-atlas/blob/main/docs/decisions/0001-support-glob-pattern.rst Refs: FC-0012 OEP-58 --- .../extract-translation-source-files.yml | 89 +++++++------------ translations/edx-platform-links/README.rst | 75 ---------------- translations/edx-platform-links/audio | 1 - translations/edx-platform-links/bulk_grades | 1 - translations/edx-platform-links/completion | 1 - translations/edx-platform-links/done | 1 - .../edx-platform-links/drag_and_drop_v2 | 1 - translations/edx-platform-links/edx_ace | 1 - .../edx-platform-links/edx_proctoring | 1 - translations/edx-platform-links/feedback | 1 - .../edx-platform-links/freetextresponse | 1 - translations/edx-platform-links/google_drive | 1 - .../edx-platform-links/image_explorer | 1 - translations/edx-platform-links/imagemodal | 1 - translations/edx-platform-links/lti_consumer | 1 - .../edx-platform-links/openassessment | 1 - .../edx-platform-links/qualtricssurvey | 1 - translations/edx-platform-links/recommender | 1 - translations/edx-platform-links/sql_grader | 1 - .../edx-platform-links/submit_and_compare | 1 - 20 files changed, 30 insertions(+), 152 deletions(-) delete mode 100644 translations/edx-platform-links/README.rst delete mode 120000 translations/edx-platform-links/audio delete mode 120000 translations/edx-platform-links/bulk_grades delete mode 120000 translations/edx-platform-links/completion delete mode 120000 translations/edx-platform-links/done delete mode 120000 translations/edx-platform-links/drag_and_drop_v2 delete mode 120000 translations/edx-platform-links/edx_ace delete mode 120000 translations/edx-platform-links/edx_proctoring delete mode 120000 translations/edx-platform-links/feedback delete mode 120000 translations/edx-platform-links/freetextresponse delete mode 120000 translations/edx-platform-links/google_drive delete mode 120000 translations/edx-platform-links/image_explorer delete mode 120000 translations/edx-platform-links/imagemodal delete mode 120000 translations/edx-platform-links/lti_consumer delete mode 120000 translations/edx-platform-links/openassessment delete mode 120000 translations/edx-platform-links/qualtricssurvey delete mode 120000 translations/edx-platform-links/recommender delete mode 120000 translations/edx-platform-links/sql_grader delete mode 120000 translations/edx-platform-links/submit_and_compare diff --git a/.github/workflows/extract-translation-source-files.yml b/.github/workflows/extract-translation-source-files.yml index b4baf8e2f0b..e38cc9580c3 100644 --- a/.github/workflows/extract-translation-source-files.yml +++ b/.github/workflows/extract-translation-source-files.yml @@ -39,46 +39,26 @@ jobs: max-parallel: 1 matrix: repo: - # Note: Add `python_module_name` for all edx-platform plugins and XBlocks such as DoneXBlock and completion, - # but not for micrsoervices and IDAs such as course-discovery and credentials. - - repo_name: AudioXBlock - python_module_name: audio - - repo_name: completion - python_module_name: completion - - repo_name: course-discovery # not a plugin - - repo_name: credentials # not a plugin - - repo_name: DoneXBlock - python_module_name: done - - repo_name: edx-ace - python_module_name: edx_ace - - repo_name: edx-bulk-grades - python_module_name: bulk_grades - - repo_name: edx-ora2 - python_module_name: openassessment - - repo_name: edx-proctoring - python_module_name: edx_proctoring - - repo_name: FeedbackXBlock - python_module_name: feedback - - repo_name: RecommenderXBlock - python_module_name: recommender - - repo_name: xblock-drag-and-drop-v2 - python_module_name: drag_and_drop_v2 - - repo_name: xblock-free-text-response - python_module_name: freetextresponse - - repo_name: xblock-google-drive - python_module_name: google_drive - - repo_name: xblock-image-explorer - python_module_name: image_explorer - - repo_name: xblock-image-modal - python_module_name: imagemodal - - repo_name: xblock-lti-consumer - python_module_name: lti_consumer - - repo_name: xblock-qualtrics-survey - python_module_name: qualtricssurvey - - repo_name: xblock-sql-grader - python_module_name: sql_grader - - repo_name: xblock-submit-and-compare - python_module_name: submit_and_compare + - AudioXBlock + - completion + - course-discovery + - credentials + - DoneXBlock + - edx-ace + - edx-bulk-grades + - edx-ora2 + - edx-proctoring + - FeedbackXBlock + - RecommenderXBlock + - xblock-drag-and-drop-v2 + - xblock-free-text-response + - xblock-google-drive + - xblock-image-explorer + - xblock-image-modal + - xblock-lti-consumer + - xblock-qualtrics-survey + - xblock-sql-grader + - xblock-submit-and-compare runs-on: ubuntu-latest continue-on-error: true @@ -96,11 +76,11 @@ jobs: run: sudo apt install -y gettext # Clones the repository - - name: clone openedx/${{ matrix.repo.repo_name }} + - name: clone openedx/${{ matrix.repo }} uses: actions/checkout@v3 with: - repository: openedx/${{ matrix.repo.repo_name }} - path: translations/${{ matrix.repo.repo_name }} + repository: openedx/${{ matrix.repo }} + path: translations/${{ matrix.repo }} # Sets up Python - name: setup python @@ -115,13 +95,13 @@ jobs: # Extracts the translation source files - name: extract translation source files run: | - cd translations/${{ matrix.repo.repo_name }} + cd translations/${{ matrix.repo }} make extract_translations # Validate compilation of translation source files - name: validate compilation of translation source files run: | - cd translations/${{ matrix.repo.repo_name }} + cd translations/${{ matrix.repo }} django-admin compilemessages --locale en # git adds only the translation source files, found in conf/locale/en @@ -131,19 +111,19 @@ jobs: # set identity git config --global user.email "translations-bot@openedx.org" git config --global user.name "edx-transifex-bot" - # Change directory to translations/${{ matrix.repo.repo_name }} - cd translations/${{ matrix.repo.repo_name }} + # Change directory to translations/${{ matrix.repo }} + 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$") # 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 - echo "Missing English locale directory for ${{ matrix.repo.repo_name }}!" + echo "Missing English locale directory for ${{ matrix.repo }}!" echo "exiting with error!" exit 1 fi - # remove translations/${{ matrix.repo.repo_name }}/.git so we don't commit a submodule + # remove translations/${{ matrix.repo }}/.git so we don't commit a submodule rm -rf .git # finds the django.po and djangojs.po files generated by make # extract_translations into EN_DIR and adds them @@ -170,21 +150,12 @@ jobs: # Check the git statuses of the translation source files echo "GIT_STATUS=$(git status $DJANGO_PATH $DJANGOJS_PATH -s | wc -l)" >> $GITHUB_ENV - - name: create plugin/xblock link - if: ${{ matrix.repo.python_module_name }} - run: | - cd translations/edx-platform-links - if [ ! -d "${{ matrix.repo.python_module_name }}" ]; then - ln -sd ../${{ matrix.repo.repo_name }}/${{ matrix.repo.python_module_name }} ${{ matrix.repo.python_module_name }} - git add ${{ matrix.repo.python_module_name }} - fi - # Attempts to commit the translation source files if there is a difference - name: git commit the translation source files if: "${{ env.GIT_STATUS > 0 }}" run: | # commit the changes - git commit -m "chore: add extracted translation source files from ${{ matrix.repo.repo_name }}" + git commit -m "chore: add extracted translation source files from ${{ matrix.repo }}" # push changes to branch git push diff --git a/translations/edx-platform-links/README.rst b/translations/edx-platform-links/README.rst deleted file mode 100644 index 6a754cdbe43..00000000000 --- a/translations/edx-platform-links/README.rst +++ /dev/null @@ -1,75 +0,0 @@ -Open edX (``edx-platform``) Translations Links -============================================== - -This directory contains links to the Python modules of plugins and XBlocks used in ``edx-platform``. - -This directory is used to enable ``atlas`` fetch translations by module name rather than by repository name for two reasons: - -1. When running ``make pull_translations`` in the edx-platform, the repository name of the installed XBlock isn't available. On the other hand XBlock's python module name is available. -2. Repo names can change but module names don't. - - -Example file structure of the ``edx-platform-links`` directory: - -.. code-block:: bash - - edx-platform-links $ ll - done -> ../DoneXBlock/done/ - drag_and_drop_v2 -> ../xblock-drag-and-drop-v2/drag_and_drop_v2/ - qualtricssurvey -> ../xblock-qualtrics-survey/qualtricssurvey/ - recommender -> ../RecommenderXBlock/recommender/ - submit_and_compare -> ../xblock-submit-and-compare/submit_and_compare/ - - -The links in this directory are automatically created by the ``extract-translation-source-files.yml`` GitHub Action workflow in this repo. - - -Pulling ``edx-platform`` translations with Atlas ------------------------------------------------- - -The ``atlas`` command has been integrated in the ``edx-platform`` repository therefore there's no need to run ``atlas pull`` manually. Regardless, this section shows the manual command arguments because it's needed for some advanced usage of the edX Platform such as installing custom XBlocks that's not part of the openedx github organizaiton. - -The ``atlas`` command to pull from this directory for Drag and Drop v2 XBlock can be executed in two ways: - - -Pull by repository name: - -.. code-block:: bash - - $ atlas pull translations/xblock-drag-and-drop-v2:xblock-drag-and-drop-v2 - $ tree xblock-drag-and-drop-v2 - xblock-drag-and-drop-v2 - └── drag_and_drop_v2 - └── conf - └── locale - ├── ar - │ └── LC_MESSAGES - │ └── django.po - ├── en - │ └── LC_MESSAGES - │ └── django.po - └── fr_CA - └── LC_MESSAGES - └── django.po - -Pull by python module name: - -.. code-block:: bash - - $ atlas pull translations/edx-platform-links/drag_and_drop_v2:drag_and_drop_v2 - $ tree drag_and_drop_v2 - drag_and_drop_v2 - └── conf - └── locale - ├── ar - │ └── LC_MESSAGES - │ └── django.po - ├── en - │ └── LC_MESSAGES - │ └── django.po - └── fr_CA - └── LC_MESSAGES - └── django.po - -The second file tree has one less level of directories because ``xblock-drag-and-drop-v2`` is completely skipped. - diff --git a/translations/edx-platform-links/audio b/translations/edx-platform-links/audio deleted file mode 120000 index d660b1208d0..00000000000 --- a/translations/edx-platform-links/audio +++ /dev/null @@ -1 +0,0 @@ -../AudioXBlock/audio \ No newline at end of file diff --git a/translations/edx-platform-links/bulk_grades b/translations/edx-platform-links/bulk_grades deleted file mode 120000 index bf8d8bc305b..00000000000 --- a/translations/edx-platform-links/bulk_grades +++ /dev/null @@ -1 +0,0 @@ -../edx-bulk-grades/bulk_grades \ No newline at end of file diff --git a/translations/edx-platform-links/completion b/translations/edx-platform-links/completion deleted file mode 120000 index c3bc6acd852..00000000000 --- a/translations/edx-platform-links/completion +++ /dev/null @@ -1 +0,0 @@ -../completion/completion \ No newline at end of file diff --git a/translations/edx-platform-links/done b/translations/edx-platform-links/done deleted file mode 120000 index df76a8de0d7..00000000000 --- a/translations/edx-platform-links/done +++ /dev/null @@ -1 +0,0 @@ -../DoneXBlock/done \ No newline at end of file diff --git a/translations/edx-platform-links/drag_and_drop_v2 b/translations/edx-platform-links/drag_and_drop_v2 deleted file mode 120000 index ae0d39886e2..00000000000 --- a/translations/edx-platform-links/drag_and_drop_v2 +++ /dev/null @@ -1 +0,0 @@ -../xblock-drag-and-drop-v2/drag_and_drop_v2 \ No newline at end of file diff --git a/translations/edx-platform-links/edx_ace b/translations/edx-platform-links/edx_ace deleted file mode 120000 index d307e62397d..00000000000 --- a/translations/edx-platform-links/edx_ace +++ /dev/null @@ -1 +0,0 @@ -../edx-ace/edx_ace \ No newline at end of file diff --git a/translations/edx-platform-links/edx_proctoring b/translations/edx-platform-links/edx_proctoring deleted file mode 120000 index df8f3a0446a..00000000000 --- a/translations/edx-platform-links/edx_proctoring +++ /dev/null @@ -1 +0,0 @@ -../edx-proctoring/edx_proctoring \ No newline at end of file diff --git a/translations/edx-platform-links/feedback b/translations/edx-platform-links/feedback deleted file mode 120000 index 63b50c0f6b0..00000000000 --- a/translations/edx-platform-links/feedback +++ /dev/null @@ -1 +0,0 @@ -../FeedbackXBlock/feedback \ No newline at end of file diff --git a/translations/edx-platform-links/freetextresponse b/translations/edx-platform-links/freetextresponse deleted file mode 120000 index fff959b5d71..00000000000 --- a/translations/edx-platform-links/freetextresponse +++ /dev/null @@ -1 +0,0 @@ -../xblock-free-text-response/freetextresponse \ No newline at end of file diff --git a/translations/edx-platform-links/google_drive b/translations/edx-platform-links/google_drive deleted file mode 120000 index cdd5b0d9620..00000000000 --- a/translations/edx-platform-links/google_drive +++ /dev/null @@ -1 +0,0 @@ -../xblock-google-drive/google_drive \ No newline at end of file diff --git a/translations/edx-platform-links/image_explorer b/translations/edx-platform-links/image_explorer deleted file mode 120000 index b8c157fae5b..00000000000 --- a/translations/edx-platform-links/image_explorer +++ /dev/null @@ -1 +0,0 @@ -../xblock-image-explorer/image_explorer \ No newline at end of file diff --git a/translations/edx-platform-links/imagemodal b/translations/edx-platform-links/imagemodal deleted file mode 120000 index fcbefd5901d..00000000000 --- a/translations/edx-platform-links/imagemodal +++ /dev/null @@ -1 +0,0 @@ -../xblock-image-modal/imagemodal \ No newline at end of file diff --git a/translations/edx-platform-links/lti_consumer b/translations/edx-platform-links/lti_consumer deleted file mode 120000 index cb9bbf88eaa..00000000000 --- a/translations/edx-platform-links/lti_consumer +++ /dev/null @@ -1 +0,0 @@ -../xblock-lti-consumer/lti_consumer \ No newline at end of file diff --git a/translations/edx-platform-links/openassessment b/translations/edx-platform-links/openassessment deleted file mode 120000 index e552bbdcb11..00000000000 --- a/translations/edx-platform-links/openassessment +++ /dev/null @@ -1 +0,0 @@ -../edx-ora2/openassessment \ No newline at end of file diff --git a/translations/edx-platform-links/qualtricssurvey b/translations/edx-platform-links/qualtricssurvey deleted file mode 120000 index e753741c56c..00000000000 --- a/translations/edx-platform-links/qualtricssurvey +++ /dev/null @@ -1 +0,0 @@ -../xblock-qualtrics-survey/qualtricssurvey \ No newline at end of file diff --git a/translations/edx-platform-links/recommender b/translations/edx-platform-links/recommender deleted file mode 120000 index 7a5fc4e5646..00000000000 --- a/translations/edx-platform-links/recommender +++ /dev/null @@ -1 +0,0 @@ -../RecommenderXBlock/recommender \ No newline at end of file diff --git a/translations/edx-platform-links/sql_grader b/translations/edx-platform-links/sql_grader deleted file mode 120000 index 054dc1f7792..00000000000 --- a/translations/edx-platform-links/sql_grader +++ /dev/null @@ -1 +0,0 @@ -../xblock-sql-grader/sql_grader \ No newline at end of file diff --git a/translations/edx-platform-links/submit_and_compare b/translations/edx-platform-links/submit_and_compare deleted file mode 120000 index d58d633bcce..00000000000 --- a/translations/edx-platform-links/submit_and_compare +++ /dev/null @@ -1 +0,0 @@ -../xblock-submit-and-compare/submit_and_compare \ No newline at end of file