How to use next-i18next with storybook?
See original GitHub issueI would like to integrate next-i18next with our storybook that is used in our nextjs app.
I cannot use appWithTranslation
wrapper` as the storybook wrapper is just a normal react component and not App (ts fails as well)
One story is defined for example as
Banana.stories.tsx
storiesOf('Banana', module).add('default', () => {
return (
<StoryWrapper>
<BananaForm {...props} />
</StoryWrapper>
);
});
and StoryWrapper.tsx
is just adding the styled components context to all the stories
<ThemeProvider theme={getTheme(props.theme)}>
<Fragment>
{props.children}
</Fragment>
</ThemeProvider>
If BananaForm
contains useTranslation
hook storybook will crash and that brings me to the question posted here.
How to integrate this library with storybook ?
Would be really awesome developer experience to use same translations as the real project
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Using next-i18next in Storybook - gists · GitHub
next -i18next is built to work server-side as well as client-side. Storybook doesn't support server-side rendering so there's nowhere to add the next-i18next...
Read more >Using next-i18next in Storybook - DEV Community
next -i18next is built to work server-side as well as client-side. Storybook doesn't support server-side rendering so there's nowhere to add ...
Read more >Storybook react-i18next addon
Create a file in your .storybook folder called i18next.js (or whatever you like). In this file, copy and paste the below code and...
Read more >Localize React with i18next in Storybook - YouTube
Claim free Storybook hosting at https://www.chromatic.com/! ... website content using Next.js internationalization and next - i18next.
Read more >Configuring Storybook for Next.Js, I18n, SCSS & TypeScript
This will take care of the initial setup. It'll: add the packages; add the package scripts; add the config files under .storybook ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Duplicate of #1713.
If anyone is using webpack 5 with storybook @thebinaryfelix solution almost worked for me.
The only difference was in
.storybook/main.js
as webpack config do not support{node: { fs: 'empty' }}
anymore.