storybook-i18n
Advanced tools
Comparing version 3.0.1 to 3.1.1
var e={}; | ||
export { e as default }; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.js.map | ||
//# sourceMappingURL=index.js.map |
@@ -7,3 +7,3 @@ import { addons, types, useGlobals, useChannel } from '@storybook/manager-api'; | ||
var s="storybook/i18n-addon",c="storybook/i18n-addon/tool",a="LOCALE_CHANGED";var T=t=>typeof t=="string"?{title:t}:{title:t.title||"",icon:t.icon,right:t.right},b=(t,e,i)=>t?Object.entries(t).map(([o,n])=>({...T(n),id:o,active:o===e,onClick:()=>i(o)})):[{id:"none",title:"No locales in parameters",active:!0,onClick:()=>{}}],h=()=>{let[t,e]=useGlobals(),{locale:i,locales:o}=t,n=useChannel({});return r.createElement(WithTooltip,{closeOnOutsideClick:!0,placement:"top",tooltip:({onHide:m})=>r.createElement(TooltipLinkList,{links:b(o,i,l=>{l!==i&&(e({locale:l}),n(a,l)),m();})}),trigger:"click"},r.createElement(IconButton,{key:"i18n-locale",title:"Locale Selector"},r.createElement(GlobeIcon,null)))},p=h;addons.register(s,()=>{addons.add(c,{title:"Storybook i18n",type:types.TOOL,match:({viewMode:t})=>!!t?.match(/^(story|docs)$/),render:p});}); | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=manager.js.map | ||
//# sourceMappingURL=manager.js.map |
import { useGlobals, useEffect } from '@storybook/preview-api'; | ||
var e=(r,o)=>{let[c,n]=useGlobals();return useEffect(()=>{let{parameters:{locale:t}}=o;t&&n({locale:t});},[]),r(o)};var l={decorators:[e],globals:{locale:"",locales:{}}},f=l; | ||
var e=(r,o)=>{let[i,n]=useGlobals();return useEffect(()=>{let{parameters:{locale:t}}=o;t&&n({locale:t});},[]),r(o)};var s={decorators:[e],initialGlobals:{locale:"",locales:{}}},f=s; | ||
export { f as default }; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=preview.js.map | ||
//# sourceMappingURL=preview.js.map |
{ | ||
"name": "storybook-i18n", | ||
"version": "3.0.1", | ||
"version": "3.1.1", | ||
"description": "Tool to set the locale in Storybook for i18n", | ||
@@ -55,34 +55,34 @@ "keywords": [ | ||
"devDependencies": { | ||
"@storybook/addon-essentials": "^8.0.0", | ||
"@storybook/addon-interactions": "^8.0.0", | ||
"@storybook/addon-links": "^8.0.0", | ||
"@storybook/blocks": "^8.0.0", | ||
"@storybook/components": "^8.0.0", | ||
"@storybook/core-events": "^8.0.0", | ||
"@storybook/manager": "^8.0.0", | ||
"@storybook/manager-api": "^8.0.0", | ||
"@storybook/preview": "^8.0.0", | ||
"@storybook/preview-api": "^8.0.0", | ||
"@storybook/react": "^8.0.0", | ||
"@storybook/react-vite": "^8.0.0", | ||
"@storybook/addon-essentials": "8.2.6", | ||
"@storybook/addon-interactions": "8.2.6", | ||
"@storybook/addon-links": "8.2.6", | ||
"@storybook/blocks": "8.2.6", | ||
"@storybook/components": "8.2.6", | ||
"@storybook/core-events": "8.2.6", | ||
"@storybook/manager": "8.2.6", | ||
"@storybook/manager-api": "8.2.6", | ||
"@storybook/preview": "8.2.6", | ||
"@storybook/preview-api": "8.2.6", | ||
"@storybook/react": "8.2.6", | ||
"@storybook/react-vite": "8.2.6", | ||
"@storybook/testing-library": "^0.2.2", | ||
"@storybook/theming": "^8.0.0", | ||
"@storybook/types": "^8.0.0", | ||
"@types/node": "^18.15.0", | ||
"@types/react": "^18.2.55", | ||
"@types/react-dom": "^18.2.19", | ||
"@storybook/theming": "8.2.6", | ||
"@storybook/types": "8.2.6", | ||
"@types/node": "22.0.0", | ||
"@types/react": "18.3.3", | ||
"@types/react-dom": "18.3.0", | ||
"@vitejs/plugin-react": "^4.2.1", | ||
"auto": "^11.0.4", | ||
"auto": "11.2.0", | ||
"boxen": "^7.1.1", | ||
"dedent": "^1.5.1", | ||
"dedent": "1.5.3", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^3.2.5", | ||
"prettier": "3.3.3", | ||
"prompts": "^2.4.2", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react": "18.3.1", | ||
"react-dom": "18.3.1", | ||
"rimraf": "^5.0.5", | ||
"storybook": "^8.0.0", | ||
"tsup": "^8.0.2", | ||
"typescript": "^5.3.3", | ||
"vite": "^5.1.2", | ||
"storybook": "8.2.6", | ||
"tsup": "8.2.3", | ||
"typescript": "5.5.4", | ||
"vite": "5.3.5", | ||
"zx": "^7.2.3" | ||
@@ -89,0 +89,0 @@ }, |
@@ -9,5 +9,8 @@ # Storybook-i18n | ||
2.x Requires storybook `>=7.0.0` | ||
3.x Requires storybook `>=8.0.0` | ||
## Versions | ||
- 2.x is for Storybook `>=7.0.0` | ||
- 3.x is for Storybook `>=8.0.0` | ||
- 3.1.x is for Storybook `>=8.2.0` | ||
## Addon authors | ||
@@ -58,2 +61,4 @@ | ||
As of Storybook 8.2, you should use `initialGlobals` instead of `globals`. | ||
`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. | ||
@@ -63,3 +68,3 @@ | ||
const preview: Preview = { | ||
globals: { | ||
initialGlobals: { | ||
locale: "en", | ||
@@ -79,3 +84,3 @@ locales: { | ||
const preview: Preview = { | ||
globals: { | ||
initialGlobals: { | ||
locale: "en_US", | ||
@@ -99,3 +104,3 @@ locales: { | ||
const preview: Preview = { | ||
globals: { | ||
initialGlobals: { | ||
locale: 'en', | ||
@@ -114,3 +119,3 @@ locales: { | ||
const preview: Preview = { | ||
globals: { | ||
initialGlobals: { | ||
locale: 'en_US', | ||
@@ -117,0 +122,0 @@ locales: { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17079
142