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

github.com/vickylaixy/hugo-theme-introduction.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanzei <hanzei@mailbox.org>2018-06-27 03:10:46 +0300
committerHanzei <hanzei@mailbox.org>2018-06-27 03:31:18 +0300
commit389a69a6e71228b536af28776156fda30d22e217 (patch)
tree8ddc2bca6c5abbd5d3e40f8383e46de8a8ad028b /layouts
parentc555b2b52c149aa8bd083b670583e4b3bb963f10 (diff)
Add Multilingual support
Diffstat (limited to 'layouts')
-rw-r--r--layouts/404.html6
-rw-r--r--layouts/blog/list.html32
-rw-r--r--layouts/blog/single.html6
-rw-r--r--layouts/index.html6
-rw-r--r--layouts/partials/blogsection.html10
-rw-r--r--layouts/partials/footer.html4
-rw-r--r--layouts/partials/nav.html16
-rw-r--r--layouts/partials/projects.html2
8 files changed, 46 insertions, 36 deletions
diff --git a/layouts/404.html b/layouts/404.html
index d161297..c70b17e 100644
--- a/layouts/404.html
+++ b/layouts/404.html
@@ -4,7 +4,9 @@
<div class="section" id="top">
<!-- Begin Title -->
<div class="container hero is-medium has-text-centered {{ if .Site.Params.fadeIn }} fade-in one {{ end }}">
- <h1 class="bold-title is-1">404</h1>
+ <h1 class="bold-title is-1">
+ {{ i18n "404_title" . }}
+ </h1>
</div>
<!-- End Title -->
<!-- Everything below fades in two! -->
@@ -12,7 +14,7 @@
{{ partial "nav.html" . }}
<!-- Begin blurb -->
<div class="container {{ if .Site.Params.fadeIn }} fade-in two {{ end }} top-pad">
- Oops! Either you've found a bug (in which case, <a href="mailto:{{ .Site.Params.email }}">please tell me</a>) or you're just making things up. This page doesn't exist!
+ {{ i18n "404_description" . | markdownify }}
</div>
<!-- End blurb -->
<div class="container top-pad">
diff --git a/layouts/blog/list.html b/layouts/blog/list.html
index faade24..876975b 100644
--- a/layouts/blog/list.html
+++ b/layouts/blog/list.html
@@ -17,24 +17,24 @@
<!-- Begin Blog container -->
<div class="container">
{{ if .Site.Params.showLatest }}
- <h2 class="title is-2 top-pad">Latest Post</h2>
- {{ range first 1 (where .Data.Pages.ByPublishDate.Reverse "Section" "blog") }}
- <div class="summary">{{ .Date.Format (.Site.Params.dateForm | default "Jan 02, 2006") }}
- <h3 class="title is-3 strong-post-title">
- <a href="{{ .RelPermalink }}">
- {{ .Title }}
- </a>
- </h3>
- <div class="markdown">
- {{ .Summary }}
- {{ if .Truncated }}
- <a href="{{ .RelPermalink }}">...Read More</a>
- {{ end }}
- </div>
+ <h2 class="title is-2 top-pad">{{ i18n "index_blog_latestPosts" . }}</h2>
+ {{ range first 1 (where .Data.Pages.ByPublishDate.Reverse "Section" "blog") }}
+ <div class="summary">{{ .Date.Format (.Site.Params.dateForm | default "Jan 02, 2006") }}
+ <h3 class="title is-3 strong-post-title">
+ <a href="{{ .RelPermalink }}">
+ {{ .Title }}
+ </a>
+ </h3>
+ <div class="markdown">
+ {{ .Summary }}
+ {{ if .Truncated }}
+ <a href="{{ .RelPermalink }}">{{ i18n "index_blog_readMore" . }}</a>
+ {{ end }}
</div>
- {{ end }}
+ </div>
+ {{ end }}
{{ end }}
- <h2 class="title is-2 top-pad">All Posts</h2>
+ <h2 class="title is-2 top-pad">{{ i18n "index_blog_allPosts" . }}</h2>
<ul>
{{ range .Data.Pages.ByPublishDate }}
{{ if eq .Section "blog" }}
diff --git a/layouts/blog/single.html b/layouts/blog/single.html
index 8b1c47d..6a24536 100644
--- a/layouts/blog/single.html
+++ b/layouts/blog/single.html
@@ -4,7 +4,7 @@
<div class="section" id="top">
<!-- Begin Title -->
<div class="container hero {{ if .Site.Params.fadeIn | default true }}fade-in one{{ end }}">
- <h1 class="bold-title is-1">{{ (.Site.GetPage "section" "blog") .Title }}</h1>
+ <h1 class="bold-title is-1">{{ (.Site.GetPage "section" "blog").Title }}</h1>
</div>
<!-- End Title -->
<!-- Everything below fades in two! -->
@@ -17,11 +17,11 @@
</h2>
<div class="post-data">
{{ .Date.Format (.Site.Params.dateForm | default "Jan 02, 2006") }} |
- {{ if eq 1 .ReadingTime }}{{ .ReadingTime }} minute read{{ else }}{{ .ReadingTime }} minutes read{{ end }}
+ {{ i18n "blog_readingTime" .ReadingTime }}
</div>
{{ if .Site.Params.shareButtons }}
<div class="blog-share">
- Share this:
+ {{ i18n "blog_shareThis" . }}:
{{ if .Site.Params.shareTwitter }}
<a class="twitter-share-button" href="https://twitter.com/intent/tweet?text=Read%20{{ .Title }}%20{{ .Permalink }}" onclick="window.open(this.href, 'twitter-share', 'width=550,height=235');return false;">
<i class="fa fa-twitter"></i>
diff --git a/layouts/index.html b/layouts/index.html
index 92e452b..9af0899 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -10,7 +10,7 @@
<div class="container has-text-centered">
<!-- Title and tagline -->
<h1 class="bold-title {{ if .Site.Params.fadeIn | default true }}fade-in one{{ end }}">
- Hi, I'm {{ .Site.Params.firstName | default "Introduction" }}.
+ {{ .Site.Params.firstName | default "Introduction" }}.
</h1>
<h3 class="subtitle is-3 {{ if .Site.Params.fadeIn | default true }}fade-in two{{ end }}">
{{ .Site.Params.tagLine }}
@@ -42,7 +42,7 @@
<div class="columns"><!-- Avatar and about.md side by side except mobile -->
{{ if .Site.Params.avatar }}
<div class="column is-one-third has-text-centered">
- <img class="img-responsive avatar" src="{{ .Site.Params.avatar | relURL }}" alt="My profile picture">
+ <img class="img-responsive avatar" src="{{ .Site.Params.avatar | relURL }}" alt="{{ i18n "index_avatarAlt" . }}">
</div>
{{ end }}
<div class="column markdown">
@@ -74,7 +74,7 @@
</div>
{{ if .Site.Params.localTime }}
- <p>My current local time is <span id="time"></span>.</p>
+ <p>{{ i18n "index_currentTime" . }} <span id='time'></span>.</p>
<script type="text/javascript" src="{{ "/js/moment.js" | relURL }}"></script>
<script type="text/javascript" src="{{ "/js/moment-timezone.js" | relURL }}"></script>
<script type="text/javascript" src="{{ "/js/moment-timezone-with-data-2012-2022.js" | relURL }}"></script>
diff --git a/layouts/partials/blogsection.html b/layouts/partials/blogsection.html
index 5da9c6e..eddf08d 100644
--- a/layouts/partials/blogsection.html
+++ b/layouts/partials/blogsection.html
@@ -3,28 +3,30 @@
<!-- Begin Blog container -->
<div class="container">
{{ if .Site.Params.showLatest }}
- <h2 class="title is-2 has-text-centered">Latest Post</h2>
+ <h2 class="title is-2 has-text-centered">{{ i18n "index_blog_latestPosts" . }}</h2>
{{ range first 1 (where .Data.Pages.ByPublishDate.Reverse "Section" "blog") }}
<div class="summary">{{ .Date.Format (.Site.Params.dateForm | default "Jan 02, 2006") }}
<h3 class="title is-3 latest-post-title"><a href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
<div class="markdown">
{{ .Summary }}
{{ if .Truncated }}
- <a href="{{ .RelPermalink }}">...Read More</a>
+ <a href="{{ .RelPermalink }}">{{ i18n "index_blog_readMore" . }}</a>
{{ end }}
</div>
</div>
{{ end }}
{{ end }}
{{ if .Site.Params.showAllPosts }}
- <h2 class="title is-2 has-text-centered top-pad">All Posts</h2>
+ <h2 class="title is-2 has-text-centered top-pad">{{ i18n "index_blog_allPosts" . }}</h2>
<ul>
{{ range .Pages }}
{{ partial "li.html" . }}
{{ end }}
</ul>
{{ else }}
- <div class="container has-text-centered top-pad"><a href={{ "/blog" | relURL }}>ALL BLOG POSTS</a></div>
+ <div class="container has-text-centered top-pad">
+ <a href="{{ .RelPermalink }}">{{ i18n "index_blog_allPosts" . }}</a>
+ </div>
{{ end }}
</div>
<!-- End Blog container -->
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 808a48e..1668009 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -5,7 +5,9 @@
{{ with .Site.Params.footerText }}
{{ . | markdownify }}
{{ else }}
- <span class="footer-text"><a href="https://github.com/vickylai/hugo-theme-introduction" target="_blank" rel="noopener">Introduction</a> theme for <a href="http://gohugo.io/" target="_blank" rel="noopener">Hugo</a>. Made with <a href="https://vickylai.com" target="_blank" rel="noopener"><i class="fa fa-heart"></i> and <i class="fa fa-coffee"></i></a> by open source contributors.</span>
+ <span class="footer-text">
+ {{ i18n "footer_text" . | markdownify }}
+ </span>
{{ end }}
</div>
<!-- End Footer container -->
diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html
index 513f5f6..f3f8483 100644
--- a/layouts/partials/nav.html
+++ b/layouts/partials/nav.html
@@ -12,11 +12,11 @@
<div id="nav-menu" class="nav-left nav-menu">
{{ end }}
{{ if not $isHome }}
- <a class="nav-item" href="{{ "/" | relURL }}">Main</a>
+ <a class="nav-item" href="{{ "/" | relLangURL }}">{{ i18n "nav_main" . }}</a>
{{ end }}
{{ with .Site.GetPage "page" "about" }}
- <a class="nav-item" href="{{ if $isHome }}#about{{ else }}{{ "/#about" | relURL }}{{ end }}">{{ .Title }}</a>
+ <a class="nav-item" href="{{ if $isHome }}#about{{ else }}{{ "/#about" | relLangURL }}{{ end }}">{{ .Title }}</a>
{{ end }}
{{ $pageIsInProjects := eq .Page.Section "projects"}}
@@ -25,9 +25,9 @@
{{ if $isHome }}
<a class="nav-item" href="#projects">{{ .Title }}</a>
{{ else }}
- <a class="nav-item" href="{{ "/projects" | relURL }}">
+ <a class="nav-item" href="{{ .RelPermalink }}">
{{ if $pageIsInProjects }}
- Back to {{ .Title }}
+ {{ i18n "nav_backToSection" . }}
{{ else }}
{{ .Title }}
{{ end }}
@@ -42,7 +42,7 @@
{{ if $isHome }}
<a class="nav-item" href="#blog">{{ .Title }}</a>
{{ else }}
- <a class="nav-item" href="{{ "/blog" | relURL }}">
+ <a class="nav-item" href="{{ .RelPermalink }}">
{{ if $pageIsInBlog }}
Back to {{ .Title | singularize}}
{{ else }}
@@ -54,7 +54,11 @@
{{ end }}
{{ with .Site.GetPage "page" "contact" }}
- <a class="nav-item" href="{{ if $isHome }}#contact{{ else }}{{ "/#contact" | relURL }}{{ end }}">{{ .Title }}</a>
+ <a class="nav-item" href="{{ if $isHome }}#contact{{ else }}{{ "/#contact" | relLangURL }}{{ end }}">{{ .Title }}</a>
+ {{ end }}
+
+ {{ range $.Site.Home.AllTranslations.ByWeight }}
+ <a class="nav-item" href="{{ .Permalink }}">{{ .Language.LanguageName }}</a>
{{ end }}
{{ if and .Site.Params.showRSSButton .Site.RSSLink }}
diff --git a/layouts/partials/projects.html b/layouts/partials/projects.html
index 564ddd8..63c42e9 100644
--- a/layouts/partials/projects.html
+++ b/layouts/partials/projects.html
@@ -38,7 +38,7 @@
</div>
{{ if lt $numberOfProjectsToShow $totalProjects }}
<div class="container has-text-centered top-pad">
- <a href="{{ "/projects" | relURL }}">ALL PROJECTS</a>
+ <a href="{{ .RelPermalink }}">{{ i18n "index_projects_allProjects" . }}</a>
</div>
{{ end }}
</div>