Internationalization
Files: src/config/language.json, src/config/config.toml, src/i18n/<lang>.json, src/config/menu.<lang>.json, src/content/**/<language>/ · Skill level: Beginner
In the Tina edition, these are the language folders, Menus, and Interface labels at /admin/. In the Sanity edition, content, menus, and labels are documents in the Studio, one set per language, and language.json stays in the project.
Taxo ships in English, French, and Arabic. Arabic is the right-to-left example: see RTL & Arabic.
Taxo’s multilingual behavior is controlled by three layers:
src/config/language.json[settings.multilingual]insrc/config/config.toml- the content folders:
english/,french/, andarabic/
Language Definitions
[ { "languageName": "English", "languageCode": "en", "contentDir": "english", "dir": "ltr", "ogLocale": "en_US", "dateLocale": "en-US", "weight": 1 }, { "languageName": "Français", "languageCode": "fr", "contentDir": "french", "dir": "ltr", "ogLocale": "fr_FR", "dateLocale": "fr-FR", "weight": 2 }, { "languageName": "العربية", "languageCode": "ar", "contentDir": "arabic", "dir": "rtl", "ogLocale": "ar_SA", "dateLocale": "ar", "weight": 3 }]dir sets the direction. The Arabic text is a machine translation, so have a native speaker review it before you publish.
Main Multilingual Settings
[settings.multilingual] enable = true defaultLanguage = "en" disableLanguages = [] showDefaultLangInUrl = falseURL Behavior
When showDefaultLangInUrl = false:
- default language URLs look like
/about/ - other languages look like
/fr/about/and/ar/about/
When showDefaultLangInUrl = true:
- default language URLs look like
/en/about/ - other languages look like
/fr/about/and/ar/about/
Content Folder Rule
Every localized collection follows the same pattern:
src/content/blog/english/src/content/blog/french/src/content/blog/arabic/src/content/services/english/src/content/services/french/src/content/services/arabic/Add A Language
Use German as the example. In the Astro and Tina editions:
npm run generate-multilingual-content -- --lang de --name Deutsch --dir-name german --locale de-DE --og de_DEIn the Sanity edition, the last flag is --og-locale:
npm run generate-multilingual-content -- --lang de --name Deutsch --dir-name german --locale de-DE --og-locale de_DEFor a right-to-left language, add --dir rtl. Then:
- Astro: translate the new
german/content folders,src/config/menu.de.json, andsrc/i18n/de.json, and restart the dev server. - Tina: run
npm run tina:generateand restartnpm run dev, and the editor has forms for the new language. Translate there or in the files. - Sanity: with a project connected, it creates a German copy of each sample English document in your project, to translate. The copies come from the sample content, not your own edits, and your other documents aren’t touched. Restart the dev server, and the language appears in the Studio.
Links written inside text, such as [text](/about/), need the language in front: [text](/de/about/).
The script doesn’t change netlify.toml. On Netlify, add a /de/* block to it yourself, as the other languages have, so a missing address shows that language’s 404 page.
Remove One Language
Add its code to disableLanguages in [settings.multilingual] in config.toml. It leaves your site. In the Tina edition, its forms stay in the editor. In the Sanity edition, its documents stay in the Studio.
Keep Only Your Default Language
- Astro: set
enable = falsein[settings.multilingual], runnpm run devonce, then runnpm run remove-multilingual. - Tina: do the same, then run
npm run tina:generateandnpm run devonce more, so the editor matches. - Sanity: run
npm run remove-multilingual. Its documents stay in your project unless you add-- --delete-online, which deletes them and can’t be undone.
Shared Text Files
Update these in every language for translated UI labels:
src/i18n/en.jsonsrc/i18n/fr.jsonsrc/i18n/ar.json
Update these in every language for translated menu labels:
src/config/menu.en.jsonsrc/config/menu.fr.jsonsrc/config/menu.ar.json
Important Restart Note
After changing multilingual settings, restart the dev server so routing and theme settings stay aligned.