
From zero to multilingual: set up i18n in your React app, then automate translations with AI.
Install react-i18next and i18next, then configure the i18n instance.
npm install react-i18next i18nextCreate a JSON file per language with nested keys for your UI strings.
// locales/en.json
{
"welcome": "Welcome to our app",
"greeting": "Hello, {{name}}!",
"items": {
"count_one": "{{count}} item",
"count_other": "{{count}} items"
}
}Use the useTranslation hook to access translated strings in any component.
import { useTranslation } from 'react-i18next';
function MyComponent() {
const { t } = useTranslation();
return <h1>{t('welcome')}</h1>;
}i18next supports ICU message format for plurals, interpolation, and context.
import { useTranslation } from 'react-i18next';
function CartSummary({ itemCount }: { itemCount: number }) {
const { t } = useTranslation();
return (
<p>{t('items.count', { count: itemCount })}</p>
// itemCount = 1 → "1 item"
// itemCount = 5 → "5 items"
);
}Now that your i18n setup is complete, automate the translation of your locale files. Just ask your AI assistant to translate them.
# In your IDE, ask your AI assistant:
> Translate locales/en.json to German, Japanese, and Spanish
✓ 3 files translated in 2.1sDrop your translation file here
JSON, YAML, PO, XML, CSV, Markdown, Properties
or click to browse
Target languages