mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2024-11-27 04:03:48 +01:00
feat(i18n): initial support for i18n
This commit is contained in:
parent
98804e578d
commit
ed4a43096c
8 changed files with 34 additions and 8 deletions
|
@ -4,6 +4,7 @@ theme = "hugo-theme-stack"
|
|||
paginate = 5
|
||||
title = "Example Site"
|
||||
disqusShortname = "hugo-theme-stack" # Change it to your Disqus shortname before using
|
||||
DefaultContentLanguage = "en" # Theme i18n support
|
||||
|
||||
[permalinks]
|
||||
post = "/p/:slug/"
|
||||
|
|
23
i18n/en.toml
Normal file
23
i18n/en.toml
Normal file
|
@ -0,0 +1,23 @@
|
|||
[toggleMenu]
|
||||
other = "Toggle Menu"
|
||||
|
||||
[relatedContents]
|
||||
other = "Related contents"
|
||||
|
||||
[lastUpdatedOn]
|
||||
other ="Last updated on "
|
||||
|
||||
[widgetArchiveTitle]
|
||||
other = "Archive"
|
||||
|
||||
[widgetArchiveMore]
|
||||
other = "More"
|
||||
|
||||
[widgetTagCloudTitle]
|
||||
other = "Tags"
|
||||
|
||||
[notFoundTitle]
|
||||
other = "Not Found"
|
||||
|
||||
[notFoundSubtitle]
|
||||
other = "This page does not exist."
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
<main class="main full-width">
|
||||
<div class="not-found-card">
|
||||
<h1 class="article-title">Not Found</h1>
|
||||
<h2 class="article-subtitle">This page does not exist.</h2>
|
||||
<h1 class="article-title">{{ T "notFoundTitle" }}</h1>
|
||||
<h2 class="article-subtitle">{{ T "notFoundSubtitle" }}</h2>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
{{- if ne .Lastmod .Date -}}
|
||||
<section class="article-time">
|
||||
{{ (resources.Get "icons/clock.svg").Content | safeHTML }}
|
||||
<span class="article-time--modified">Last updated on {{ .Lastmod.Format ( or .Site.Params.dateFormat "Jan 02, 2006 15:04 MST" ) }}</span>
|
||||
<span class="article-time--modified">
|
||||
{{ T "lastUpdatedOn" }} {{ .Lastmod.Format ( or .Site.Params.dateFormat "Jan 02, 2006 15:04 MST" ) }}
|
||||
</span>
|
||||
</section>
|
||||
{{- end -}}
|
||||
</footer>
|
|
@ -1,7 +1,7 @@
|
|||
<aside class="widget related-contents--wrapper">
|
||||
{{ $related := .Site.RegularPages.Related . | first 5 }}
|
||||
{{ with $related }}
|
||||
<h1 class="widget-title">Related contents</h1>
|
||||
<h1 class="widget-title">{{ T "relatedContents" }}</h1>
|
||||
<div class="related-contents">
|
||||
<div class="flex article-list--tile">
|
||||
{{ range . }}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<aside class="sidebar left-sidebar sticky">
|
||||
<button class="hamburger hamburger--spin" type="button" id="toggle-menu" aria-label="Toggle Menu">
|
||||
<button class="hamburger hamburger--spin" type="button" id="toggle-menu" aria-label="{{ T `toggleMenu` }}">
|
||||
<span class="hamburger-box">
|
||||
<span class="hamburger-inner"></span>
|
||||
</span>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div class="widget-icon">
|
||||
{{ (resources.Get "icons/infinity.svg").Content | safeHTML }}
|
||||
</div>
|
||||
<h1 class="widget-title">Archive</h1>
|
||||
<h1 class="widget-title">{{ T "widgetArchiveTitle" }}</h1>
|
||||
|
||||
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
|
||||
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
|
||||
|
@ -22,7 +22,7 @@
|
|||
{{ if gt (len $archive) .Site.Params.widgets.archive.limit }}
|
||||
<div class="archive-year">
|
||||
<a href="{{ $.Site.BaseURL }}/archive">
|
||||
<span class="year">More</span>
|
||||
<span class="year">{{ T "widgetArchiveMore" }}</span>
|
||||
</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<div class="widget-icon">
|
||||
{{ (resources.Get "icons/tag.svg").Content | safeHTML }}
|
||||
</div>
|
||||
<h1 class="widget-title">Tags</h1>
|
||||
<h1 class="widget-title">{{ T "widgetTagCloudTitle" }}</h1>
|
||||
|
||||
<div class="tagCloud-tags">
|
||||
{{ range first .Site.Params.widgets.tagCloud.limit $v2 }}
|
||||
|
|
Loading…
Reference in a new issue