Skip to content

Commit d6163da

Browse files
authored
fix(storybook): fix for choosing french and chinese locales (#681)
* fix(storybook): fix for choosing french and chinese locales * chore: remove console log
1 parent abe42de commit d6163da

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

.storybook/decorators/intl/intl.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,21 @@ addLocaleData(frFR);
1515
addLocaleData(zhCN);
1616
const locales = Object.keys(messages);
1717

18+
const slugifyLocale = locale => {
19+
switch (locale) {
20+
case 'frFR':
21+
return 'fr-FR';
22+
case 'zhCN':
23+
return 'zh-CN';
24+
default:
25+
return locale;
26+
}
27+
};
28+
1829
export default storyFn => {
1930
const locale = select('global locale', locales, locales[0]);
2031
return (
21-
<IntlProvider locale={locale} messages={messages[locale]}>
32+
<IntlProvider locale={slugifyLocale(locale)} messages={messages[locale]}>
2233
{storyFn()}
2334
</IntlProvider>
2435
);

0 commit comments

Comments
 (0)