Multiple languages

Hugobricks has been fully prepared to support a multilingual setup. In the docs you will see the ‘/en/’ reference more than once. This means you can duplicate and translate all content in as many languages as you want by following a similar pattern with a different language string. Adding a language also requires an entry in hugo.yaml:

defaultContentLanguage: en
languages:
  en:
    locale: en
    label: English
    contentDir: content/en
    weight: 1
  nl:
    locale: nl
    label: Nederlands
    contentDir: content/nl
    weight: 2

Everything that is not page content lives in data/<lang>/, so a language is a content directory plus a data bundle: general, header, footer, openinghours, reviews, people, features, pricing, faqs, webshop and the three form definitions. Language-independent switches live in data/settings.yaml.

The theme’s own interface strings — the ‘Read more’ buttons, the cart and checkout labels, the screen-reader labels — live in i18n/<lang>.yaml, one flat key: value per line. Give a new language its own file there; a missing key falls back to the default language. English, Dutch, German, Czech and Korean ship with the theme.

Templates reach the bundle of the language being rendered through one partial:

{{ $d := partial "data.html" . }}{{ $d.general.title }}

Get started with Hugobricks today!

Experience the future of web development with Hugo and stackable content bricks. Build lightning-fast static sites with ease and flexibility.

Get started now