// @flow
import React from 'react';
import { IntlProvider, addLocaleData } from 'react-intl';
import type { StoryDecorator } from '@storybook/react';
import en from 'react-intl/locale-data/en';
import fr from 'react-intl/locale-data/fr';

addLocaleData([...en, ...fr]);

const testMessages = { test: 'Localized string' };

export const intlDecorator: StoryDecorator = (story, context) => (
  <IntlProvider locale="en-CA" messages={testMessages}>
    <React.Fragment>{story(context)}</React.Fragment>
  </IntlProvider>
);
