1.0.1 • Published 3 years ago

@rogal/addon-react-translate v1.0.1

Weekly downloads
10
License
MIT
Repository
-
Last release
3 years ago

Addon React-Translate NPM Version NPM Downloads Actions Status Actions Status

An addon for storybook to change language in your stories along with react-translate with ease

Install

npm install @rogal/addon-react-translate --save-dev

Getting Started

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

Features

  • Change the language of your stories with a selectbox

License

MIT