Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/curttimson/hugo-theme-massively.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Martin Viva <pmviva@gmail.com>2018-04-07 04:55:25 +0300
committerPablo Martin Viva <pmviva@gmail.com>2018-04-07 04:55:25 +0300
commit594291f86d0a17b4c56b8fb572c883ab7e086d15 (patch)
tree8ded0cf2874eb0978d7b686f566ac2be6a5e3211 /layouts
parent07b3944a6f2d038b394c1682567883771daa2b4a (diff)
Multilingual support
Diffstat (limited to 'layouts')
-rw-r--r--layouts/index.html12
-rw-r--r--layouts/partials/copyright.html4
-rw-r--r--layouts/partials/footer/index.html29
-rw-r--r--layouts/partials/header.html2
-rw-r--r--layouts/partials/intro.html7
-rw-r--r--layouts/partials/nav.html14
-rw-r--r--layouts/partials/posts/featured.html3
-rw-r--r--layouts/partials/posts/list.html3
-rw-r--r--layouts/partials/posts/pagination.html6
9 files changed, 45 insertions, 35 deletions
diff --git a/layouts/index.html b/layouts/index.html
index 9585426..822ac8a 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -5,7 +5,7 @@
{{ $firstPost := first 1 $posts }}
- {{ if eq .Site.Params.Posts.featuredpost "true" }}
+ {{ if and (eq .Site.Params.Posts.featuredpost "true") (gt (len $posts) 1) }}
{{ .Scratch.Set "postsForPaging" (after 1 $posts) }}
{{ else }}
{{ .Scratch.Set "postsForPaging" $posts }}
@@ -28,24 +28,24 @@
<div id="main">
{{ if eq .Site.Params.Posts.featuredpost "true" }}
- {{ partial "posts/featured.html" (dict "firstpost" $firstPost) }}
+ {{ partial "posts/featured.html" (dict "firstpost" $firstPost "SiteData" .Site.Data "SiteLanguage" .Site.Language.Lang) }}
{{ end }}
- {{ partial "posts/list.html" (dict "posts" $postsPaging) }}
+ {{ partial "posts/list.html" (dict "posts" $postsPaging "SiteData" .Site.Data "SiteLanguage" .Site.Language.Lang) }}
<!-- Footer -->
{{ if gt $postsPaging.TotalPages 1 }}
<footer>
<div class="pagination">
{{ if $postsPaging.HasPrev }}
- <a href="{{ $postsPaging.Prev.URL | absURL }}" class="previous">Prev</a>
+ <a href="{{ $postsPaging.Prev.URL | absLangURL }}" class="previous"></a>
{{ end }}
{{ range $postsPaging.Pagers }}
{{ if lt .PageNumber 10 }}
- <a href="{{ .URL | absURL }}" class="page{{ if eq .PageNumber $postsPaging.PageNumber }} active{{ end }}">{{ .PageNumber }}</a>
+ <a href="{{ .URL | absLangURL }}" class="page{{ if eq .PageNumber $postsPaging.PageNumber }} active{{ end }}">{{ .PageNumber }}</a>
{{ end }}
{{ end }}
{{ if $postsPaging.HasNext }}
- <a href="{{ $postsPaging.Next.URL | absURL }}" class="next">Next</a>
+ <a href="{{ $postsPaging.Next.URL | absLangURL }}" class="next">{{ i18n "NEXT" . }}</a>
{{ end }}
</div>
</footer>
diff --git a/layouts/partials/copyright.html b/layouts/partials/copyright.html
index 03a85db..33cdc69 100644
--- a/layouts/partials/copyright.html
+++ b/layouts/partials/copyright.html
@@ -1,4 +1,4 @@
<!-- Copyright -->
<div id="copyright">
- <ul><li>&copy; {{ .Site.Title }}</li><li>Design: <a href="https://html5up.net">HTML5 UP</a></li><li>Hugo Port: <a href="https://curtistimson.co.uk">curttimson</a></li></ul>
-</div> \ No newline at end of file
+ <ul><li>&copy; {{ .Site.Title }}</li><li>{{ i18n "COPYRIGHT_MESSAGE_1" . | markdownify }}</li><li>{{ i18n "COPYRIGHT_MESSAGE_2" . | markdownify }}</li></ul>
+</div>
diff --git a/layouts/partials/footer/index.html b/layouts/partials/footer/index.html
index 692162d..52cbfa1 100644
--- a/layouts/partials/footer/index.html
+++ b/layouts/partials/footer/index.html
@@ -1,30 +1,31 @@
<!-- Footer -->
+{{ $data := index .Site.Data .Site.Language.Lang }}
<footer id="footer">
- {{ with .Site.Data.contactinfo.contactformaction }}
+ {{ with $data.contactinfo.contactformaction }}
<section>
<form method="post" action="{{ . }}">
<div class="field">
- <label for="name">Name</label>
+ <label for="name">{{ i18n "CONTACT_FORM_FIELD_NAME" . }}</label>
<input type="text" name="name" id="name" />
</div>
<div class="field">
- <label for="email">Email</label>
+ <label for="email">{{ i18n "CONTACT_FORM_FIELD_EMAIL" . }}</label>
<input type="text" name="email" id="email" />
</div>
<div class="field">
- <label for="message">Message</label>
+ <label for="message">{{ i18n "CONTACT_FORM_FIELD_MESSAGE" . }}</label>
<textarea name="message" id="message" rows="3"></textarea>
</div>
<ul class="actions">
- <li><input type="submit" value="Send Message" /></li>
+ <li><input type="submit" value='{{ i18n "CONTACT_FORM_SUBMIT_SEND_MESSAGE" . }}' /></li>
</ul>
</form>
</section>
{{ end }}
<section class="split contact">
- {{ with .Site.Data.contactinfo.address }}
+ {{ with $data.contactinfo.address }}
<section class="alt">
- <h3>Address</h3>
+ <h3>{{ i18n "CONTACT_ADDRESS" . }}</h3>
<p>
{{ range $i, $e := . }}
{{ if $i }} <br/> {{ end }} {{ .line }}
@@ -32,21 +33,21 @@
</p>
</section>
{{ end }}
- {{ with .Site.Data.contactinfo.phone }}
+ {{ with $data.contactinfo.phone }}
<section>
- <h3>Phone</h3>
+ <h3>{{ i18n "CONTACT_PHONE" . }}</h3>
<p><a href="tel:{{ . }}">{{ . }}</a></p>
</section>
{{ end }}
- {{ with .Site.Data.contactinfo.email }}
+ {{ with $data.contactinfo.email }}
<section>
- <h3>Email</h3>
+ <h3>{{ i18n "CONTACT_EMAIL" . }}</h3>
<p><a href="mailto:{{ . }}">{{ . }}</a></p>
</section>
{{ end }}
- {{ with .Site.Data.social }}
+ {{ with $data.social }}
<section>
- <h3>Social</h3>
+ <h3>{{ i18n "CONTACT_SOCIAL" . }}</h3>
<ul class="icons alt">
{{ with .twitter}}
<li><a href="{{ . }}" class="icon alt fa-twitter"><span class="label">Twitter</span></a></li>
@@ -79,4 +80,4 @@
</section>
{{ end }}
</section>
-</footer> \ No newline at end of file
+</footer>
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index 6933271..7628a7b 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -1,4 +1,4 @@
<!-- Header -->
<header id="header">
- <a href='{{ "/" | absURL }}' class="logo">{{ .Site.Title }}</a>
+ <a href='{{ "/" | absLangURL }}' class="logo">{{ .Site.Title }}</a>
</header>
diff --git a/layouts/partials/intro.html b/layouts/partials/intro.html
index 35ef669..f22fa60 100644
--- a/layouts/partials/intro.html
+++ b/layouts/partials/intro.html
@@ -1,4 +1,5 @@
-{{ with .Site.Data.intro }}
+{{ $data := index .Site.Data .Site.Language.Lang }}
+{{ with $data.intro }}
<div id="intro">
<h1>
{{ range $i, $e := .title }}
@@ -11,7 +12,7 @@
{{ end }}
</p>
<ul class="actions">
- <li><a href="#header" class="button icon solo fa-arrow-down scrolly">Continue</a></li>
+ <li><a href="#header" class="button icon solo fa-arrow-down scrolly">{{ i18n "INTRO_CONTINUE" . }}</a></li>
</ul>
</div>
-{{ end }} \ No newline at end of file
+{{ end }}
diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html
index 3e95003..fbd1301 100644
--- a/layouts/partials/nav.html
+++ b/layouts/partials/nav.html
@@ -1,12 +1,18 @@
<!-- Nav -->
+{{ $data := index .Site.Data .Site.Language.Lang }}
<nav id="nav">
<ul class="links">
- <li class="active"><a href='{{ "/" | absURL }}'>{{ .Site.Title }}</a></li>
- {{ with .Site.Data.contactinfo }}
- <li><a href='{{ "#footer" | absURL }}'>Contact</a></li>
+ <li class="active"><a href='{{ "/" | absLangURL }}'>{{ .Site.Title }}</a></li>
+ {{ with $data.contactinfo }}
+ <li><a href='{{ "#footer" | absLangURL }}'>{{ i18n "NAV_CONTACT" . }}</a></li>
+ {{ end }}
+ {{ if .IsTranslated }}
+ {{ range .AllTranslations }}
+ <li {{if eq ($.Site.Language) (.Language)}}class="active"{{end}}><a href='{{ .Permalink }}'>{{ .Language.LanguageName }}</a></li>
+ {{ end }}
{{ end }}
</ul>
- {{ with .Site.Data.social }}
+ {{ with $data.social }}
<ul class="icons">
{{ with .twitter }}
<li><a href="{{ . }}" class="icon fa-twitter"><span class="label">Twitter</span></a></li>
diff --git a/layouts/partials/posts/featured.html b/layouts/partials/posts/featured.html
index c14a398..949b7a8 100644
--- a/layouts/partials/posts/featured.html
+++ b/layouts/partials/posts/featured.html
@@ -1,4 +1,5 @@
<!-- Featured Post -->
+{{ $data := index .SiteData .SiteLanguage }}
{{ range .firstpost }}
<article class="post featured">
<header class="major">
@@ -12,7 +13,7 @@
<a href="{{ .Permalink }}" class="image main"><img src="{{ .Params.image | absURL }}" alt="" /></a>
{{ end }}
<ul class="actions">
- <li><a href="{{ .Permalink }}" class="button big">{{ .Site.Data.post.linktext }}</a></li>
+ <li><a href="{{ .Permalink }}" class="button big">{{ $data.post.linktext }}</a></li>
</ul>
</article>
{{ end }}
diff --git a/layouts/partials/posts/list.html b/layouts/partials/posts/list.html
index 49a0745..e2c71e2 100644
--- a/layouts/partials/posts/list.html
+++ b/layouts/partials/posts/list.html
@@ -1,4 +1,5 @@
<!-- Posts -->
+{{ $data := index .SiteData .SiteLanguage }}
<section class="posts">
{{ range .posts.Pages }}
<article>
@@ -13,7 +14,7 @@
{{ end }}
<p>{{ .Description }}</p>
<ul class="actions">
- <li><a href="{{ .Permalink }}" class="button">{{ .Site.Data.post.linktext }}</a></li>
+ <li><a href="{{ .Permalink }}" class="button">{{ $data.post.linktext }}</a></li>
</ul>
</article>
{{ end }}
diff --git a/layouts/partials/posts/pagination.html b/layouts/partials/posts/pagination.html
index 559b068..b43965e 100644
--- a/layouts/partials/posts/pagination.html
+++ b/layouts/partials/posts/pagination.html
@@ -3,15 +3,15 @@
<footer>
<div class="pagination">
{{ if .paging.HasPrev }}
- <a href="{{ .paging.Prev.URL | absURL }}" class="previous">Prev</a>
+ <a href="{{ .paging.Prev.URL | absLangURL }}" class="previous">{{ i18n "PAGINATION_PREVIOUS" . }}</a>
{{ end }}
{{ range .paging.Pagers }}
{{ if lt .PageNumber 10 }}
- <a href="{{ .URL | absURL }}" class="page{{ if eq .PageNumber .paging.PageNumber }} active{{ end }}">{{ .PageNumber }}</a>
+ <a href="{{ .URL | absLangURL }}" class="page{{ if eq .PageNumber .paging.PageNumber }} active{{ end }}">{{ .PageNumber }}</a>
{{ end }}
{{ end }}
{{ if .paging.HasNext }}
- <a href="{{ .paging.Next.URL | absURL }}" class="next">Next</a>
+ <a href="{{ .paging.Next.URL | absLangURL }}" class="next">{{ i18n "PAGINATION_NEXT" . }}</a>
{{ end }}
</div>
</footer>