@rogal/addon-react-translate
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @rogal/addon-react-translate

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

13.2 kB

Total Files

13

Last publish

Collaborators

  • gabrielseco