feat: native i18n locale support for screenshots#95
Merged
Conversation
added 2 commits
April 11, 2026 20:01
Add `locales` config option to generate screenshots for multiple languages
without duplicating screenshot definitions. Use `{locale}` in URLs for
path-based routing. Browser locale and Accept-Language headers are set
per locale. Multiple locales output to `{locale}/` subdirectories;
single locale preserves existing flat structure (backwards compatible).
Shorten locales describe text to fit on a single line and remove intermediate variables in parallelCapture.ts to bring both files within the 200-line limit.
🦋 Changeset detectedLatest commit: a5fc76c The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
added 2 commits
April 11, 2026 20:33
The generator now owns the Locale Screenshots section in config-reference.md via a suffix constant, preventing the CI docs-freshness check from failing. Also regenerates config-reference.md to match current generator output.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Closes #94 — adds native locale/i18n support so users can generate screenshots for multiple languages without duplicating screenshot definitions.
localesconfig option:locales: ['en', 'de', 'fr']{locale}URL placeholder: replaced per locale inurlfield for path-based routinglocale+Accept-Languageheader set per localeheroshots/en/home.png,heroshots/de/home.png; single locale → flatheroshots/home.png(fully backwards compatible)Changes
src/schema.ts—locales?: string[]field inconfigSchemasrc/browser/types.ts+launchBrowser.ts—localeoption passed to Playwright contextsrc/sync/types.ts—locale?+localeUrl?onCaptureVariantsrc/sync/sync.ts— iterates(locale, colorScheme)pairs in sequential pathsrc/sync/schemeCapture.ts— passes locale to browser launch + resolves{locale}URLssrc/sync/parallelCapture.ts—CaptureJobextended with locale fields; groups by locale for separate browser instancessrc/sync/configHelpers.ts—calculateTotalCapturesaccounts for locale countsrc/sync/results.ts—buildVariantSuffixincludes locale prefixsrc/utils/localeUrl.ts(new) —applyLocale(url, locale)utilitysrc/utils/screenshotPath.ts— prepends locale as directory when multiple locales configureddocs/docs/config-reference.md— full documentation forlocalesoptionTest plan
pnpm test:run— all 487 tests passsrc/tests/cli/locale.test.ts— 3 tests verifying locale subdirectory output{locale}/subdirectories created{locale}URL placeholder replaced per locale