Support translations in Storybook: initialize i18n with bundled resources#6848
Open
reecebrowne wants to merge 2 commits into
Open
Support translations in Storybook: initialize i18n with bundled resources#6848reecebrowne wants to merge 2 commits into
reecebrowne wants to merge 2 commits into
Conversation
Both portal and editor components use useTranslation() without fallback strings. Without an initialized i18next instance in the Storybook preview, those components rendered raw keys (e.g. 'accountLink.card.eyebrow') which broke layout and made stories visually useless. Import the en-US TOML files via Vite's ?raw suffix so they are bundled at build time. Parse them with smol-toml and initialize i18next with inline resources — no HTTP fetch, no static-dir conflict between portal and editor both serving /locales/, and synchronous init so no Suspense boundary is needed.
jbrunton96
previously approved these changes
Jun 30, 2026
…mports ESLint flagged two issues in preview.tsx: - @ts-ignore is banned (use @ts-expect-error per @typescript-eslint/ban-ts-comment) - Relative imports (../portal/..., ../editor/...) are banned (use workspace aliases) Add @portal-locales and @editor-locales aliases in main.ts pointing at portal/public/locales and editor/public/locales respectively, then update the two TOML ?raw imports in preview.tsx to use them.
jbrunton96
approved these changes
Jun 30, 2026
Contributor
🚀 V2 Auto-Deployment Complete!Your V2 PR with embedded architecture has been deployed! 🔗 Direct Test URL (non-SSL) http://54.175.155.236:6848 🔐 Secure HTTPS URL: https://6848.ssl.stirlingpdf.cloud This deployment will be automatically cleaned up when the PR is closed. 🔄 Auto-deployed for approved V2 contributors. |
Ludy87
approved these changes
Jun 30, 2026
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.
What
Initializes i18next in the Storybook preview with bundled en-US translations so portal and editor components render real strings instead of raw keys.
Why
Portal and editor components use
useTranslation()without inline fallback strings. Without an initialized i18next instance, stories rendered raw keys likeaccountLink.card.eyebrow, breaking layout and making stories visually useless.How
Import the en-US TOML files via Vite's
?rawsuffix so they are bundled at build time. Parse them withsmol-tomland initialize i18next with inline resources — no HTTP fetch, no static-dir conflict between portal and editor both serving/locales/, and synchronous init so no Suspense boundary is needed.