Internationalization
Files: src/config/language.json, src/config/config.toml, src/i18n/, src/config/menu.*.json, src/content/**/<language>/ · Skill level: Beginner
Kivo ships in English (the default, at /) and French (at /fr/). Every page, menu, and label exists in both. Right-to-left languages such as Arabic or Hebrew are not supported.
What Makes Up A Language
| Part | Files |
|---|---|
| The language itself | an entry in src/config/language.json |
| Page and section text | a folder per language in every content folder: src/content/sections/french/, src/content/blog/french/, … |
| Interface text | src/i18n/fr.json (buttons, form messages, labels) |
| Menus | src/config/menu.fr.json |
In src/config/language.json:
[ { "languageName": "En", "languageCode": "en", "contentDir": "english", "weight": 1 }, { "languageName": "Fr", "languageCode": "fr", "contentDir": "french", "weight": 2 }]languageName is shown in the language switch, languageCode is the URL prefix and the file suffix (fr.json, menu.fr.json), and contentDir is the folder name inside each content folder.
Language Settings
[settings.multilingual] enable = true defaultLanguage = "en" disableLanguages = [""] # for example ["fr"] showDefaultLangInUrl = false # true gives /en/pricing/ instead of /pricing/Restart npm run dev after any change here.
Use English Only
You have two options:
-
Turn French off, keep the files. Set
enable = false(ordisableLanguages = ["fr"]). Only English is built and the language switch disappears. You can turn French back on any time. -
Delete French for good. First set
enable = falseand runnpm run devornpm run astro-checkonce, so.astro/config.generated.jsonexists (the script reads your default language from it). Then save a checkpoint (a git commit or a copy of the folder) and run:Terminal window npm run remove-multilingualIt deletes every
french/content folder,src/i18n/fr.json, andsrc/config/menu.fr.json, and removes French fromlanguage.json. This can’t be undone without your checkpoint.
Replace French With Another Language
The easiest way to get a Spanish (or German, or Japanese) site is to turn the French copy into it:
-
In
language.json, change the French entry to"languageName": "Es","languageCode": "es","contentDir": "spanish". -
Rename every
src/content/**/french/folder tospanish/. -
Rename
src/i18n/fr.jsontoes.jsonandsrc/config/menu.fr.jsontomenu.es.json. -
Translate the text values in those files and folders. Keep every key as it is, and change internal links in Markdown text from
/fr/to/es/. -
In
netlify.toml, change the/fr/*redirect to/es/*and/es/404/. -
Restart
npm run devand open/es/.
Translating a whole site is a perfect job for an AI assistant: see the prompt at the end of this page.
Add A Third Language
Follow the same pattern without removing French:
-
Add an entry to
language.json, for example{ "languageName": "De", "languageCode": "de", "contentDir": "german", "weight": 3 }. -
Copy
src/i18n/en.jsontode.jsonandsrc/config/menu.en.jsontomenu.de.json, then translate them. -
In every content folder that has an
english/folder, create agerman/copy and translate it. -
On Netlify, add a redirect block for
/de/*tonetlify.toml, like the French one. -
Restart
npm run devand open/de/.
These are the same steps as the “Add or remove a language” recipe in SKILLS.md, so an AI assistant can follow them for you.
Directorysrc/content/
Directorysections/
Directoryenglish/
- …
Directoryfrench/
- …
Directorygerman/
- …
Directoryblog/
Directoryenglish/
- …
Directoryfrench/
- …
Directorygerman/
- …
Links Between Pages
- In menus and in
urlfields of buttons and links in content files, write the English path (/pricing/). Kivo adds the language prefix for you. - In Markdown text (the body of a post or page), write the full path for that language yourself:
[see pricing](/fr/pricing/)in a French file. - If you use
customSlug, give it the same value in every language so the language switch finds the matching page.
Translated 404 Pages
Each language has its own 404 page (/fr/404/). On Netlify, the redirect in netlify.toml sends a missing /fr/... address to it; add one block per extra language. Other hosts show the default (English) 404 page for every language.
Do It With AI
Replace French with [LANGUAGE] (code "[xx]", folder "[name]"). Update src/config/language.json,rename every src/content/**/french/ folder to [name]/, rename src/i18n/fr.json andsrc/config/menu.fr.json to [xx].json and menu.[xx].json, and update the "/fr/*" redirect innetlify.toml. Then translate every text value in those files from the English versions. Keep allkeys, option values, icon names, URLs, and code samples unchanged. In Markdown text, changeinternal links from /fr/ to /[xx]/. Work folder by folder and tell me when each is done.