feat: Add internationalization (i18n) support (#182)

This commit is contained in:
Youssif Shaaban Alsager
2022-08-24 05:32:40 +02:00
committed by GitHub
parent e38eaa94d6
commit 25ba1159ad
19 changed files with 189 additions and 52 deletions

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="{{ .Lang }}">
{{ block "head" . }}
{{ end }}

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="{{ .Lang }}">
{{ partial "head.html" . }}
<body>
@ -8,7 +8,7 @@
<!-- Begin actual content -->
{{partial "header.html" .}}
<article>
<h1>All {{.Title}}</h1>
<h1>{{ i18n "all_posts" . }}</h1>
{{with .Params.description}}
<p>{{.}}</p>
{{end}}
@ -18,5 +18,4 @@
{{partial "contact.html" .}}
</div>
</body>
</html>

View File

@ -10,7 +10,7 @@
<article>
{{if .Title}}<h1>{{ .Title }}</h1>{{end}}
<p class="meta">
Last updated {{ partial "date-fmt.html" .}}
{{ i18n "last_updated" }} {{ partial "date-fmt.html" .}}
{{ partial "github.html" . }}
</p>
<ul class="tags">
@ -24,5 +24,4 @@
{{partial "footer.html" .}}
</div>
</body>
</html>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="{{ .Lang }}">
{{ partial "head.html" . }}
<body>
@ -8,7 +8,7 @@
<!-- Begin actual content -->
{{partial "header.html" .}}
<article>
<h1>All {{.Title}}</h1>
<h1>{{ i18n "all_posts" . }}</h1>
{{with .Params.description}}
<p>{{.}}</p>
{{end}}
@ -16,7 +16,7 @@
{{ range .Site.Taxonomies.tags.ByCount }}
<div class="meta">
<h1><a href="{{ .Page.Permalink }}">{{ .Page.Title | humanize }}</a></h1>
<p><b>{{ .Count }}</b> notes with this tag {{if gt .Count 10}}(showing first 10 results){{end}}</p>
<p><b>{{ .Count }}</b> {{ i18n "notes_count" }} {{if gt .Count 10}}({{ i18n "first_10"}}){{end}}</p>
</div>
{{ with ($.Site.GetPage (printf "/tags/%s" .Page.Title)) }}
{{partial "page-list.html" (first 10 .Pages.ByLastmod.Reverse)}}
@ -27,5 +27,4 @@
{{partial "contact.html" .}}
</div>
</body>
</html>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="{{ .Lang }}">
{{ partial "head.html" . }}
<body>
@ -8,7 +8,7 @@
<!-- Begin actual content -->
{{partial "header.html" .}}
<article>
<h1>Tag: {{ .Title }}</h1>
<h1>{{ i18n "tag" }}: {{ .Title }}</h1>
{{with .Params.description}}
<p>{{.}}</p>
{{end}}
@ -18,5 +18,4 @@
{{partial "contact.html" .}}
</div>
</body>
</html>