feat(i18n): initial support for i18n
This commit is contained in:
parent
98804e578d
commit
ed4a43096c
@ -4,6 +4,7 @@ theme = "hugo-theme-stack"
|
|||||||
paginate = 5
|
paginate = 5
|
||||||
title = "Example Site"
|
title = "Example Site"
|
||||||
disqusShortname = "hugo-theme-stack" # Change it to your Disqus shortname before using
|
disqusShortname = "hugo-theme-stack" # Change it to your Disqus shortname before using
|
||||||
|
DefaultContentLanguage = "en" # Theme i18n support
|
||||||
|
|
||||||
[permalinks]
|
[permalinks]
|
||||||
post = "/p/:slug/"
|
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">
|
<main class="main full-width">
|
||||||
<div class="not-found-card">
|
<div class="not-found-card">
|
||||||
<h1 class="article-title">Not Found</h1>
|
<h1 class="article-title">{{ T "notFoundTitle" }}</h1>
|
||||||
<h2 class="article-subtitle">This page does not exist.</h2>
|
<h2 class="article-subtitle">{{ T "notFoundSubtitle" }}</h2>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
@ -17,7 +17,9 @@
|
|||||||
{{- if ne .Lastmod .Date -}}
|
{{- if ne .Lastmod .Date -}}
|
||||||
<section class="article-time">
|
<section class="article-time">
|
||||||
{{ (resources.Get "icons/clock.svg").Content | safeHTML }}
|
{{ (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>
|
</section>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
</footer>
|
</footer>
|
@ -1,7 +1,7 @@
|
|||||||
<aside class="widget related-contents--wrapper">
|
<aside class="widget related-contents--wrapper">
|
||||||
{{ $related := .Site.RegularPages.Related . | first 5 }}
|
{{ $related := .Site.RegularPages.Related . | first 5 }}
|
||||||
{{ with $related }}
|
{{ with $related }}
|
||||||
<h1 class="widget-title">Related contents</h1>
|
<h1 class="widget-title">{{ T "relatedContents" }}</h1>
|
||||||
<div class="related-contents">
|
<div class="related-contents">
|
||||||
<div class="flex article-list--tile">
|
<div class="flex article-list--tile">
|
||||||
{{ range . }}
|
{{ range . }}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<aside class="sidebar left-sidebar sticky">
|
<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-box">
|
||||||
<span class="hamburger-inner"></span>
|
<span class="hamburger-inner"></span>
|
||||||
</span>
|
</span>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<div class="widget-icon">
|
<div class="widget-icon">
|
||||||
{{ (resources.Get "icons/infinity.svg").Content | safeHTML }}
|
{{ (resources.Get "icons/infinity.svg").Content | safeHTML }}
|
||||||
</div>
|
</div>
|
||||||
<h1 class="widget-title">Archive</h1>
|
<h1 class="widget-title">{{ T "widgetArchiveTitle" }}</h1>
|
||||||
|
|
||||||
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
|
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
|
||||||
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
|
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
|
||||||
@ -22,7 +22,7 @@
|
|||||||
{{ if gt (len $archive) .Site.Params.widgets.archive.limit }}
|
{{ if gt (len $archive) .Site.Params.widgets.archive.limit }}
|
||||||
<div class="archive-year">
|
<div class="archive-year">
|
||||||
<a href="{{ $.Site.BaseURL }}/archive">
|
<a href="{{ $.Site.BaseURL }}/archive">
|
||||||
<span class="year">More</span>
|
<span class="year">{{ T "widgetArchiveMore" }}</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<div class="widget-icon">
|
<div class="widget-icon">
|
||||||
{{ (resources.Get "icons/tag.svg").Content | safeHTML }}
|
{{ (resources.Get "icons/tag.svg").Content | safeHTML }}
|
||||||
</div>
|
</div>
|
||||||
<h1 class="widget-title">Tags</h1>
|
<h1 class="widget-title">{{ T "widgetTagCloudTitle" }}</h1>
|
||||||
|
|
||||||
<div class="tagCloud-tags">
|
<div class="tagCloud-tags">
|
||||||
{{ range first .Site.Params.widgets.tagCloud.limit $v2 }}
|
{{ range first .Site.Params.widgets.tagCloud.limit $v2 }}
|
||||||
|
Loading…
Reference in New Issue
Block a user