examples: Update multilingual example

Use new i18n concept

Fixes #2417
This commit is contained in:
bogem 2016-11-21 16:35:52 +01:00 committed by digitalcraftsman
parent 4c72eb12dc
commit 68ebf61613
25 changed files with 312 additions and 314 deletions

View file

@ -1,6 +1,39 @@
baseURL = "http://example.com"
defaultContentLanguage = "en"
[taxonomies]
tag = "tags"
group = "groups"
menu = "menu"
[languages]
[languages.en]
weight = 0
title = "My multilingual site"
[[languages.en.menu.main]]
url = "/home"
name = "Home"
weight = 0
[[languages.en.menu.main]]
url = "/news"
name = "News"
weight = 1
[[languages.en.menu.main]]
url = "/about"
name = "About"
weight = 2
[languages.et]
weight = 1
title = "Minu mitmekeelne leht"
[[languages.et.menu.main]]
url = "/kodu"
name = "Kodu"
weight = 0
[[languages.et.menu.main]]
url = "/uudised"
name = "Uudised"
weight = 1
[[languages.et.menu.main]]
url = "/minust"
name = "Minust"
weight = 2

View file

@ -1,11 +1,6 @@
+++
title = "About"
linktitle = "About"
url = "/about"
lang = "en"
menu = ["en"]
menu_weight = 30
+++
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Illum ex deleniti ut tenetur amet accusantium dolores nam provident! Ipsum, dicta voluptatum quas architecto nostrum sapiente eos commodi numquam accusantium reprehenderit.

View file

@ -1,11 +1,6 @@
+++
title = "Minust"
linktitle = "Minust"
url = "/minust"
lang = "et"
menu = ["et"]
menu_weight = 30
+++
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Illum ex deleniti ut tenetur amet accusantium dolores nam provident! Ipsum, dicta voluptatum quas architecto nostrum sapiente eos commodi numquam accusantium reprehenderit.

View file

@ -1,11 +1,6 @@
+++
title = "Home"
linktitle = "Home"
url = "/home"
lang = "en"
menu = ["en"]
menu_weight = 0
+++
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Illum ex deleniti ut tenetur amet accusantium dolores nam provident! Ipsum, dicta voluptatum quas architecto nostrum sapiente eos commodi numquam accusantium reprehenderit.

View file

@ -1,11 +1,6 @@
+++
title = "Kodu"
linktitle = "Kodu"
url = "/kodu"
lang = "et"
menu = ["et"]
menu_weight = 0
+++
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Illum ex deleniti ut tenetur amet accusantium dolores nam provident! Ipsum, dicta voluptatum quas architecto nostrum sapiente eos commodi numquam accusantium reprehenderit.

View file

@ -1,7 +1,5 @@
+++
title = "Alpha"
lang = "en"
groups = ["news"]
+++

View file

@ -1,7 +1,5 @@
+++
title = "Beta"
lang = "en"
groups = ["news"]
+++

View file

@ -0,0 +1,5 @@
+++
title = "News"
url = "/news"
listing = true
+++

View file

@ -1,10 +0,0 @@
+++
title = "News"
linktitle = "News"
url = "/news"
listing = true
lang = "en"
menu = ["en"]
menu_weight = 10
+++

View file

@ -1,7 +1,6 @@
+++
title = "Alfa"
lang = "et"
url = "/uudis/alfa"
groups = ["uudised"]
+++

View file

@ -1,7 +1,6 @@
+++
title = "Beeta"
lang = "et"
url = "/uudis/beeta"
groups = ["uudised"]
+++

View file

@ -0,0 +1,5 @@
+++
title = "Uudised"
url = "/uudised"
listing = true
+++

View file

@ -1,10 +0,0 @@
+++
title = "Uudised"
linktitle = "Uudised"
url = "/uudised"
listing = true
lang = "et"
menu = ["et"]
menu_weight = 10
+++

View file

@ -1,2 +0,0 @@
head_title: Multilingual
title: My multilingual site

View file

@ -1,2 +0,0 @@
head_title: Mitmekeelne
title: Minu mitmekeelne leht

View file

@ -0,0 +1,3 @@
- id: head_title
translation: "Multilingual"

View file

@ -0,0 +1,2 @@
- id: head_title
translation: "Mitmekeelne"

View file

@ -1,3 +1,3 @@
<footer id="footer"><span class="copy-left">&copy;</span> 2015 Egon Elbre</footer>
<footer id="footer"><span class="copy-left">&copy;</span> 2015 Egon Elbre</footer>
</body>
</html>

View file

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
{{ if .Title }}
<title>{{ (index .Site.Data.translations .Params.lang).head_title }} - {{ .Title }}</title>
<title>{{ i18n "head_title" }} - {{ .Title }}</title>
{{ end }}
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/main.css">

View file

@ -4,11 +4,11 @@
<a href="/kodu">Eesti</a>
</nav>
<h1 id="title">{{ (index .Site.Data.translations .Params.lang).title }}</h1>
<h1 id="title">{{ .Site.Title }}</h1>
<nav id="main-menu">
{{ range (index .Site.Taxonomies.menu .Params.lang).Pages }}
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
{{ range .Site.Menus.main }}
<a href="{{ .URL }}">{{ .Name }}</a>
{{ end }}
<div class="clear"></div>
</nav>