An addon for storybook to change language in your stories along with react-translate with ease
npm install @rogal/addon-react-translate --save-dev
In your main.js, in the addons array add
{
addons: [
// other addons...
"@rogal/addon-react-translate"
]
}
And then in your preview.js
import { withReactTranslate } from '@rogal/addon-react-translate';
addDecorator(
withReactTranslate({
languages: ['en', 'es'],
language: 'en',
fallbackLng: 'en',
translations: {
en: {
collection: collectionEN,
},
es: {
collection: collectionES,
}
}
})
);
And then you are good to go
- Change the language of your stories with a selectbox
MIT