# Internationalization (Languages)

## 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

Covena ships in **English** (the default, at `/`), **French** (at `/fr/`), and **Arabic** (at `/ar/`, right to left). Every page, menu, and label exists in all three. You can keep all three, switch one off, keep only your default language, or add another one. For how right-to-left pages work, see [RTL & Arabic](/covena/features/rtl-arabic/).

<Aside type="caution">
  The French and Arabic text was translated for the demo. Have a native speaker
  review it before you publish it.
</Aside>

### 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, such as `src/content/sections/french/` and `src/content/practice-areas/arabic/` |
| Interface text | `src/i18n/<lang>.json`, such as `fr.json`: buttons, labels, form messages, the address and opening hours, the tagline |
| Menus | `src/config/menu.<lang>.json`, such as `menu.ar.json` |

`<language>` is a folder name (`english`, `french`, `arabic`) and `<lang>` is a language code (`en`, `fr`, `ar`). Each language is edited on its own: changing an English file does not change the French or Arabic one, and a missing translation does not fall back to English.

```json
// src/config/language.json (the French entry)
{
  "languageName": "Français",
  "languageCode": "fr",
  "contentDir": "french",
  "dir": "ltr",
  "ogLocale": "fr_FR",
  "dateLocale": "fr-FR",
  "weight": 2
}
```

| Key | What it does |
| --- | --- |
| `languageName` | The name in the language menus |
| `languageCode` | The URL prefix and the file suffix (`fr.json`, `menu.fr.json`) |
| `contentDir` | The folder name inside each content folder |
| `dir` | `ltr` or `rtl`. This one value sets the direction of every page in the language |
| `ogLocale` | The language of social previews |
| `dateLocale` | How dates and numbers are written, for example "4 November 2026" or "4 novembre 2026" |
| `weight` | The order in the language menus |

Visitors switch language in the header (from 1320 px wide, when `showLanguageSwitcher = true` under `[settings.header]`), in the mobile menu, and in the footer, which has a language menu on every page. The menu opens the same page in the other language.

### Language Settings
```toml
# src/config/config.toml
[settings.multilingual]
  enable               = true
  defaultLanguage      = "en"
  disableLanguages     = [""]   # e.g. ["ar"] switches Arabic off without deleting it
  showDefaultLangInUrl = false  # true puts English at /en/ instead of /
```

Restart `npm run dev` after you change any of these.

### Translate Or Edit Text
- **Page and section text:** edit the file with the **same name** in the language's folder, for example `src/content/sections/french/hero-portrait-navy.md`. Keep the keys and the structure as they are in English, and translate the values.
- **Interface text:** edit the same key in the language's file, for example `navigation.buttonLabel` ("Free consultation") in `src/i18n/fr.json`.
- **Address and opening hours:** `contactInfo.address` in each `src/i18n/<lang>.json`. The hours visitors see are in `contactLines.hours` in `src/content/sections/<language>/contact-split-form.md` and in each office file, so translate them there (see [Firm Info](/covena/customization/firm-info/)). The phone and email are set once in `[settings.contactInfo]` in `config.toml`.
- **Menus:** keep each `menu.<lang>.json` in step with `menu.en.json`: the same items, in the same order, with the same `url`. Translate the `name` and `description` values.
- **Page titles:** every title ends with the tagline in the page's language. For the default language it is `tagline` in `[site]` in `config.toml`. The others use `common.tagline` in their `src/i18n/<lang>.json`. Keep `common.tagline` in `en.json` the same as the config value.

### Links Keep Their Language
Write internal links without a language, like `/fees/`, in every language's files. The theme adds the prefix, so the same link opens `/fr/fees/` on a French page. This works for buttons, menus, and links in Markdown text. Never type `/fr/` or `/ar/` into content.

### Numbers, Prices, And Dates
Figures that count up are written in the page's format when the site builds: "1,250" and "4.9" in English and Arabic, "1 250" and "4,9" in French (with a narrow no-break space). In content you can write a figure either way. Put it in quotes to keep the thousands separator, such as `"1,250"`.

| Key in `src/i18n/<lang>.json` | What it sets |
| --- | --- |
| `common.priceFormat` | Where the currency goes: "£1,250" in English, "1 250 £" in French, "1,250 £" in Arabic |
| `common.colon` | The colon after labels. French puts a no-break space before it |

Dates follow `dateLocale` in `language.json`. When you write prices in running text, use the same pattern as `priceFormat`, with a no-break space before the symbol in French and Arabic.

### Add A Language
<Steps>

1. Run the command with the code, the name, the folder, the date locale, and the social locale (German as the example):

   ```bash
   npm run generate-multilingual-content -- --lang de --name Deutsch --dir-name german --locale de-DE --og de_DE
   ```

   For a right-to-left language, add `--dir rtl`. The command adds the entry to `language.json` and copies the default language's content folders, menu file, and i18n file. It keeps files that already exist unless you add `--force`.

2. Translate the new `german/` folders, `src/config/menu.de.json`, and `src/i18n/de.json`.

3. Restart the dev server and open `/de/`.

4. On Netlify, add a `/de/*` block to `netlify.toml` like the `/fr/*` one, so missing German pages show the German 404 page.

</Steps>

### Remove A Language
- **Switch one language off:** add its code to `disableLanguages`, for example `["ar"]`. The files stay, so you can turn it back on.
- **Keep only your default language:** set `enable = false` under `[settings.multilingual]`, run `npm run dev` once, then run:

  ```bash
  npm run remove-multilingual
  ```

  It deletes every other language's content folders, menu files, and i18n files, and keeps your default language, whichever it is. Commit or back up your project first, because this can't be undone from inside the theme.

### Check Your Translations
`npm run verify` runs every check in the theme, including three for languages:

| Script | What it checks |
| --- | --- |
| `scripts/check-i18n-keys.mjs` | Every `src/i18n/<lang>.json` file has the same keys |
| `scripts/check-localized-links.mjs` | No link in the built site leaves its language |
| `scripts/check-hreflang.mjs` | Every language link in the page head points to a page that exists |

### Do It With AI
```text
Translate the Covena page [FILE NAME] into French. The English file is
src/content/[COLLECTION]/english/[FILE NAME]. Edit the file with the same name in
src/content/[COLLECTION]/french/. Keep every key, slug, image path, link and number
exactly as it is, and translate only the text values. Write internal links without
a language prefix. Use a no-break space before the currency symbol in prices.
Then run npm run astro-check.
```