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" baseURL = "http://example.com"
defaultContentLanguage = "en"
[taxonomies] [taxonomies]
tag = "tags"
group = "groups" 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" title = "About"
linktitle = "About"
url = "/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. 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" title = "Minust"
linktitle = "Minust"
url = "/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. 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" title = "Home"
linktitle = "Home"
url = "/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. 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" title = "Kodu"
linktitle = "Kodu"
url = "/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. 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" title = "Alpha"
lang = "en"
groups = ["news"] groups = ["news"]
+++ +++

View file

@ -1,7 +1,5 @@
+++ +++
title = "Beta" title = "Beta"
lang = "en"
groups = ["news"] 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" title = "Alfa"
url = "/uudis/alfa"
lang = "et"
groups = ["uudised"] groups = ["uudised"]
+++ +++

View file

@ -1,7 +1,6 @@
+++ +++
title = "Beeta" title = "Beeta"
url = "/uudis/beeta"
lang = "et"
groups = ["uudised"] 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

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

View file

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