From d4007d73c2a03cb305cb9ea4156d7c10e2fba2bf Mon Sep 17 00:00:00 2001 From: farhan Date: Mon, 4 May 2026 21:57:03 +0500 Subject: [PATCH 1/6] build: update extract_translations target --- .gitignore | 2 +- Makefile | 16 ---------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index a892252..af96e81 100644 --- a/.gitignore +++ b/.gitignore @@ -52,7 +52,7 @@ cover/ # Translations *.mo -*.po +**/conf/locale/**/LC_MESSAGES/* *.pot # Django stuff: diff --git a/Makefile b/Makefile index ec8562a..553a83e 100644 --- a/Makefile +++ b/Makefile @@ -56,23 +56,7 @@ extract_translations: ## extract strings to be translated, outputting .po files if [ -f $$xblock/$(EXTRACT_DIR)/djangojs.po ]; then \ cd $$xblock/$(EXTRACT_DIR) && msgcat django.po djangojs.po -o django.po && rm -f djangojs.po; \ fi; \ - if [ -f $$xblock/$(EXTRACT_DIR)/django.po ]; then \ - mv $$xblock/$(EXTRACT_DIR)/django.po $$xblock/$(EXTRACT_DIR)/text.po; \ - fi; \ done - @# Merge all per-xblock text.po files into a single combined file for the - @# openedx-translations pipeline (OEP-58), which expects one conf/locale/en per repo. - @mkdir -p $(COMBINED_LOCALE_DIR) - @PO_FILES=""; \ - for xblock in $(XBLOCKS); do \ - if [ -f $$xblock/$(EXTRACT_DIR)/text.po ]; then \ - PO_FILES="$$PO_FILES $$xblock/$(EXTRACT_DIR)/text.po"; \ - fi; \ - done; \ - if [ -n "$$PO_FILES" ]; then \ - msgcat --use-first $$PO_FILES -o $(COMBINED_LOCALE_DIR)/django.po; \ - echo "Combined translation source file written to $(COMBINED_LOCALE_DIR)/django.po"; \ - fi compile_translations: ## compile translation files, outputting .mo files for each supported language for each XBlock @for xblock in $(XBLOCKS); do \ From 2756d9ba98ef568767a5bf4bd6476cf82fd66e8e Mon Sep 17 00:00:00 2001 From: farhan Date: Tue, 5 May 2026 11:36:09 +0500 Subject: [PATCH 2/6] build: update extract_translations target - Update it as per requirement of openedx-platform https://github.com/openedx/openedx-platform/blob/master/openedx/core/djangoapps/plugins/i18n_api.py#L125 --- Makefile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 553a83e..81fc66b 100644 --- a/Makefile +++ b/Makefile @@ -4,11 +4,12 @@ .PHONY: validate_translations pull_translations push_translations install_transifex_client +REPO_ROOT := $(shell pwd) SRC_DIRECTORY := src EXTRACT_DIR := conf/locale/en/LC_MESSAGES COMBINED_LOCALE_DIR := conf/locale/en/LC_MESSAGES # XBlock directories -XBLOCKS=$(shell find $(shell pwd)/$(SRC_DIRECTORY) -mindepth 2 -maxdepth 2 -type d -name 'conf' -exec dirname {} \;) +XBLOCKS=$(shell find $(REPO_ROOT)/$(SRC_DIRECTORY) -mindepth 2 -maxdepth 2 -type d -name 'conf' -exec dirname {} \;) help: ## Show this help message @@ -49,13 +50,17 @@ clean: ## Clean build artifacts ## Localization targets -extract_translations: ## extract strings to be translated, outputting .po files for each XBlock +extract_translations: ## extract strings to be translated, outputting .po files under /conf/locale/ @for xblock in $(XBLOCKS); do \ - echo "Extracting translations for $$xblock..."; \ + module_name=$$(basename $$xblock); \ + echo "Extracting translations for $$module_name..."; \ cd $$xblock && i18n_tool extract --no-segment; \ if [ -f $$xblock/$(EXTRACT_DIR)/djangojs.po ]; then \ - cd $$xblock/$(EXTRACT_DIR) && msgcat django.po djangojs.po -o django.po && rm -f djangojs.po; \ + msgcat $$xblock/$(EXTRACT_DIR)/django.po $$xblock/$(EXTRACT_DIR)/djangojs.po \ + -o $$xblock/$(EXTRACT_DIR)/django.po && rm -f $$xblock/$(EXTRACT_DIR)/djangojs.po; \ fi; \ + mkdir -p $(REPO_ROOT)/$$module_name/$(EXTRACT_DIR); \ + cp $$xblock/$(EXTRACT_DIR)/django.po $(REPO_ROOT)/$$module_name/$(EXTRACT_DIR)/django.po; \ done compile_translations: ## compile translation files, outputting .mo files for each supported language for each XBlock From 1e74ea1c24f45583220b393db9f03427d28af86d Mon Sep 17 00:00:00 2001 From: farhan Date: Tue, 5 May 2026 12:14:09 +0500 Subject: [PATCH 3/6] build!: remove extra translations target --- Makefile | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/Makefile b/Makefile index 81fc66b..3e12b29 100644 --- a/Makefile +++ b/Makefile @@ -63,46 +63,5 @@ extract_translations: ## extract strings to be translated, outputting .po files cp $$xblock/$(EXTRACT_DIR)/django.po $(REPO_ROOT)/$$module_name/$(EXTRACT_DIR)/django.po; \ done -compile_translations: ## compile translation files, outputting .mo files for each supported language for each XBlock - @for xblock in $(XBLOCKS); do \ - echo "Compiling translations for $$xblock..."; \ - cd $$xblock && django-admin compilemessages --locale en; \ - done - -detect_changed_source_translations: - @for xblock in $(XBLOCKS); do \ - echo "Detecting changed translations for $$xblock..."; \ - cd $$xblock && i18n_tool changed; \ - done - -dummy_translations: ## generate dummy translation (.po) files for each XBlock - @for xblock in $(XBLOCKS); do \ - echo "Generating dummy translations for $$xblock..."; \ - cd $$xblock && i18n_tool dummy; \ - done - -build_dummy_translations: extract_translations dummy_translations compile_translations ## generate and compile dummy translation files - -validate_translations: build_dummy_translations detect_changed_source_translations ## validate translations - -pull_translations: ## pull translations from Transifex for each XBlock - @for xblock in $(XBLOCKS); do \ - echo "Pulling translations for $$xblock..."; \ - cd $$xblock && i18n_tool transifex pull; \ - done - -push_translations: extract_translations ## push translations to Transifex for each XBlock - @for xblock in $(XBLOCKS); do \ - echo "Pushing translations for $$xblock..."; \ - cd $$xblock && i18n_tool transifex push; \ - done - -install_transifex_client: ## Install the Transifex client - # Instaling client will skip CHANGELOG and LICENSE files from git changes - # so remind the user to commit the change first before installing client. - git diff -s --exit-code HEAD || { echo "Please commit changes first."; exit 1; } - curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash - git checkout -- LICENSE README.md ## overwritten by Transifex installer - selfcheck: ## check that the Makefile is well-formed @echo "The Makefile is well-formed." From 5dd44ef4ed38b9caf54507e3f4363347f560c040 Mon Sep 17 00:00:00 2001 From: farhan Date: Thu, 7 May 2026 17:03:17 +0500 Subject: [PATCH 4/6] chore: apply if condition while copying the file --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3e12b29..d144087 100644 --- a/Makefile +++ b/Makefile @@ -60,7 +60,9 @@ extract_translations: ## extract strings to be translated, outputting .po files -o $$xblock/$(EXTRACT_DIR)/django.po && rm -f $$xblock/$(EXTRACT_DIR)/djangojs.po; \ fi; \ mkdir -p $(REPO_ROOT)/$$module_name/$(EXTRACT_DIR); \ - cp $$xblock/$(EXTRACT_DIR)/django.po $(REPO_ROOT)/$$module_name/$(EXTRACT_DIR)/django.po; \ + if [ -f $$xblock/$(EXTRACT_DIR)/django.po ]; then \ + cp $$xblock/$(EXTRACT_DIR)/django.po $(REPO_ROOT)/$$module_name/$(EXTRACT_DIR)/django.po; \ + fi; \ done selfcheck: ## check that the Makefile is well-formed From 64fda5a4125e3e9038d12c8152f3ef1bbac11610 Mon Sep 17 00:00:00 2001 From: farhan Date: Fri, 8 May 2026 12:23:01 +0500 Subject: [PATCH 5/6] chore: move rahter than copy the *.po file --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d144087..12b0011 100644 --- a/Makefile +++ b/Makefile @@ -61,7 +61,7 @@ extract_translations: ## extract strings to be translated, outputting .po files fi; \ mkdir -p $(REPO_ROOT)/$$module_name/$(EXTRACT_DIR); \ if [ -f $$xblock/$(EXTRACT_DIR)/django.po ]; then \ - cp $$xblock/$(EXTRACT_DIR)/django.po $(REPO_ROOT)/$$module_name/$(EXTRACT_DIR)/django.po; \ + mv $$xblock/$(EXTRACT_DIR)/django.po $(REPO_ROOT)/$$module_name/$(EXTRACT_DIR)/django.po; \ fi; \ done From e229557580dd42318138e059163a03060f369c55 Mon Sep 17 00:00:00 2001 From: farhan Date: Fri, 8 May 2026 20:11:54 +0500 Subject: [PATCH 6/6] chore: udpate make file targets declaraion --- Makefile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 12b0011..ac18b18 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,5 @@ -.PHONY: help requirements upgrade lint format test docs clean -.PHONY: extract_translations compile_translations -.PHONY: detect_changed_source_translations dummy_translations build_dummy_translations -.PHONY: validate_translations pull_translations push_translations install_transifex_client +.PHONY: help requirements upgrade lint format test test-with-coverage docs clean +.PHONY: extract_translations REPO_ROOT := $(shell pwd)