[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
| GENERATE_STUBS: 'true' | ||
| STUB_LANGUAGES: ${{ github.event.inputs.languages || 'es,hi,ko,zh-Hans' }} | ||
| # All content types except reference | ||
| STUB_CONTENT_TYPES: examples,tutorials,text-detail,events,libraries |
There was a problem hiding this comment.
Minor design inconsistency and not a bug that STUB_CONTENT_TYPES is hardcoded, inconsistent with languages/full_scan which are exposed as workflow_dispatch inputs.
languages and full_scan are parameterized via github.event.inputs, but STUB_CONTENT_TYPES is a hardcoded env value with no corresponding input, so a maintainer wanting to scope a manual run to one content type must edit the YAML.
| const failures = []; | ||
| let stubsWritten = 0; | ||
|
|
||
| for (const [language, items] of limitedByLanguage) { |
There was a problem hiding this comment.
per-language stub PR creation runs sequentially instead of in parallel.
for (const [language, items] of limitedByLanguage) { ... await githubTracker.createStubPullRequest(...) } awaits each language's PR (blob→tree→commit→branch→PR) one at a time. With up to 4 languages × 50 files each, this adds up unnecessarily since the languages are fully independent; Promise.all over languages would cut wall-clock time roughly 4x. Not new to worry about a timeout, just avoidable latency in a fresh code path.
| return relative; | ||
| } | ||
|
|
||
| function parseEnvList(envValue, defaultList) { |
There was a problem hiding this comment.
parseEnvList returns an empty array (not the default) for garbage comma-only input, silently disabling stub generation.
parseEnvList only falls back to defaultList when the raw env value is empty/whitespace. If it's non-empty but garbage (e.g. STUB_LANGUAGES="," or " , "), split(',').map(trim).filter(Boolean) yields []. An empty array is truthy, so the || defaultStubContentTypes fallback at workflows.js:251 never triggers, and there's no fallback at all for STUB_LANGUAGES (workflows.js:248). Since languages/STUB_LANGUAGES is a free-text workflow_dispatch input, a maintainer typo (stray comma/trailing whitespace) causes the action to silently report "No missing translation files found" and exit with zero stubs and no error , not a crash, but a silent no-op that looks like success.
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.