Content locales
Publish your site in several languages: the i18n configuration, per-locale pages and news, localized content type fields and the ?locale= parameter.
HydroGo has two independent language concepts. Content locales (this page) are the languages of your site's content. The admin interface language is what editors see in the panel; see Admin interface language.
Enable locales
i18n:
enabled: true
default_locale: en
locales: [en, tr, de]HYDRO_I18N_ENABLED=true HYDRO_DEFAULT_LOCALE=en HYDRO_LOCALES=en,tr,de hydro serve --config config.yamldefault_localemust not be empty and must be one oflocales.localesholds 1 to 64 codes such asen,tr,pt-BRorzh-Hans.- Restart the server after changing locales.
Pages and news
Pages and news articles are per-locale documents: each has a locale, and the slug is unique within that locale. Create the English about page and a Turkish hakkimizda page as two documents (the page editor also offers a Translate action to start from an existing page).
curl 'https://cms.example.com/api/v1/pages/by-slug?locale=en&slug=about'
curl 'https://cms.example.com/api/v1/pages/by-slug?locale=tr&slug=hakkimizda'
curl 'https://cms.example.com/api/v1/news?locale=tr&limit=10'Always pass locale to the pages and news endpoints. They do not fall back to another locale's document.
Localized fields in content types
In a content type, mark the fields whose text differs per language with localized: true. Storage keeps one value per locale.
id: team
label: Team
revisions: true # required when any field is localized
public: true
fields:
- {id: name, label: Name, kind: text, required: true, list: true}
- {id: role, label: Role, kind: text, list: true, localized: true}
- {id: bio, label: Bio, kind: textarea, localized: true}
- {id: photo, label: Photo, kind: media, localized: true}| Rule | Detail |
|---|---|
| Allowed kinds | text, textarea, richtext, media. |
| Not combinable with | unique, searchable, filterable. |
| Requires | revisions: true on the type. |
| Default locale | The record itself holds the default locale's value; other locales are stored beside it. |
| Activation | Only when i18n.enabled is true and more than one locale is configured. Otherwise the flag changes nothing. |
In the admin
Records of types with localized fields show locale tabs. Edit the default locale first, then switch tabs to fill the others. A copy from action seeds a locale from another one.
In the API
# default locale
curl 'https://cms.example.com/api/v1/content/team'
# Turkish values; any missing field falls back to the default locale per field
curl 'https://cms.example.com/api/v1/content/team?locale=tr'With ?locale= the response is flagged with metadata.locale and each record gets a locale field. Fallback happens field by field: if only role is translated, bio still comes back in the default language. An unknown locale answers 400.
?locale= asks for another.From your frontend
const locale = params.lang ?? 'en';
const page = await hydro.getPage(locale, params.slug);
const news = await hydro.listNews(locale, 10);
const team = await hydro.listContent('team', { locale });Site-level text
Navigation menus and translation strings are stored per locale too: Site > Navigation and Site > Translations in the admin, and GET /api/v1/site/navigation/{locale} in the API.