mirror of
https://github.com/LukasJoswiak/etch.git
synced 2024-05-01 15:58:32 -04:00
Add basic i18n for list and single (#30)
* add: basic i18n for list and single * add: apply suggestions * fix: indent using 4 tabs
This commit is contained in:
parent
f6133c4eac
commit
4791a23949
|
@ -12,6 +12,7 @@ Etch is a simple, responsive theme for [Hugo](https://gohugo.io) with a focus on
|
|||
* Syntax highlighting with customizable theme.
|
||||
* Dark theme which automatically adjusts based on users' setting ([example](https://github.com/LukasJoswiak/etch/wiki/Dark-mode)).
|
||||
* No external dependencies, no JavaScript, no web fonts.
|
||||
* Internationalization friendly: use default English translations or create your own
|
||||
|
||||
## Installation
|
||||
|
||||
|
|
19
i18n/en.toml
Normal file
19
i18n/en.toml
Normal file
|
@ -0,0 +1,19 @@
|
|||
# Learn how to use Date format (date, created, updated)
|
||||
# -> https://gohugo.io/functions/dateformat/
|
||||
|
||||
[posts]
|
||||
|
||||
[posts.title]
|
||||
other = "Posts"
|
||||
|
||||
[posts.date]
|
||||
other = "Jan 2, 2006"
|
||||
|
||||
|
||||
[post]
|
||||
|
||||
[post.created]
|
||||
other = "Jan 2, 2006"
|
||||
|
||||
[post.updated]
|
||||
other = "Updated Jan 2, 2006"
|
|
@ -1,6 +1,6 @@
|
|||
<li>
|
||||
<a href="{{ .Permalink }}">
|
||||
{{ .Title }}
|
||||
<small><time>{{ .Date.Format "Jan 2, 2006" }}</time></small>
|
||||
<small><time>{{ .Date | time.Format (i18n "posts.date") }}</time></small>
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
<article>
|
||||
<header id="post-header">
|
||||
<h1>{{ .Title }}</h1>
|
||||
<div>
|
||||
{{- if isset .Params "date" -}}
|
||||
{{ if eq .Lastmod .Date }}
|
||||
<time>{{ .Date.Format "January 2, 2006" }}</time>
|
||||
{{ else }}
|
||||
Updated <time>{{ .Lastmod.Format "January 2, 2006" }}</time>
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
</div>
|
||||
<div>
|
||||
{{- if isset .Params "date" -}}
|
||||
{{ if eq .Lastmod .Date }}
|
||||
<time>{{ .Date | time.Format (i18n "post.created") }}</time>
|
||||
{{ else }}
|
||||
<time>{{ .Date | time.Format (i18n "post.updated") }}</time>
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
</div>
|
||||
</header>
|
||||
{{- .Content -}}
|
||||
</article>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<h3>Posts</h3>
|
||||
<h3>{{ i18n "posts.title" }}</h3>
|
||||
<ul id="posts">
|
||||
{{- range where site.RegularPages "Type" "in" site.Params.mainSections }}
|
||||
{{ .Render "li" }}
|
||||
|
|
Loading…
Reference in a new issue