1 | import React from 'react'
|
2 | import { configure, addDecorator } from '@storybook/react'
|
3 |
|
4 | import { setIntlConfig, withIntl } from 'storybook-addon-intl'
|
5 |
|
6 |
|
7 | const translations = {
|
8 | ReportView: {
|
9 | en: require('../translations/en.json'),
|
10 | es: require('../translations/es.json'),
|
11 | fr: require('../translations/fr.json')
|
12 | }
|
13 | }
|
14 |
|
15 | const getMessages = locale => {
|
16 | return {
|
17 | ...translations.ReportView[locale]
|
18 | }
|
19 | }
|
20 |
|
21 |
|
22 | setIntlConfig({
|
23 | locales: ['en', 'es', 'fr'],
|
24 | defaultLocale: 'en',
|
25 | textComponent: React.Fragment,
|
26 | getMessages
|
27 | })
|
28 |
|
29 |
|
30 |
|
31 | addDecorator(withIntl)
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 | configure(require.context('../src', true, /\.stories\.js$/), module)
|