Skip to content

build: update extract_translations target - #35

Merged
farhan merged 6 commits into
mainfrom
farhan/fix-translations
May 8, 2026
Merged

farhan merged 6 commits into
mainfrom
farhan/fix-translations

Conversation

@farhan

@farhan farhan commented May 4, 2026 •

Copy link
Copy Markdown
Contributor

Study the parent story for the implementation of this PR: openedx/xblocks-core#241

Relevant openedx-translations PR: openedx/openedx-translations#72135

Reference studied code for the translations work: https://github.com/openedx/FeedbackXBlock/blob/master/Makefile#L78

How to test:

  1. Create python virtual environment
  2. pip install edx-i18n-tools
  3. Run make extract_translations at root of repository

Translations should be created as per screen shot.

image

@codecov

codecov Bot commented May 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.80%. Comparing base (c09eb76) to head (e229557).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #35   +/-   ##
=======================================
  Coverage   79.80%   79.80%           
=======================================
  Files          41       41           
  Lines        1139     1139           
  Branches       75       75           
=======================================
  Hits          909      909           
  Misses        203      203           
  Partials       27       27           
Flag Coverage Δ
unittests 79.80% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the repository’s localization extraction workflow to align with the newer openedx-translations expectations by changing where extracted .po files are written and tightening gitignore patterns for locale artifacts.

Changes:

  • Add REPO_ROOT and update XBlock discovery to use it.
  • Rewrite extract_translations to extract per-XBlock catalogs, merge djangojs.po into django.po, and copy results into <module_name>/conf/locale/....
  • Update .gitignore to ignore all files under **/conf/locale/**/LC_MESSAGES/* (instead of blanket *.po).

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 3 comments.

File Description
Makefile Reworks extract_translations to generate/copy per-module django.po files and adds REPO_ROOT usage.
.gitignore Narrows ignore rules from all *.po to locale-message directories.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Makefile
.PHONY: validate_translations pull_translations push_translations install_transifex_client


REPO_ROOT := $(shell pwd)
Comment thread Makefile Outdated
Comment on lines +62 to +63
mkdir -p $(REPO_ROOT)/$$module_name/$(EXTRACT_DIR); \
cp $$xblock/$(EXTRACT_DIR)/django.po $(REPO_ROOT)/$$module_name/$(EXTRACT_DIR)/django.po; \

@farhan farhan May 7, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not helpful in our context

Comment thread Makefile Resolved
@irfanuddinahmad

Copy link
Copy Markdown
Contributor

Missing pull_translations (OEP-58 distribution side)

PR removes the old i18n_tool transifex pull based pull_translations but adds no replacement. Without it, translated files from openedx-translations never land in src/<module>/conf/locale/<lang>/ at runtime.

Add this to the Makefile:

pull_translations: ## pull translations from openedx-translations via atlas
	atlas pull \
	    translations/xblocks-extra/audio/conf/locale:src/audio/conf/locale \
	    translations/xblocks-extra/feedback/conf/locale:src/feedback/conf/locale \
	    translations/xblocks-extra/imagemodal/conf/locale:src/imagemodal/conf/locale \
	    translations/xblocks-extra/qualtricssurvey/conf/locale:src/qualtricssurvey/conf/locale \
	    translations/xblocks-extra/sql_grader/conf/locale:src/sql_grader/conf/locale \
	    translations/xblocks-extra/submit_and_compare/conf/locale:src/submit_and_compare/conf/locale
	@for xblock in $(XBLOCKS); do \
	    cd $$xblock && django-admin compilemessages; \
	done

Also note: edx-platform's pull_xblock_translations management command pulls XBlock translations via package i18n entry points — each consolidated xblock's package metadata will need to declare the new translations/xblocks-extra/<module>/conf/locale path so the platform can find them.

@farhan

farhan commented May 7, 2026 •

Copy link
Copy Markdown
Contributor Author

Missing pull_translations (OEP-58 distribution side)

PR removes the old i18n_tool transifex pull based pull_translations but adds no replacement. Without it, translated files from openedx-translations never land in src/<module>/conf/locale/<lang>/ at runtime.

Add this to the Makefile:

pull_translations: ## pull translations from openedx-translations via atlas
	atlas pull \
	    translations/xblocks-extra/audio/conf/locale:src/audio/conf/locale \
	    translations/xblocks-extra/feedback/conf/locale:src/feedback/conf/locale \
	    translations/xblocks-extra/imagemodal/conf/locale:src/imagemodal/conf/locale \
	    translations/xblocks-extra/qualtricssurvey/conf/locale:src/qualtricssurvey/conf/locale \
	    translations/xblocks-extra/sql_grader/conf/locale:src/sql_grader/conf/locale \
	    translations/xblocks-extra/submit_and_compare/conf/locale:src/submit_and_compare/conf/locale
	@for xblock in $(XBLOCKS); do \
	    cd $$xblock && django-admin compilemessages; \
	done

Also note: edx-platform's pull_xblock_translations management command pulls XBlock translations via package i18n entry points — each consolidated xblock's package metadata will need to declare the new translations/xblocks-extra/<module>/conf/locale path so the platform can find them.

I didn't find the place where this pull_translations target is required, can you please refer me

@farhan
farhan requested a review from Copilot May 7, 2026 15:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@irfanuddinahmad

Copy link
Copy Markdown
Contributor

Missing pull_translations (OEP-58 distribution side)
PR removes the old i18n_tool transifex pull based pull_translations but adds no replacement. Without it, translated files from openedx-translations never land in src/<module>/conf/locale/<lang>/ at runtime.
Add this to the Makefile:

pull_translations: ## pull translations from openedx-translations via atlas
	atlas pull \
	    translations/xblocks-extra/audio/conf/locale:src/audio/conf/locale \
	    translations/xblocks-extra/feedback/conf/locale:src/feedback/conf/locale \
	    translations/xblocks-extra/imagemodal/conf/locale:src/imagemodal/conf/locale \
	    translations/xblocks-extra/qualtricssurvey/conf/locale:src/qualtricssurvey/conf/locale \
	    translations/xblocks-extra/sql_grader/conf/locale:src/sql_grader/conf/locale \
	    translations/xblocks-extra/submit_and_compare/conf/locale:src/submit_and_compare/conf/locale
	@for xblock in $(XBLOCKS); do \
	    cd $$xblock && django-admin compilemessages; \
	done

Also note: edx-platform's pull_xblock_translations management command pulls XBlock translations via package i18n entry points — each consolidated xblock's package metadata will need to declare the new translations/xblocks-extra/<module>/conf/locale path so the platform can find them.

I didn't find the place where this pull_translations target is required, can you please refer me

@farhan it is a new pull_translations target using atlas, with the correct destination paths

@farhan

farhan commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

@farhan it is a new pull_translations target using atlas, with the correct destination paths

As per my study pull_translations target is not required in the translations flow of openedx-translations

Translations targets were added in xblocks-extra just for the testing purpose and weren't fully tested.

As per claude

How openedx-translations pull the translations:

  1. transifex.yml — the main configuration file

This is the core file that tells Transifex what to sync. It maps source files to
translation output paths for every component. For example, for edx-platform (lines
94–101):

edx-platform

  • filter_type: dir
    file_format: PO
    source_language: en
    source_file_dir: translations/edx-platform/conf/locale/en/
    mode: onlyreviewed
    translation_files_expression: 'translations/edx-platform/conf/locale//'

Key fields:

  • mode: onlyreviewed — only pulls translations that have been reviewed/approved in
    Transifex
  • source_file_dir / source_file — where English source strings live in the repo
  • translation_files_expression — where Transifex deposits the translated files (with
    as a placeholder)
  1. .github/workflows/automerge-transifex-app-prs.yml

Transifex's GitHub App (transifex-integration) opens PRs into this repo whenever
translations are updated. This workflow automatically merges those PRs (rebase
merge) when the PR author matches the configured Transifex bot actor (verified via
TRANSIFEX_APP_ACTOR_NAME and TRANSIFEX_APP_ACTOR_ID secrets).

The flow is:

  1. Source strings are pushed to Transifex (via extract-translation-source-files.yml)
  2. Translators review and approve strings in Transifex
  3. Transifex's GitHub App opens a PR with the translated .po/.json files into this
    repo
  4. The automerge workflow auto-merges those PRs

transifex configs for xblocks-extra has been done in this PR

@farhan
farhan requested a review from irfanuddinahmad May 8, 2026 13:49
@irfanuddinahmad

Copy link
Copy Markdown
Contributor

@farhan you are right — pull_translations is not required here. Translations flow from openedx-translations to running environments via Tutor/atlas at deploy time, not through a target in this repo. Withdrawing that suggestion.

One narrower point remains: each consolidated XBlock's Python package will need to declare its i18n entry point pointing to the new translations/xblocks-extra/<module>/conf/locale path, so that edx-platform's pull_xblock_translations management command can locate translations correctly. That's a packaging concern, not a Makefile one, and can be tracked separately.

Comment thread Makefile Resolved
@farhan
farhan merged commit e185cd8 into main May 8, 2026
7 checks passed
@farhan
farhan deleted the farhan/fix-translations branch May 8, 2026 15:16
@github-project-automation github-project-automation Bot moved this from 👀 In review to ✅ Done in Aximprovements Team May 8, 2026
irfanuddinahmad pushed a commit to irfanuddinahmad/xblocks-extra that referenced this pull request May 19, 2026
- Make multiple local paths for every XBlock
- Move the django.po files to repo root to make it compatible with edx-platform implementation
@farhan farhan mentioned this pull request Jun 1, 2026
5 tasks done
farhan added a commit to openedx/xblocks-core that referenced this pull request Nov 16, 2026
openedx-platform looks up xblock translations by module name
(translations/*/<module_name>/conf/locale), so a single combined
catalog can't be matched to the blocks. Write one django.po per
block under <module_name>/conf/locale/ instead, mirroring
openedx/xblocks-extra#35.

The compile/dummy/validate/pull/push targets and the translations
tox env relied on the old src/ text.po layout, so they are removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
farhan added a commit to openedx/xblocks-core that referenced this pull request Nov 16, 2026
openedx-platform looks up xblock translations by module name
(translations/*/<module_name>/conf/locale), so a single combined
catalog can't be matched to the blocks. Write one django.po per
block under <module_name>/conf/locale/ instead, mirroring
openedx/xblocks-extra#35.

The compile/dummy/validate/pull/push targets and the translations
tox env relied on the old src/ text.po layout, so they are removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
farhan added a commit to openedx/xblocks-core that referenced this pull request Nov 16, 2026
openedx-platform looks up xblock translations by module name
(translations/*/<module_name>/conf/locale), so a single combined
catalog can't be matched to the blocks. Write one django.po per
block under <module_name>/conf/locale/ instead, mirroring
openedx/xblocks-extra#35.

The compile/dummy/validate/pull/push targets and the translations
tox env relied on the old src/ text.po layout, so they are removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
farhan added a commit to openedx/xblocks-core that referenced this pull request Nov 16, 2026
openedx-platform looks up xblock translations by module name
(translations/*/<module_name>/conf/locale), so a single combined
catalog can't be matched to the blocks. Write one django.po per
block under <module_name>/conf/locale/ instead, mirroring
openedx/xblocks-extra#35.

The compile/dummy/validate/pull/push targets and the translations
tox env relied on the old src/ text.po layout, so they are removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
farhan added a commit to openedx/xblocks-core that referenced this pull request Nov 17, 2026
* build: extract translations per xblock for openedx-translations

openedx-platform looks up xblock translations by module name
(translations/*/<module_name>/conf/locale), so a single combined
catalog can't be matched to the blocks. Write one django.po per
block under <module_name>/conf/locale/ instead, mirroring
openedx/xblocks-extra#35.

The compile/dummy/validate/pull/push targets and the translations
tox env relied on the old src/ text.po layout, so they are removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

4 participants