Support multilingual mode (experimental)

Please report any bugs!
This commit is contained in:
2021-10-11 18:24:14 -05:00
parent 03834fb1ba
commit c7cfb9c844
12 changed files with 88 additions and 14 deletions

View File

@ -1,6 +1,6 @@
{{ partialCached "credit.html" . }}
<!DOCTYPE html>
<html lang="en">
<html lang="{{ .Language.Lang }}">
{{- partial "head.html" . -}}
<body>

View File

@ -2,7 +2,7 @@
{{ if or (eq .Kind "term") (eq .Kind "taxonomy") }}
<h1>
{{ partialCached "icon.html" "filter" "filter" }}
Filtering for "{{ .Title }}"
{{ i18n "filtering_for" .Title }}
{{ if eq .Kind "term" }}
<span class="rss-link">
{{ with .OutputFormats.Get "rss" }}
@ -37,7 +37,7 @@
{{ .Render "summary" }}
{{ else }}
<div>
No posts here!
{{ i18n "no_posts" }}
</div>
{{ end }}

View File

@ -10,7 +10,7 @@
{{ if .Params.Toc }}
<div id="table-of-contents">
<h2>Table of Contents</h2>
<h2>{{ i18n "table_of_contents" }}</h2>
{{ .TableOfContents }}
</div>
{{ end }}

View File

@ -32,6 +32,6 @@
</div>
<div class="readmore">
<a href="{{ .Permalink }}">Read more &rarr;</a>
<a href="{{ .Permalink }}">{{ i18n "read_more" }} &rarr;</a>
</div>
</div>

View File

@ -1 +1 @@
{{ "<!-- bobatheme is available under the MIT license at https://github.com/BBaoVanC/bobatheme. -->" | safeHTML }}
{{ i18n "credit_comment" | safeHTML }}

View File

@ -4,7 +4,7 @@
<span class="post-meta-item">
{{ partialCached "icon.html" "calendar" "calendar" }}
<time datetime="{{ .Date.Format "January 2, 2006" }}" pubdate>
{{ .Date.Format "January 2, 2006" }}
{{ i18n "long_date" (dict "Date" .Date "Data" .Site.Data) }}
</time>
</span>
@ -13,7 +13,7 @@
<span class="post-meta-item">
{{ partialCached "icon.html" "edit-2" "edit-2" }}
<time datetime="{{ .Lastmod.Format "2006-01-02" }}" pubdate>
{{ .Lastmod.Format "January 2, 2006" }}
{{ i18n "long_date" (dict "Date" .Lastmod "Data" .Site.Data) }}
</time>
{{ end }}
</span>
@ -23,14 +23,14 @@
{{ if .Site.Params.wordcount }}
<span class="post-meta-item">
{{ partialCached "icon.html" "type" "type" }}
{{ .WordCount }} words
{{ i18n "wordcount" .WordCount }}
</span>
{{ end }}
{{ if .Site.Params.readingtime }}
<span class="post-meta-item">
{{ partialCached "icon.html" "clock" "clock" }}
{{ .ReadingTime }} {{ if gt .ReadingTime 1 }} mins {{ else }} min {{ end }}
{{ i18n "readingtime" .ReadingTime }}
</span>
{{ end }}
@ -38,7 +38,7 @@
{{ with .GitInfo }}
<span class="post-meta-item">
{{ partialCached "icon.html" "git-commit" "git-commit" }}
<a href="{{ (printf "%s/commit/%s" $.Site.Params.repoURL .Hash) | absURL }}">
<a href="{{ (printf "%s/commit/%s" $.Site.Params.repoURL .Hash) | absLangURL }}">
<code>{{ .AbbreviatedHash }}</code>
</a>
</span>

View File

@ -3,7 +3,7 @@
</h2>
<nav id="navbar">
<a class="navbar-item" href="{{ "/" | relURL }}">Home</a>
<a class="navbar-item" href="{{ "/" | relLangURL }}">Home</a>
{{ range .Site.Menus.main }}
<a class="navbar-item" href="{{ .URL }}">{{ .Name }}</a>
{{ end }}

View File

@ -1,2 +1,2 @@
User-Agent: *
Sitemap: {{ "sitemap.xml" | absURL }}
Sitemap: {{ "sitemap.xml" | absLangURL }}

View File

@ -1,4 +1,4 @@
<video controls>
<source src="{{ .Get "src" }}" alt="{{ .Get "title" }}">
Your browser does not support video.
{{ i18n "browser_no_video_support" }}
</video>