Storybook decorators and utilities for i18n-enabled component stories.
- 🪧 About
- 📦 Installation
- 🚀 Usage
- 📖 API
- 🤗 Contributing
- 📝 License
Provides a translation helper and a withI18nProvider Storybook decorator for rendering stories with i18n support. Built on @arckit/i18n and i18next.
pnpm add -D @arckit/storybookimport { withI18nProvider } from '@arckit/storybook';
import translations from '@public/locales/en-US/my-namespace.json';
const meta = {
decorators: [withI18nProvider('en-US', { 'my-namespace': translations })]
};import { translation } from '@arckit/storybook';
const t = translation('en-US', { 'my-namespace': translations });| Export | Description |
|---|---|
translation(lng, resources) |
Creates a typed translation function from locale resources. Returns a t function. |
withI18nProvider(lng, resources) |
Storybook decorator that wraps a story with I18nProvider and provides the translation function via injection. |
See CONTRIBUTING.md for details.
MIT © Marc Gavanier