Support multilingual mode (experimental)

Please report any bugs!
This commit is contained in:
BBaoVanC 2021-10-11 18:24:14 -05:00
parent 03834fb1ba
commit c7cfb9c844
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A
12 changed files with 88 additions and 14 deletions

12
data/meses.toml Normal file
View File

@ -0,0 +1,12 @@
1 = "enero"
2 = "febrero"
3 = "marzo"
4 = "abril"
5 = "mayo"
6 = "julio"
7 = "junio"
8 = "agosto"
9 = "septiembre"
10 = "octubre"
11 = "noviembre"
12 = "diciembre"

31
i18n/en.toml Normal file
View File

@ -0,0 +1,31 @@
[credit_comment]
other = "<!-- bobatheme is available under the MIT license at https://github.com/BBaoVanC/bobatheme. -->"
[long_date]
other = "{{ .Date.Format `January 2, 2006` }}"
[wordcount]
one = "{{ . }} word"
other = "{{ . }} words"
[readingtime]
one = "{{ . }} min"
other = "{{ . }} mins"
[read_more]
other = "Read more"
[browser_no_video_support]
other = "Your browser does not support video."
[filtering_for]
other = "Filtering for \"{{ . }}\""
[no_posts]
other = "No posts here!"
[table_of_contents]
other = "Table of Contents"

31
i18n/es.toml Normal file
View File

@ -0,0 +1,31 @@
[credit_comment]
other = "<!-- bobatheme está en GitHub con la licencia MIT a https://github.com/BBaoVanC/bobatheme. -->"
[long_date]
other = "{{ .Date.Day }} de {{ index .Data.meses (printf `%d` .Date.Month) }} de {{ .Date.Year }}"
[wordcount]
one = "{{ . }} palabra"
other = "{{ . }} palabras"
[readingtime]
one = "{{ . }} min"
other = "{{ . }} mins"
[read_more]
other = "Leer más"
[browser_no_video_support]
other = "Tu navegador de internet no admite video."
[filtering_for]
other = "Filtrando por \"{{ . }}\""
[no_posts]
other = "¡No páginas aquí!"
[table_of_contents]
other = "Índice"

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>