diff options
author | Richard Metzler <richard.metzler@me.com> | 2016-06-11 11:56:10 +0200 |
---|---|---|
committer | digitalcraftsman <digitalcraftsman@protonmail.com> | 2016-07-29 20:21:52 +0200 |
commit | 5b40eeede1be8534a39a66613eb574bbe3d5852c (patch) | |
tree | baa33e0969af88b006b0833133dfdc0f3ada0737 /examples/multilingual | |
parent | 04889a5ee6247060cef4bde133a013ce7d4e3b61 (diff) |
examples: Add example for translation files
Diffstat (limited to 'examples/multilingual')
4 files changed, 7 insertions, 11 deletions
diff --git a/examples/multilingual/data/translations/en.yaml b/examples/multilingual/data/translations/en.yaml new file mode 100644 index 000000000..beec1ecd7 --- /dev/null +++ b/examples/multilingual/data/translations/en.yaml @@ -0,0 +1,2 @@ +head_title: Multilingual +title: My multilingual site diff --git a/examples/multilingual/data/translations/et.yaml b/examples/multilingual/data/translations/et.yaml new file mode 100644 index 000000000..02bc7cae6 --- /dev/null +++ b/examples/multilingual/data/translations/et.yaml @@ -0,0 +1,2 @@ +head_title: Mitmekeelne +title: Minu mitmekeelne leht diff --git a/examples/multilingual/layouts/partials/head.html b/examples/multilingual/layouts/partials/head.html index 19f4810e1..fee14e72c 100644 --- a/examples/multilingual/layouts/partials/head.html +++ b/examples/multilingual/layouts/partials/head.html @@ -3,13 +3,9 @@ <head>
<meta charset="utf-8">
{{ if .Title }}
- {{ if (eq .Params.lang "et") }}
- <title>Mitmekeelne - {{ .Title }}</title>
- {{ else }}
- <title>Multilingual - {{ .Title }}</title>
- {{ end }}
+ <title>{{ (index .Site.Data.translations .Params.lang).head_title }} - {{ .Title }}</title>
{{ end }}
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/main.css">
</head>
-<body>
\ No newline at end of file +<body>
diff --git a/examples/multilingual/layouts/partials/header.html b/examples/multilingual/layouts/partials/header.html index e5209f5df..f08c3523c 100644 --- a/examples/multilingual/layouts/partials/header.html +++ b/examples/multilingual/layouts/partials/header.html @@ -4,11 +4,7 @@ <a href="/kodu">Eesti</a>
</nav>
- {{ if (eq .Params.lang "et") }}
- <h1 id="title">Minu mitmekeelne leht</h1>
- {{ else }}
- <h1 id="title">My multilingual site</h1>
- {{ end }}
+ <h1 id="title">{{ (index .Site.Data.translations .Params.lang).title }}</h1>
<nav id="main-menu">
{{ range (index .Site.Taxonomies.menu .Params.lang).Pages }}
|