Internationalization
Files: src/config/language.json, src/config/config.toml, src/i18n/, src/config/menu.*.json, src/content/**/<language>/ · Skill level: Beginner
Homio ships in English (the default, at /) and French (at /fr/). Every page, menu, label, price, and date exists in both. You can keep both, keep English only, or add another language.
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/services/french/, … |
| Interface text | src/i18n/fr.json: buttons, labels, form messages, units, the booking steps, the 404 link labels |
| Menus | src/config/menu.fr.json |
[ { "languageName": "En", "languageCode": "en", "contentDir": "english", "weight": 1, "ogLocale": "en_US" }, { "languageName": "Fr", "languageCode": "fr", "contentDir": "french", "weight": 2, "ogLocale": "fr_FR" }]languageCode is the URL prefix and the file suffix (fr.json, menu.fr.json), contentDir the folder name inside each content folder, languageName the label on the language links, weight their order, and ogLocale the language of social previews.
Visitors switch language with the EN | FR links in the footer and at the bottom of the phone menu. A link goes to the same page in the other language.
Your business details stay in one place for every language: [business] in config.toml (name, phone, address, hours). Don’t type them into translations.
Language Settings
[settings.multilingual] enable = true defaultLanguage = "en" disableLanguages = [""] # e.g. ["fr"] to switch French off without deleting it showDefaultLangInUrl = false # true: English at /en/ instead of /Restart npm run dev after you change these values.
Translate Or Edit Text
- Page and section text: edit the file with the same name in the
french/folder, for examplesrc/content/sections/french/hero-section.md. Keep the keys and structure the same as in English; translate the values only. - Interface text: edit the same key in
src/i18n/fr.json, for examplenavigation.buttonLabel(“Get a price”). - Menus:
src/config/menu.fr.jsonmust keep the same structure asmenu.en.json: the same items, in the same order, with the sameurlandsource. Translate the labels. - Prices: keep every number in
src/content/pricing/french/-index.mdidentical to the English file.npm run buildprints a[pricing]warning listing any key that differs.
Check Your Translations
npm run check-i18nIt also runs as part of npm run astro-check, and fails when:
- a key in
src/i18n/en.jsonis missing from another language file, or the reverse, - a key in
en.jsonis no longer read by any code, - a menu file differs from
menu.en.jsonin structure (item count,url,source), - a content file in an
english/folder has no copy in another language folder, or the reverse.
It warns about empty strings and strings still equal to the English ones. Words that are the same in every language on purpose are listed in scripts/check-i18n.mjs.
Numbers, Prices, And Dates
Homio formats every price, number, date, and opening time for the page language with the browser’s Intl tools: $1,240 in English becomes 1 240 $US in French. You never write a formatted price in content: prices come from the numbers in the pricing file.
[settings.estimator] currency = "USD" # ISO 4217 code, one currency for every language currencyDisplay = "symbol" # symbol ($ / $US) | narrowSymbol ($ in every language) | code (USD)Set currency to your own ("EUR", "GBP", "CAD"), and use narrowSymbol to show $ in French too. Opening hours and booking dates use timezone in [business].
Keep English Only
- Set
enable = falsein[settings.multilingual]ofsrc/config/config.toml. - Run
npm run dev(ornpm run astro-check) once. - Run
npm run remove-multilingual. It deletes everyfrench/folder,menu.fr.json, andfr.json, and rewriteslanguage.json.
The script always keeps the English menu and interface strings. To keep only French or another language, remove the other files by hand instead.
Add A Language
Example: German, code de, folder german.
-
Copy every
english/folder undersrc/content/(each collection has one) to agerman/folder next to it. -
Add the language to
src/config/language.json:{"languageName": "De","languageCode": "de","contentDir": "german","weight": 3,"ogLocale": "de_DE"} -
Copy
src/config/menu.en.jsontosrc/config/menu.de.json, andsrc/i18n/en.jsontosrc/i18n/de.json. -
Translate the copied content, menu, and interface strings.
-
Run
npm run check-i18nand fix what it lists. -
On Netlify, add a
/de/*404 block tonetlify.toml, copied from the French one. Restart the dev server.
Right-to-left languages such as Arabic or Hebrew are not part of the theme.
Do It With AI
Add [LANGUAGE] (code [CODE], folder [FOLDER]) to my Homio site. Follow "Add or remove a language"in SKILLS.md: copy every english/ content folder, add the entry to src/config/language.json, copymenu.en.json and src/i18n/en.json, and translate them. Don't run generate-multilingual-content.Keep every number in the pricing file identical. Then run npm run check-i18n and fix what it lists.Translate my changes to French: for every file I changed in src/content/**/english/ today, updatethe file with the same name in french/ (same keys, translated values, numbers unchanged), and addany new key from src/i18n/en.json to fr.json. Then run npm run check-i18n.