mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-31 22:41:53 +02:00
Merge commit '00c4484c7092181729f6f470805bc7d72e8ad17b'
This commit is contained in:
@@ -1,19 +1,16 @@
|
||||
---
|
||||
title: Multilingual Mode
|
||||
linktitle: Multilingual
|
||||
linkTitle: Multilingual
|
||||
description: Hugo supports the creation of websites with multiple languages side by side.
|
||||
date: 2017-01-10
|
||||
publishdate: 2017-01-10
|
||||
categories: [content management]
|
||||
keywords: [multilingual,i18n, internationalization]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
weight: 150
|
||||
weight: 150 #rem
|
||||
draft: false
|
||||
aliases: [/content/multilingual/,/tutorials/create-a-multilingual-site/]
|
||||
parent: content-management
|
||||
weight: 230
|
||||
toc: true
|
||||
weight: 230
|
||||
aliases: [/content/multilingual/,/tutorials/create-a-multilingual-site/]
|
||||
---
|
||||
|
||||
You should define the available languages in a `languages` section in your site configuration.
|
||||
@@ -59,7 +56,7 @@ weight = 3
|
||||
|
||||
Anything not defined in a `languages` block will fall back to the global value for that key (e.g., `copyright` for the English `en` language). This also works for `params`, as demonstrated with `help` above: You will get the value `Aide` in French and `Help` in all the languages without this parameter set.
|
||||
|
||||
With the configuration above, all content, sitemap, RSS feeds, paginations,
|
||||
With the configuration above, all content, sitemap, RSS feeds, pagination,
|
||||
and taxonomy pages will be rendered below `/` in English (your default content language) and then below `/fr` in French.
|
||||
|
||||
When working with front matter `Params` in [single page templates], omit the `params` in the key for the translation.
|
||||
@@ -229,7 +226,7 @@ If using `url`, remember to include the language part as well: `/fr/compagnie/a-
|
||||
|
||||
### Page Bundles
|
||||
|
||||
To avoid the burden of having to duplicate files, each Page Bundle inherits the resources of its linked translated pages' bundles except for the content files (markdown files, html files etc...).
|
||||
To avoid the burden of having to duplicate files, each Page Bundle inherits the resources of its linked translated pages' bundles except for the content files (Markdown files, HTML files etc...).
|
||||
|
||||
Therefore, from within a template, the page will have access to the files from all linked pages' bundles.
|
||||
|
||||
@@ -507,6 +504,7 @@ The rendering of the main navigation works as usual. `.Site.Menus` will just con
|
||||
```
|
||||
|
||||
### Dynamically localizing menus with i18n
|
||||
|
||||
While customizing menus per language is useful, your config file can become hard to maintain if you have a lot of languages
|
||||
|
||||
If your menus are the same in all languages (ie. if the only thing that changes is the translated name) you can use the `.Identifier` as a translation key for the menu name:
|
||||
@@ -538,7 +536,6 @@ And do the appropriate changes in the menu code to use the `i18n` tag with the `
|
||||
{{- end }}
|
||||
</ul>
|
||||
{{< /code >}}
|
||||
|
||||
|
||||
## Missing Translations
|
||||
|
||||
@@ -570,9 +567,8 @@ If there is more than one language defined, the `LanguagePrefix` variable will e
|
||||
|
||||
|
||||
## Generate multilingual content with `hugo new`
|
||||
Currently, `hugo new` is not ready to support generating multilingual content. But there is a [proposal topic](https://github.com/gohugoio/hugo/issues/7732) about this in Github issue to discuss how it should work.
|
||||
|
||||
|
||||
Currently, `hugo new` is not ready to support generating multilingual content. But there is a [proposal topic](https://github.com/gohugoio/hugo/issues/7732) about this in GitHub issue to discuss how it should work.
|
||||
|
||||
[abslangurl]: /functions/abslangurl
|
||||
[config]: /getting-started/configuration/
|
||||
|
Reference in New Issue
Block a user