Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
storybook-addon-intl
Advanced tools
The Intl addon can be used to provide locale switcher and react-intl.
First, install the addon
npm install -D storybook-addon-intl
Note: Following peer dependencies are required: @storybook/addons
, @storybook/react
, react
and react-intl
.
Add this line to your addons.js
file (create this file inside your storybook config directory if needed).
import 'storybook-addon-intl/register';
In your config.js
import the setIntlConfig
and withIntl
function. Use setIntlConfig
to set the configuration
for react-intl
and `withIntl´ as decorator.
import { addDecorator, configure } from '@storybook/react';
import { setIntlConfig, withIntl } from 'storybook-addon-intl';
// Load the locale data for all your defined locales
import { addLocaleData } from 'react-intl';
import enLocaleData from 'react-intl/locale-data/en';
import deLocaleData from 'react-intl/locale-data/de';
addLocaleData(enLocaleData);
addLocaleData(deLocaleData);
// Provide your messages
const messages = {
'en': { 'button.label': 'Click me!' },
'de': { 'button.label': 'Klick mich!' }
};
const getMessages = (locale) => messages[locale];
// Set intl configuration
setIntlConfig({
locales: ['en', 'de'],
defaultLocale: 'en',
getMessages
});
// Register decorator
addDecorator(withIntl);
// Run storybook
configure(() => require('./stories'), module);
This error can be caused by multiple conflicting versions of @storybook/addons
in your app.
@storybook/addon-
in your package.json
refer to the same and latest version.@storybook/addons
to your app's dependencies
and reinstall all modules.If the above steps don't solve the issue, please read the storybook documentation on this topic:
Most of the time, the fix is deleting the node_modules folder with any package-lock.json or yarn.lock and reinstalling.
FAQs
Addon to provide locale switcher and react-intl for storybook
The npm package storybook-addon-intl receives a total of 33,720 weekly downloads. As such, storybook-addon-intl popularity was classified as popular.
We found that storybook-addon-intl demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.