Cacao Kit

Demo & Semi Documentation

Translating content


Cacao Kit comes in English and German. In the backend, KIRBY_MULTILANG=true turns on the languages defined in site/languages, with English as the default. Each page keeps one content file per language, and translated slugs give German URLs like /de/notizen.

One header per query

Nuxt i18n prefixes every route with its language. The frontend passes that language to each KQL query through the language option of nuxt-kirby, which sends it as the X-Language header, and Kirby answers in that language. Blocks the backend resolves, like the notes grid, come back translated as well.

Switching languages

The language links in the footer lead to the translated URL of the current page. To build them, the page query selects i18nMeta: the title and URI of the page in every language.

Site data like the navigation travels with the first page request. When you switch languages, the next page request brings it along in the new language – still one request per page.

Strings in the frontend

Text that does not come from Kirby, like “Published on” above this note, lives in i18n/locales, one JSON file per language.