From b4e34f0aa46d317d87b3ffd9503935cba86a36bb Mon Sep 17 00:00:00 2001 From: Shadi Naif Date: Wed, 23 Aug 2023 14:59:25 +0300 Subject: [PATCH] feat: Special support for XBlocks XBlocks require text.po and textjs.po instead of django.po and djangojs.po Refs: FC-0012 OEP-58 --- .../extract-translation-source-files.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/extract-translation-source-files.yml b/.github/workflows/extract-translation-source-files.yml index 1b55b3dba23..d4bb505bf02 100644 --- a/.github/workflows/extract-translation-source-files.yml +++ b/.github/workflows/extract-translation-source-files.yml @@ -149,6 +149,22 @@ jobs: # extract_translations into EN_DIR and adds them DJANGO_PATH=$(find $EN_DIR -name 'django.po') DJANGOJS_PATH=$(find $EN_DIR -name 'djangojs.po') + ############## Special support for XBlocks + # if both files are not found, then it can be an XBlock (thus, text.po and textjs.po files) + if [ -z "$DJANGO_PATH" ] && [ -z "$DJANGOJS_PATH" ]; then + DJANGO_PATH=$(find $EN_DIR -name 'text.po') + DJANGOJS_PATH=$(find $EN_DIR -name 'textjs.po') + # Rename the files to django.po and djangojs.po, if exists + if [ ! -z "$DJANGO_PATH" ]; then + mv $DJANGO_PATH $(dirname $DJANGO_PATH)/django.po + DJANGO_PATH=$(dirname $DJANGO_PATH)/django.po + fi + if [ ! -z "$DJANGOJS_PATH" ]; then + mv $DJANGOJS_PATH $(dirname $DJANGOJS_PATH)/djangojs.po + DJANGOJS_PATH=$(dirname $DJANGOJS_PATH)/djangojs.po + fi + fi + ############## End of - Special support for XBlocks # use (-f) to force add the files even if they are ignored in the source repo git add $DJANGO_PATH $DJANGOJS_PATH -f -v # Check the git statuses of the translation source files