Fix #1: add i18n for en/ru

This commit is contained in:
Dmitry Kolosov 2020-01-26 19:09:07 +03:00
parent 0f60a781eb
commit 63e411c12f
9 changed files with 73 additions and 13 deletions

View File

@ -28,7 +28,6 @@ Example:
languageCode: "en-us"
baseUrl = ""
title: "Anubis"
author: ""
theme: "anubis"
paginate: 10
disqusShortname: yourdiscussshortname
@ -43,6 +42,7 @@ menu:
weight: 0
params:
author: ""
description: ""
images:
- images/og-featured.png

29
i18n/en.yaml Normal file
View File

@ -0,0 +1,29 @@
powered:
other: "powered by"
theme:
other: "theme"
readMore:
other: "read more"
toNewPosts:
other: "to new posts"
toOldPosts:
other: "to old posts"
tag:
other: "tag"
Tags:
other: "tags"
Posts:
other: "Posts"
Categories:
other: "Categories"
toAllTags:
other: "To all tags"

29
i18n/ru.yaml Normal file
View File

@ -0,0 +1,29 @@
powered:
other: "движок"
theme:
other: "тема"
readMore:
other: "читать дальше"
toNewPosts:
other: "к новым записям"
toOldPosts:
other: "к старым записям"
tag:
other: "Тег"
Tags:
other: "Теги"
Posts:
other: "Записи"
Categories:
other: "Категории"
toAllTags:
other: "Ко списку всех тегов"

View File

@ -1,6 +1,6 @@
{{ define "main" }}
<h1>{{ .Title }}</h1>
<h1>{{ i18n .Title }}</h1>
{{ range (.Site.RegularPages.GroupByPublishDate "2006") }}
{{ range .Pages }}
<div class="post-short-list">

View File

@ -1,6 +1,6 @@
{{ define "main" }}
<h1>{{ .Title }}</h1>
<h1>{{ i18n .Title }}</h1>
<ul class="terms">
{{ range $key, $value := .Data.Terms }}

View File

@ -22,7 +22,7 @@
</div>
{{ .Summary }}
<div class="read-more">
<a href="{{ .RelPermalink }}">Читать дальше</a>
<a href="{{ .RelPermalink }}">{{ i18n "readMore" | humanize }}</a>
</div>
</article>

View File

@ -1,3 +1,3 @@
<p>© Дмитрий Колосов, 2020<br>
Движок <a target="_blank" href="https://gohugo.io/">Hugo</a>, тема <a target="_blank" href="https://github.com/mitrichius/hugo-theme-anubis">Anubis</a>.
<p>© {{ if isset .Site.Params "author"}}{{ .Site.Params.author }}, {{end}}2020<br>
{{ i18n "powered" | humanize }} <a target="_blank" href="https://gohugo.io/">Hugo</a>, {{ i18n "theme" }} <a target="_blank" href="https://github.com/mitrichius/hugo-theme-anubis">Anubis</a>.
</p>

View File

@ -1,21 +1,23 @@
{{ if or ( .Paginator.HasPrev ) ( .Paginator.HasNext ) }}
{{ $toNewPostsMessage := i18n "toNewPosts" | humanize }}
{{ $toOldPostsMessage := i18n "toOldPosts" | humanize }}
<div class="pagination">
<div class="left">
{{ if .Paginator.HasPrev }}
{{ if eq .Paginator.PageNumber 2 }}
<a class="pagination-item" href="{{ .Site.BaseURL }}{{ .Site.LanguagePrefix }}">К новым постам</a>
<a class="pagination-item" href="{{ .Site.BaseURL }}{{ .Site.LanguagePrefix }}">{{ $toNewPostsMessage }}</a>
{{ else }}
<a class="pagination-item" href="{{ .Paginator.Prev.URL }}">К новым постам</a>
<a class="pagination-item" href="{{ .Paginator.Prev.URL }}">{{ $toNewPostsMessage }}</a>
{{ end }}
{{ else }}
<span class="pagination-item disabled">К новым постам</span>
<span class="pagination-item disabled">{{ $toNewPostsMessage }}</span>
{{ end }}
</div>
<div class="right">
{{ if .Paginator.HasNext }}
<a class="pagination-item" href="{{ .Paginator.Next.URL }}">К старым постам</a>
<a class="pagination-item" href="{{ .Paginator.Next.URL }}">{{ $toOldPostsMessage }}</a>
{{ else }}
<span class="pagination-item disabled">К старым постам</span>
<span class="pagination-item disabled">{{ $toOldPostsMessage }}</span>
{{ end }}
</div>
</div>

View File

@ -1,6 +1,6 @@
{{ define "main" }}
<h1>Tag: {{ .Title }}</h1>
<h1>{{ i18n "tag" | humanize }}: {{ .Title }}</h1>
<div class="article-info">
<a href="/tags/">Ко списку всех тегов</a>
</div>
@ -19,7 +19,7 @@
</div>
{{ .Summary }}
<div class="read-more">
<a href="{{ .RelPermalink }}">Читать дальше</a>
<a href="{{ .RelPermalink }}">{{ i18n "readMore" | humanize }}</a>
</div>
</article>