-
Notifications
You must be signed in to change notification settings - Fork 2
/
preview.js
42 lines (35 loc) · 956 Bytes
/
preview.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//https://github.com/fynncfchen/storybook-addon-i18next/issues/8
import React, { Suspense } from 'react';
import { initReactI18next } from 'react-i18next';
import { withI18next } from 'storybook-addon-i18next';
import i18n from 'i18next';
import Backend from 'i18next-xhr-backend';
import LanguageDetector from 'i18next-browser-languagedetector';
i18n
.use(Backend)
.use(LanguageDetector)
.use(initReactI18next)
.init({
whitelist: ['en', 'de'],
lng: 'en',
fallbackLng: 'en',
interpolation: {
escapeValue: false,
},
});
export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/
}
}
};
i18n.use(initReactI18next).init({
fallbackLng: 'en'
});
export const decorators = [
withI18next({ i18n, languages: { en: 'English', de: 'Deutsch' }}),
Story => <Suspense fallback='loading...'><Story /></Suspense>
];