lang.Merge

将以下英文翻译为中文:

lang.Merge

https://gohugo.io/functions/lang.merge/

Merge missing translations from other languages.

语法

lang.Merge FROM TO

As an example:

1
{{ $pages := .Site.RegularPages | lang.Merge $frSite.RegularPages | lang.Merge $enSite.RegularPages }}

Will “fill in the gaps” in the current site with, from left to right, content from the French site, and lastly the English.

A more practical example is to fill in the missing translations from the other languages:

1
2
3
4
{{ $pages := .Site.RegularPages }}
{{ range .Site.Home.Translations }}
{{ $pages = $pages | lang.Merge .Site.RegularPages }}
{{ end }}

另请参阅