Skip to content

fix: simplify i18n extraction pipeline#1656

Merged
arbrandes merged 1 commit intoopenedx:frontend-basefrom
brian-smith-tcril:extract-translations
Mar 26, 2026
Merged

fix: simplify i18n extraction pipeline#1656
arbrandes merged 1 commit intoopenedx:frontend-basefrom
brian-smith-tcril:extract-translations

Conversation

@brian-smith-tcril
Copy link
Contributor

Summary

  • Simplify make extract_translations by removing the separate i18n.concat step
  • @openedx/frontend-base (as of alpha.16) now writes flat KV JSON directly to src/i18n/transifex_input.json, so the concat step and its associated transifex-utils dependency are no longer needed
  • Bump @openedx/frontend-base peer dep to ^1.0.0-alpha.16 to require the version that includes this change (see openedx/frontend-base#200)

Verified by running make extract_translations on this branch and confirming src/i18n/transifex_input.json is written correctly. Also compared the output against upstream master — our branch produces a strict subset (same keys, same values; 16 keys absent due to source code removed in the frontend-base branch, zero conflicts).

Test plan

  • Run make extract_translations and verify src/i18n/transifex_input.json is generated in flat KV format

Log

extract-translations work log

Repo: frontend-app-authn — branch extract-translations (off frontend-base)

Goal: Get make extract_translations working on the frontend-base branch, using the pattern established in openedx/paragon#4177.

Background

Standard MFEs use a two-step pipeline via make extract_translations:

  1. i18n.extract — runs fedx-scripts formatjs extract (from frontend-build), outputs an array of {id, defaultMessage, description} objects to ./temp/babel-plugin-formatjs/Default.messages.json
  2. i18n.concat — runs transifex-utils.js (from frontend-platform), reads that array and writes flat KV to src/i18n/transifex_input.json

The frontend-base branch doesn't have frontend-platform or frontend-build available, so this pipeline breaks.

Error (current, on frontend-base branch without this fix)

make extract_translations fails at the i18n.concat step:

Error: Found no messages
    at Object.<anonymous> (.../node_modules/@openedx/frontend-base/dist/tools/cli/transifex-utils.js:38:11)

Investigation findings

  • i18n_extract in package.json runs openedx formatjs extract (from @openedx/frontend-base CLI)
  • That command writes to ./temp/formatjs/Default.messages.json
  • The Makefile's i18n.concat step passes ./temp/babel-plugin-formatjs to transifex-utils.js — that directory never gets created, so it throws Found no messages
  • Root cause: path mismatch — the Makefile still references the old frontend-build-era path ./temp/babel-plugin-formatjs, but frontend-base's CLI writes to ./temp/formatjs

The fix in openedx/frontend-base#200 sidesteps this entirely — the formatter now outputs flat KV directly to src/i18n/transifex_input.json, removing the need for the concat step altogether.

Verification

  • Ran make extract_translations on frontend-base branch (without fix): ❌ Error: Found no messages
  • Ran make extract_translations on upstream master: ✅ passes
  • Ran make extract_translations on this branch (extract-translations): ✅ passes
  • Compared output against upstream master: our branch is a strict subset — same keys, same values, zero conflicts (16 keys absent due to source code removed in the frontend-base branch)

🤖 Generated with Claude Code

The formatjs formatter in @openedx/frontend-base now outputs flat KV
JSON directly to src/i18n/transifex_input.json (as of alpha.16), so the
separate i18n.concat step and its associated transifex-utils dependency
are no longer needed.

Bump @openedx/frontend-base peer dep to ^1.0.0-alpha.16 to require the
version that includes this change.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Mar 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (frontend-base@575892f). Learn more about missing BASE report.

Additional details and impacted files
@@               Coverage Diff                @@
##             frontend-base    #1656   +/-   ##
================================================
  Coverage                 ?   92.12%           
================================================
  Files                    ?       92           
  Lines                    ?     2045           
  Branches                 ?      588           
================================================
  Hits                     ?     1884           
  Misses                   ?      158           
  Partials                 ?        3           

☔ 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.

@arbrandes arbrandes merged commit 510de50 into openedx:frontend-base Mar 26, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants