Add i18n support

This commit is contained in:
James Panther
2021-08-17 16:48:08 +10:00
parent 18ed642ae4
commit 64dd424b80
18 changed files with 66 additions and 22 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
{{ define "main" }}
<h1 class="mb-3 text-4xl font-extrabold">Page Not Found 🤷‍♂️</h1>
<p class="mt-8 mb-12 text-gray-400 dark:text-gray-500">Error 404</p>
<h1 class="mb-3 text-4xl font-extrabold">{{ i18n "error.404_title" | emojify }}</h1>
<p class="mt-8 mb-12 text-gray-400 dark:text-gray-500">{{ i18n "error.404_error" | emojify }}</p>
<div class="prose dark:prose-light">
<p>It seems that the page you've requested does not exist.</p>
<p>{{ i18n "error.404_description" | emojify }}</p>
</div>
{{ end }}
+1 -1
View File
@@ -1 +1 @@
<h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }} {{ if .Page.Params.showHeadingAnchors | default (.Page.Site.Params.article.showHeadingAnchors | default true) }}<a class="heading-anchor" href="#{{ .Anchor | safeURL }}" aria-label="Anchor">#</a>{{ end }}</h{{ .Level }}>
<h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }} {{ if .Page.Params.showHeadingAnchors | default (.Page.Site.Params.article.showHeadingAnchors | default true) }}<a class="heading-anchor" href="#{{ .Anchor | safeURL }}" aria-label="{{ i18n "article.anchor_label" }}">#</a>{{ end }}</h{{ .Level }}>
+1 -1
View File
@@ -16,7 +16,7 @@
{{ else }}
<section class="mt-10 prose dark:prose-light">
<p class="py-8 border-t">
<em>There's no articles to list here yet.</em>
<em>{{ i18n "list.no_articles" | emojify }}</em>
</p>
</section>
{{ end }}
+1 -1
View File
@@ -8,7 +8,7 @@
<span
class="ml-2 px-1 py-[2px] text-xs font-normal border rounded-md text-primary-700 dark:text-primary-400 border-primary-400 dark:border-primary-600 inline-block align-middle mb-1"
>
Draft
{{ i18n "article.draft" | emojify }}
</span>
{{ end }}
</div>
+1 -1
View File
@@ -7,7 +7,7 @@
{{ end }}
{{ if .Site.Params.homepage.showList | default false }}
<section>
<h2 class="text-2xl font-extrabold">Recent</h2>
<h2 class="text-2xl font-extrabold">{{ i18n "homepage.recent" | emojify }}</h2>
{{ range first 5 (.Paginate (where .Site.RegularPages "Type" "in" .Site.Params.homepage.listSections)).Pages }}
{{ partial "article-link.html" . }}
{{ end }}
+1 -1
View File
@@ -7,7 +7,7 @@
<span
class="text-sm cursor-default"
style="vertical-align: super;"
title="Link to external site"
title="{{ i18n "list.externalurl_title" }}"
>&#8599;</span
>
{{ else }}
+2 -3
View File
@@ -11,8 +11,7 @@
<span class="px-1">&middot;</span>
{{ end }}
{{ if and (.Params.showReadingTime | default (.Site.Params.article.showReadingTime | default true)) (ne .ReadingTime 0) }}
<span title="Reading time">
{{ .ReadingTime }}
min{{ if gt .ReadingTime 1 }}s{{ end }}
<span title="{{ i18n "article.reading_time_title" }}">
{{ i18n "article.reading_time" .ReadingTime | emojify }}
</span>
{{ end }}
+3
View File
@@ -5,6 +5,9 @@
{{ end }}
<div>
{{ with .Site.Author.name }}
<div class="text-[0.6rem] leading-3 text-gray-400 dark:text-gray-500 uppercase">
{{ i18n "author.byline_title" | emojify }}
</div>
<div class="font-semibold leading-6 text-gray-800 dark:text-gray-300">
{{ . }}
</div>
+1 -1
View File
@@ -12,7 +12,7 @@
{{/* Theme attribution */}}
{{ if .Site.Params.attribution | default true }}
<p class="text-xs text-gray-300 dark:text-gray-600">
Powered by
{{ i18n "footer.powered_by" }}
<a class="hover:underline" href="https://gohugo.io/" target="_blank">Hugo</a>
&amp;
<a class="hover:underline" href="https://git.io/hugo-congo" target="_blank">Congo</a>
+1 -1
View File
@@ -6,7 +6,7 @@
<a
class="bg-gray-300 text-gray-700 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-primary-400 dark:hover:text-gray-800 m-1 hover:bg-primary-500 hover:text-white rounded min-w-[2.4rem] inline-block text-center p-1"
href="{{ printf .url $.Permalink $.Title }}"
title="{{ .title }}"
title="{{ i18n .title }}"
>{{ partial "icon.html" .icon }}</a
>
{{ end }}
+1 -1
View File
@@ -3,6 +3,6 @@
{{ if $icon }}
{{ $icon.Content | safeHTML }}
{{ else }}
<em>Icon not found.</em>
<em>{{ i18n "shortcode.no_icon" }}</em>
{{ end }}
</span>