[GSoC 2026] Add automated translation stub generation for missing reference pages#1473
Conversation
…in a nice expandable way
…README documentation
…generation limits per language; remove test files.
Divyansh013
left a comment
There was a problem hiding this comment.
Hi @aashishpanthi , have added some comments
| ├── test-local.js # Local testing | ||
| ├── test-local.js # Local issue-tracking test | ||
| ├── test-stubs.js # Local stub dry-run (writes to stub-preview/) | ||
| └── stub-preview/ # Dry-run output (gitignored) |
There was a problem hiding this comment.
stub-preview/ isn't in any .gitignore, so the recommended npm run test:stubs leaves untracked files (I hit this). Either add .github/actions/translation-tracker/stub-preview/ to .gitignore, or write dry-run output under an already-ignored dir
| */ | ||
| function generateStubFromEnglish(englishPath, language, contentType = 'reference') { | ||
| const raw = fs.readFileSync(englishPath, 'utf8'); | ||
| const frontmatter = parseFrontmatter(raw, englishPath); |
There was a problem hiding this comment.
generateStubFromEnglish assumes MDX frontmatter, but the scanners also pick up .yaml files. When STUB_CONTENT_TYPES grows beyond reference this will throw and abort the whole batch (no per-file try/catch in the items.map). Either skip .yaml sources for stubbing or handle them explicitly, and wrap the per-file generation so one failure doesn't kill the run
| const contentTypes = parseEnvList(process.env.STUB_CONTENT_TYPES, ['reference']); | ||
| const fullScan = options.fullScan ?? process.env.STUB_FULL_SCAN === 'true'; | ||
| const dryRun = process.env.STUB_DRY_RUN === 'true'; | ||
| const maxFiles = parseInt(process.env.STUB_MAX_FILES || '50', 10); |
There was a problem hiding this comment.
Guard against NaN here, e.g. fall back to 50 if Number.isNaN(maxFiles), so a bad env value doesn't silently generate nothing.
| }); | ||
|
|
||
| if (dryRun || !githubTracker) { | ||
| const previewRoot = |
There was a problem hiding this comment.
This inline previewRoot duplicates the logic in getStubWritePath. Consider deriving the log path from the helper (or path.dirname of the first write) to keep one source of truth.
Addresses #1404
Changes
This PR implements stub-file generation for the GSoC 2026 Translation Tracker (#1404). When a new English reference page exists without translations, the tracker generates placeholder MDX stubs and opens one PR per language for maintainer review.
Features
Stub generation
findMissingTranslations)title,module,submodule,file,description)needsTranslation: truees,hi,ko,zh-HansSTUB_MAX_FILESapplies per language (default50), not as a global cap across all languagesGitHub Actions
.github/workflows/translation-stubs.ymlGENERATE_STUBS=true), separate from issue tracking intranslation-sync.ymlsrc/content/reference/en/**changesworkflow_dispatchwithfull_scanandlanguagesinputsLocal testing
npm run test:stubs— dry-run stub generation intostub-preview/(no PRs, nosrc/content/changes)Code organization
After discussing with Divyansh, I refactored the translation tracker from a single large
index.jsinto focused modules:index.jsconstants.jsutils.jsgithub-tracker.jsworkflows.jsDesign decisions
GENERATE_STUBS=truereturns before issue logic), so PR and issue workflows stay independent.examples,tutorials, etc. can be added later viaSTUB_CONTENT_TYPES.Test plan
aashishpanthi/p5.js-website): workflow creates stub PRs when English reference files are added/changedPR Checklist
To:Do
main. I added feature branch for testing.