Locales & Translations
Translate your platform's interface into the languages your users speak.
How Locales Work
A locale is one language of your platform's interface: a name, a code, and the text of every label, message, and email your platform shows in that language. Each piece of text is a phrase.
- English and French come with every phrase already written.
- Any other language is a custom locale. A phrase you leave empty uses the English text.
- One locale is the default, the language visitors see first. The first locale you add becomes the default, and deleting the default makes another locale the default.
- A project with no locales uses English.
Visitors switch languages from the language menu in your platform's header, and their browser remembers the choice. Locale changes reach your platform in the next version you create and download.
Managing Locales in the Web App
Open your project's Settings, then the Internationalization tab. Locale changes save when you click Save in the locale form, not with the settings page's own Save button.
Add a Locale
- Under Add New Locale, open Select Locale.
- Pick a language with ready-made phrases, such as Français (fr), or pick Create Custom Locale for any other language. Languages already in your project aren't listed.
- For a custom locale, enter a Name such as
Spanishand a Code such ases. - Turn on Default Locale to make it the language visitors see first.
- Fill in the Locale Strings. An empty field shows the English text it falls back to.
- Click Save.
Edit or Delete a Locale
Existing Locales lists each locale's name and code, with a check mark next to the default.
- Click Edit to change its phrases or turn on Default Locale, then click Save.
- Click Delete to remove it.
Managing Locales from the CLI
devour sync writes your locales into a locales/ folder next to your config
file, one file per language:
my-project/
├── devour.json
└── locales/
├── en.json
└── fr.json
Each file holds the locale's name, its code, whether it's the default, and its phrases:
{
"name": "Français",
"code": "fr",
"isDefault": false,
"phrases": {
"login": "Se connecter",
"register": "Créer un compte",
"email": "Adresse courriel"
}
}
Add or Translate a Language
- Copy a file, for example
locales/en.jsontolocales/es.json. - Change
nameandcode, translate the phrases, and setisDefaulttotrueif it should be the default. - Apply your config:
devour setup --config devour.json
Before it changes anything, setup prints the locales it will create, update,
and delete. A phrase missing from a file keeps its current text. In a new
locale, it uses the ready-made phrase for that language, which is English for a
custom language.
Remove a Language
Delete its file from locales/ and run devour setup --config devour.json.
setup asks you to confirm the deletion. Pass --yes to confirm without a
prompt, for example when an agent drives the CLI. The default locale is never
deleted this way, and an empty or missing locales/ folder leaves your locales
untouched.
Keep Local Edits Across a Sync
setup refuses to run when the project changed on the server since your last
devour sync, so a missing file never deletes a locale by accident. To refresh
without losing your edits:
devour stash
devour sync
devour stash pop
devour setup --config devour.json