🌎 Language and translation
此内容尚不支持你的语言。
Both the interface and content language can be changed to suit your needs.
Interface
The Interface Language controls the text on the site that isn’t part of your content files. You can choose from 35+ languages, with English being the default for new sites.
Available Language Packs
Choose from 35+ interface languages including:
- عربي (ar)
- Català (ca)
- Česky (cs)
- Dansk (da)
- Deutsch (de)
- Ελληνικά (el)
- English (en)
- Español (es)
- Eesti (et)
- Euskara (eu)
- فارسی (fa)
- Suomi (fi)
- Français (fr)
- עברית (he)
- Magyar (hu)
- Bahasa Indonesia (id)
- Italiano (it)
- 日本語 (ja)
- ភាសាខ្មែរ (km)
- 한국어 (ko)
- Lietuvių (lt)
- Latviešu (lv)
- Norsk bokmål (nb)
- Nederlands (nl)
- Polski (pl)
- Português (pt)
- Română (ro)
- Русский (ru)
- Soomaali (so)
- Svenska (sv)
- Türkçe (tr)
- Українська (uk)
- Tiếng Việt (vi)
- 中文 (简体) (zh)
- 中文 (繁體) (zh-hant)
Setting the Language
Choose the languages you wish to use from the list above, noting their identifiers in brackets. Alternatively, a new language pack can be created by following the guide in the next section.
Follow the brief instructions in your config/_default/languages.yaml
to configure which language packs you wish to use.
To change the default language, set defaultContentLanguage
to the desired language identifier in your hugo.yaml
file.
Create or Modify a Language Pack
The interface text is stored in dedicated language files so that the interface can be translated or edited.
To edit the interface text:
- Create an
i18n
folder at the root of your site - Download a language file, such as the English file, to your
i18n
folder, so you have a path likei18n/en.yaml
- Open the language file and make any desired changes to the text appearing after
translation:
- If it’s a new language pack, add the language name to the list of available languages
Language packs are structured in YAML, similar to Markdown front matter.
To translate the interface text into a new language, follow the above instructions, but name the new file in the form i18n/XX.yaml
where XX
is the appropriate ISO/RFC5646 language identifier for the translation.
If you translate the interface into a new language, please consider contributing it by opening a Pull Request on our GitHub.
Navigation Bar
To translate the navigation bar for the site’s default language, you can edit the default menu links in config/_default/menus.yaml
.
For a multilingual site, you can duplicate config/_default/menus.yaml
to config/_default/menus.XX.yaml
and translate its menu items, where XX
is the language identifier (e.g. menus.zh.yaml
for Simplified Chinese). Thus, the navigation bar can be displayed in multiple languages.
Content
In this section, you will learn how to create content in multiple languages.
Move all you existing content in content/
to a sub-folder named with the appropriate ISO/RFC5646 language identifier. For example, if your existing content is in English, move your content to content/en/
.
To create content in an additional language, create a sub-folder in content/
named with the appropriate ISO/RFC5646 language identifier. Then place your translated content in here, just as you would for your primary language content.
If a page has been translated into multiple languages, a language chooser will appear in the navigation bar to allow the user to select which language they would like to view the page in.
You may also need to configure config/_default/languages.yaml
with the relevant content directories. This can be performed by creating a config section for each language and setting its contentDir
to the relevant path.
For further details on Hugo’s internationalization and multilingual features, refer to the associated Hugo documentation.