Language

Hugo supports using multiple languages in the same site [1] [2]

To use a language other than English in a site:

Setup

  1. Add a line languageCode = “<lang-code>” to config.toml:
languageCode = "es"
  1. Create a file <lang-code<.yaml in the i18n/ folder, for example i18n/es.yaml.

Use

  1. Replace the English text in the template with a call to i18n with “id” as a parameter. For example, the text Table of Contents is replaced with this:
{{ i18n "TableOfContents" }}
  1. Add the id and a translated text to the language file. For the above example, add these lines to file i18n/es.yaml:
TableOfContents:
  other: Índice de Contenido

References

  1. Hugo Multilingual Part 1: Content translation
  2. Hugo Multilingual Part 2: Strings localization