Skip to content

Support translations in Storybook: locale toolbar - #6843

Merged
reecebrowne merged 3 commits into
mainfrom
feat/storybook-locale-toggle
Jul 17, 2026
Merged

Support translations in Storybook: locale toolbar#6843
reecebrowne merged 3 commits into
mainfrom
feat/storybook-locale-toggle

Conversation

@reecebrowne

@reecebrowne reecebrowne commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

What

Adds a globe toolbar to Storybook so any story can be previewed in all 42 supported languages (the i18n init already on main was English-only).

How

Bundles every locale's translation.toml via a ?raw glob into i18next resources, and switches language on toolbar change. RTL locales (ar, fa) flip document.dir.

@dosubot dosubot Bot added size:M This PR changes 30-99 lines ignoring generated files. enhancement New feature or request size:XL This PR changes 500-999 lines ignoring generated files. and removed size:M This PR changes 30-99 lines ignoring generated files. labels Jun 29, 2026
@reecebrowne
reecebrowne force-pushed the feat/shared-branding branch from 762d1d5 to ee6ae00 Compare June 30, 2026 09:30
@reecebrowne
reecebrowne force-pushed the feat/storybook-locale-toggle branch from bd6f52d to 2784e39 Compare June 30, 2026 09:31
@dosubot dosubot Bot added size:M This PR changes 30-99 lines ignoring generated files. and removed size:XL This PR changes 500-999 lines ignoring generated files. labels Jun 30, 2026
@reecebrowne
reecebrowne changed the base branch from feat/shared-branding to feat/storybook-i18n-init June 30, 2026 09:32
Base automatically changed from feat/storybook-i18n-init to feat/shared-branding June 30, 2026 10:36
@reecebrowne
reecebrowne force-pushed the feat/shared-branding branch from 4ca60d8 to ee6ae00 Compare June 30, 2026 10:40
@reecebrowne
reecebrowne force-pushed the feat/storybook-locale-toggle branch from 2784e39 to 83c8e55 Compare June 30, 2026 10:47
@reecebrowne
reecebrowne changed the base branch from feat/shared-branding to feat/storybook-i18n-init June 30, 2026 10:47
Storybook only initialised i18n with en-US, so every story rendered
English. Bundle all shipped locale TOMLs via a ?raw glob and add a globe
toolbar that drives i18next.changeLanguage, so any story can be previewed
in any supported language. RTL locales also flip document.dir/lang.

The ?raw glob and import.meta.env now type-check thanks to a vite/client
reference at the top of the preview.
@reecebrowne
reecebrowne changed the base branch from feat/storybook-i18n-init to main July 15, 2026 16:38
@reecebrowne
reecebrowne force-pushed the feat/storybook-locale-toggle branch from 83c8e55 to d210386 Compare July 15, 2026 16:38
@stirlingbot stirlingbot Bot added Front End Issues or pull requests related to front-end development and removed enhancement New feature or request labels Jul 15, 2026
Comment thread frontend/.storybook/preview.tsx Outdated
jbrunton96
jbrunton96 previously approved these changes Jul 17, 2026
em dash

Co-authored-by: James Brunton <jbrunton96@gmail.com>
@reecebrowne
reecebrowne added this pull request to the merge queue Jul 17, 2026
Merged via the queue into main with commit 8b179fb Jul 17, 2026
45 checks passed
@reecebrowne
reecebrowne deleted the feat/storybook-locale-toggle branch July 17, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Front End Issues or pull requests related to front-end development size:M This PR changes 30-99 lines ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants