Build it with your agent
Two conversations as they could go: you say one sentence, your agent builds on i18next, and the texts end up in plain files in your repo.
Make my bakery’s website available in German and French.
Done. I used i18next, an open-source library for translations: every text now lives in one plain file per language, not inside the pages.
- Moved 38 texts out of the pages into
locales/en/common.json - Wrote
locales/de/common.jsonandlocales/fr/common.json - One address per language,
/en//de//fr/, with hreflang links between them - A language switcher in the header
- Ran
i18next-cli status: no text is missing in any language
Worked for 3 minutes · 14 files changed
Here is the home page. Try the switcher, or change the number of loaves: French puts 0 in the singular, English and German in the plural.
The previews run i18next in this page, with the translation files your agent wrote.
Can our shop assistant reword the French tagline herself? She is from France.
Yes. It is one line of locales/fr/common.json. She can change it there, on GitHub or in any
editor, or ask any agent to do it. If she would rather not touch files, a translation management tool can sit on top
of the same files.
{
"tagline": "Pain au levain et viennoiseries, cuits chaque matin.",
"loaves_one": "{{count}} pain de seigle pour demain",
"loaves_other": "{{count}} pains de seigle pour demain"
}Add German to our React app.
Done. I set up i18next with react-i18next and moved the texts out of the components into one file per language.
- Ran
i18next-cli instrument: 214 texts in 31 components now go throught() - Ran
i18next-cli extract: all keys inlocales/en/translation.json - Wrote
locales/de/translation.json - A language switcher in the settings, the browser language as the default
- Added
i18next-cli statusto CI: the build fails when a German text is missing
Worked for 6 minutes · 38 files changed
Here is the invoice screen in both languages. Select a few invoices: each language gets its own plural form, and amounts and dates follow its format.
The previews run i18next in this page, with the translation files your agent wrote.
Add an export button to the invoice list.
Done. The button and its two messages are in English and German from the start: I added the keys to both files in the same change, and CI checked that no language is missing one.
// locales/en/translation.json
+ "export": "Export as CSV",
+ "exportDone_one": "{{count}} invoice exported",
+ "exportDone_other": "{{count}} invoices exported"
// locales/de/translation.json
+ "export": "Als CSV exportieren",
+ "exportDone_one": "{{count}} Rechnung exportiert",
+ "exportDone_other": "{{count}} Rechnungen exportiert"passed i18next-cli status · de 217/217
What do you want to tell your agent?
Pick the sentence closest to yours. Each one leads to a prompt you can paste, and to the way your agent builds it.
- Build me a website in two or more languages.New site · Astro or Next
- Add a second language to my site or app.All texts sit in the code today
- Let my client change the texts without a developer.The people who write do not code
- Keep the other languages current when the English changes.Translations fall behind
- Make each language version findable.One address per language, hreflang
Writing the code yourself, or checking what your agent wrote? The docs