
Building Modular React Blocks with WCAG AAA Accessibility Using Agent Skills
Where to Put Skills in Your Project Most agents look for project skills inside a hidden folder at th...
Loading page...

Published on: 2 November 2026
In a modern development context, i18n (internationalization) is used to make applications adaptable to different languages and regions without engineering changes. This is especially critical for apps targeting global users.
Using React i18n, typically with the react-i18next library, allows developers to build multilingual React applications efficiently
Storybook is a powerful tool for building, testing, and documenting UI components in isolation — especially valuable in React projects
Install the react-i18n and storybook and its dependencies first
Change the preview.ts file to preview.tsx file
Update the preview.tsx file as below
import type { Preview } from '@storybook/react';
import { I18nextProvider } from 'react-i18next';
import i18n from '../src/i18n/config';
const withI18n = (Story: any, context: any) => {
const lang = context.globals.locale;
i18n.changeLanguage(lang); // 🌐 Switch language based on selected global
return (
<I18nextProvider i18n={i18n}>
<Story />
</I18nextProvider>
);
};
const preview: Preview = {
decorators: [withI18n],
globalTypes: {
locale: {
name: 'Locale',
description: 'Internationalization locale',
defaultValue: 'en',
toolbar: {
icon: 'globe',
items: [
{ value: 'en', title: 'English' },
{ value: 'fr', title: 'Français' },
{ value: 'es', title: 'Español' },
],
},
},
},
};
export default preview;Once you’ve completed the setup steps for react-i18next, you can update your component-level code to retrieve and display text based on the selected language using the t() function from useTranslation.
// locales/en/home.json
{
"header": "Home Page",
"intro": "This is your dashboard"
}
// locales/fr/home.json
{
"header": "Page d'accueil",
"intro": "C'est votre tableau de bord"
}
Change your component like below
import React from 'react';
import { useTranslation } from 'react-i18next';
const WelcomeComponent = () => {
const { t } = useTranslation();
const name = "John Doe";
return (
<div>
<h1>{t('title')}</h1>
<p>{t('message', { name })}</p>
</div>
);
};
export default WelcomeComponent;Once all the above steps are done, you can see the language switcher in the storybook.

Once the language is changed then the component will update to the selected language.
Hope this finds helpfull to you all. Happy Coding.

Where to Put Skills in Your Project Most agents look for project skills inside a hidden folder at th...

Step-by-Step Breakdown for Your Blog You can break down this code for your readers into four key arc...

Designing dynamic forms that scale efficiently while managing validation can be tricky. React Hook F...