Use localization files in templates.

This commit is contained in:
Danila Fedorin 2020-08-12 17:41:47 -07:00
parent b0e501f086
commit bda78fed78
8 changed files with 44 additions and 12 deletions

View File

@ -0,0 +1,32 @@
[Home]
other = "Home"
[About]
other = "About"
[Resume]
other = "Resume"
[Tags]
other = "Tags"
[AllPosts]
other = "All Posts"
[PostedOn]
other = "Posted on {{ .Date.Format \"January 2, 2006\" }}."
[TableOfContents]
other = "Table of Contents"
[ReadingTime]
other = "{{ .WordCount }} words, about {{ .ReadingTime }} minutes to read."
[Note]
other = "note"
[Tagged]
other = "Tagged \"{{ .Title }}\""
[AllTags]
other = "Below is a list of all the tags ever used on this site."

View File

@ -6,14 +6,14 @@
<a class="button" href="{{ $.Site.BaseURL }}/tags/{{ . | urlize }}">{{ . }}</a>
{{ end }}
</p>
<p>Posted on {{ .Date.Format "January 2, 2006" }}.</p>
<p>{{ i18n "PostedOn" . }}</p>
</div>
<div class="post-content">
{{ if not (eq .TableOfContents "<nav id=\"TableOfContents\"></nav>") }}
<div class="table-of-contents">
<div class="wrapper">
<em>Table of Contents</em>
<em>{{ i18n "TableOfContents" }}</em>
{{ .TableOfContents }}
</div>
</div>

View File

@ -3,11 +3,11 @@
</div>
<nav>
<div class="container">
<a href="/">Home</a>
<a href="/about">About</a>
<a href="/">{{ i18n "Home" }}</a>
<a href="/about">{{ i18n "About" }}</a>
<a href="https://github.com/DanilaFe">GitHub</a>
<a href="/Resume-Danila-Fedorin.pdf">Resume</a>
<a href="/tags">Tags</a>
<a href="/blog">All Posts</a>
<a href="/Resume-Danila-Fedorin.pdf">{{ i18n "Resume" }}</a>
<a href="/tags">{{ i18n "Tags" }}</a>
<a href="/blog">{{ i18n "AllPosts" }}</a>
</div>
</nav>

View File

@ -1,5 +1,5 @@
<li>
<a href="{{ .Permalink }}" class="post-title">{{ .Title }}</a>
<p class="post-wordcount">{{ .WordCount }} words, about {{ .ReadingTime }} minutes to read.</p>
<p class="post-wordcount">{{ i18n "ReadingTime" . }}</p>
<p class="post-preview">{{ .Summary }} . . .</p>
</li>

View File

@ -4,7 +4,7 @@
<label class="sidenote-label" for="numbernote-{{ $id }}">({{ $id }})</label>
<input class="sidenote-checkbox" type="checkbox" id="numbernote-{{ $id }}"></input>
<span class="sidenote-content sidenote-{{ .Get 0 }}">
<span class="sidenote-delimiter">[note:</span>
<span class="sidenote-delimiter">[{{ i18n "note" }}:</span>
{{ .Inner }}
<span class="sidenote-delimiter">]</span>
</span>

View File

@ -2,7 +2,7 @@
<label class="sidenote-label" for="{{ .Get 1 }}">{{ .Get 2 }}</label>
<input class="sidenote-checkbox" type="checkbox" id="{{ .Get 1 }}"></input>
<span class="sidenote-content sidenote-{{ .Get 0 }}">
<span class="sidenote-delimiter">[note:</span>
<span class="sidenote-delimiter">[{{ i18n "Note" }}:</span>
{{ .Inner }}
<span class="sidenote-delimiter">]</span>
</span>

View File

@ -1,5 +1,5 @@
{{ define "main" }}
<h2>Tagged "{{ .Title }}"</h2>
<h2>{{ i18n "Tagged" . }}</h2>
<ul class="post-list">
{{ range .Pages.ByDate.Reverse }}

View File

@ -1,6 +1,6 @@
{{ define "main" }}
<h2>{{ .Title }}</h2>
Below is a list of all the tags ever used on this site.
{{ i18n "AllTags" }}
<ul>
{{ range sort .Pages "Title" }}