Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
storybook-i18n
Advanced tools
A library for best-practice i18n addons in Storybook:
As an addon author, you can use this library by adding it as a dependency and adding the following to your /preset.js
file:
function config(entry = []) {
return [
...entry,
require.resolve('storybook-i18n/preview'), // <-- library's preview preset
require.resolve('./dist/esm/preset/preview'), // <-- your addon's preview preset (if present)
];
}
function managerEntries(entry = []) {
return [
...entry,
require.resolve('storybook-i18n/manager'),
require.resolve('./dist/esm/preset/manager'), // <-- your addon's manager (if present)
];
}
module.exports = {config, managerEntries};
The currently selected locale is available in the locale
global, so you can access it in a decorator using the following snippet:
import { MyProvider } from 'your-i18n-library';
import { useGlobals } from '@storybook/client-api';
const myDecorator = (story, context) => {
const [{locale}] = useGlobals();
return <MyProvider locale={locale}>;
}
End users configure the locales
and locale
parameters in .storybook/preview.js
.
Locales
is an object where the keys are the "ids" of the locale/language and the values are the plain text name of that locale you want to use. This is what will appear in the dropdown in the toolbar.
export const parameters = {
locale: "en",
locales: {
en: "English",
fr: "Français",
ja: "日本語",
},
};
Users can also use full locale strings.
export const parameters = {
locale: "en_US",
locales: {
en_US: "English (US)",
en_GB: "English (GB)",
fr_FR: "Français",
ja_JP: "日本語",
},
};
Addons should instruct them to use whichever format your i18n implementation expects.
v1.0.2 (Fri Aug 06 2021)
main
FAQs
Tool to set the locale in Storybook for i18n
The npm package storybook-i18n receives a total of 109,731 weekly downloads. As such, storybook-i18n popularity was classified as popular.
We found that storybook-i18n 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
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.