Debian Codegraph @

docs/content/en/functions/lang/Merge.md

raw
1 ---
2 title: lang.Merge
3 description: Returns a copy of the given page collection with missing translations filled in from another page collection.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 aliases: []
9 returnType: any
10 signatures: [lang.Merge FROM TO]
11 aliases: [/functions/lang.merge]
12 ---
13
14 As an example:
15
16 ```sh
17 {{ $pages := .Site.RegularPages | lang.Merge $frSite.RegularPages | lang.Merge $enSite.RegularPages }}
18 ```
19
20 Will "fill in the gaps" in the current site with, from left to right, content from the French site, and lastly the English.
21
22 A more practical example is to fill in the missing translations from the other languages:
23
24 ```sh
25 {{ $pages := .Site.RegularPages }}
26 {{ range .Site.Home.Translations }}
27 {{ $pages = $pages | lang.Merge .Site.RegularPages }}
28 {{ end }}
29 ```