@arckit/storybook
v1.1.0
Published
Storybook decorators and utilities for i18n-enabled component stories
Downloads
360
Maintainers
Readme
@arckit/storybook
Storybook decorators and utilities for i18n-enabled component stories.
📑 Table of Contents
- 🪧 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/storybookDecorator for stories
import { withI18nProvider } from '@arckit/storybook';
import translations from '@public/locales/en-US/my-namespace.json';
const meta = {
decorators: [withI18nProvider('en-US', { 'my-namespace': translations })]
};Translation helper for tests
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
