Skip to content

Commit

Permalink
Merge pull request #97 from Monpoke/master
Browse files Browse the repository at this point in the history
Adds translations for static texts
  • Loading branch information
gurusabarish authored Feb 6, 2023
2 parents 03a9f1b + aae2408 commit 98f6f9c
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 13 deletions.
13 changes: 13 additions & 0 deletions exampleSite/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -371,3 +371,16 @@ params:
readTime:
enable: true
content: "min read"

# For translations
terms:
read: "Read"
toc: "Table Of Contents"
copyright: "All rights reserved"
pageNotFound: "Page not found"
emailText: "Check out this site"

datesFormat:
article: "Jan 2, 2006"
articleList: "Jan 2, 2006"
articleRecent: "Jan 2, 2006"
6 changes: 3 additions & 3 deletions layouts/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
{{ end }}

{{ define "title" }}
{{ .Site.Title }} | 404 page not found
{{ .Site.Title }} | {{ .Site.Params.terms.pageNotFound | default "404 page not found" }}
{{ end }}

{{ define "main" }}
<div class="container py-5 text-center">
<img src="{{ .Site.Params.staticPath }}/404.png" alt="404 page not found" class="img-fluid" width="40%">
<h1>404 Page Not Found</h1>
<img src="{{ .Site.Params.staticPath }}/404.png" alt='{{ .Site.Params.terms.pageNotFound | default "404 page not found" }}' class="img-fluid" width="40%">
<h1>{{ .Site.Params.terms.pageNotFound | default "404 page not found" }}</h1>
</div>
{{ end }}
4 changes: 2 additions & 2 deletions layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ <h5 class="card-title bg-transparent" title="{{ .Title }}">{{ .Title | truncate
</div>
</div>
<div class="mt-auto post-footer bg-transparent py-3">
<span class="float-start bg-transparent">{{ .Date.Format "January 2, 2006" }}</span>
<a href="{{ .RelPermalink }}" class="float-end btn btn-outline-info btn-sm">Read</a>
<span class="float-start bg-transparent">{{ .Date.Format (.Site.Params.datesFormat.articleList | default "January 2, 2006") }}</span>
<a href="{{ .RelPermalink }}" class="float-end btn btn-outline-info btn-sm">{{ .Site.Params.terms.read | default "Read" }}</a>
</div>
</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h1 class="text-center mb-4">{{ .Title }}</h1>
<div class="text-center">
{{ .Params.author }}
<small>|</small>
{{ .Date.Format "Jan 2, 2006" }}
{{ .Date.Format (.Site.Params.datesFormat.article | default "Jan 2, 2006") }}

{{ if or (.Site.Params.singlePages.readTime.enable | default true) (.Params.enableReadingTime) }}
<span id="readingTime">
Expand All @@ -45,7 +45,7 @@ <h1 class="text-center mb-4">{{ .Title }}</h1>
{{ if .Params.toc | default true}}
<aside class="toc">
<h5>
Table Of Contents
{{ .Site.Params.terms.toc | default "Table Of Contents" }}
</h5>
<div class="toc-content">
{{.TableOfContents}}
Expand All @@ -55,7 +55,7 @@ <h5>

{{ if .Params.tags }}
<aside class="tags">
<h5>Tags</h5>
<h5>{{ .Site.Params.terms.tags | default "Tags" }}</h5>
<ul class="tags-ul list-unstyled list-inline">
{{range .Params.tags}}
<li class="list-inline-item"><a href="{{`tags` | absURL}}/{{.| urlize}}" target="_blank">{{.}}</a></li>
Expand All @@ -66,7 +66,7 @@ <h5>Tags</h5>

{{ if .Params.socialShare | default true }}
<aside class="social">
<h5>Social</h5>
<h5>{{ .Site.Params.terms.social | default "Social" }}</h5>
<div class="social-content">
<ul class="list-inline">
<li class="list-inline-item text-center">
Expand All @@ -80,7 +80,7 @@ <h5>Social</h5>
</a>
</li>
<li class="list-inline-item text-center">
<a target="_blank" href="mailto:?subject={{ .Title }}&amp;body=Check out this site {{ .Site.Params.hostName }}{{ .Permalink | absURL }}">
<a target="_blank" href='mailto:?subject={{ .Title }}&amp;body={{ .Site.Params.terms.emailText | default "Check out this site" }} {{ .Site.Params.hostName }}{{ .Permalink | absURL }}'>
<i class="fa fa-envelope"></i>
</a>
</li>
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/sections/footer/copyright.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
height="40px" width="40px">
</a>
</div>
&copy; {{ now.Format "2006"}} {{ .Site.Params.copyright }} All Rights Reserved
&copy; {{ now.Format "2006"}} {{ .Site.Params.copyright }} {{ .Site.Params.terms.copyright | default "All Rights Reserved" }}
<div class="text-secondary">
Made with
<span class="text-danger">
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/sections/footer/recentBlogPosts.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ <h5 class="card-title bg-transparent" title="{{ .Title }}">{{ .Title | truncate
</div>
</div>
<div class="mt-auto card-footer">
<span class="float-start">{{ .Date.Format "January 2, 2006" }}</span>
<a href="{{ .RelPermalink }}" class="float-end btn btn-outline-info btn-sm">Read</a>
<span class="float-start">{{ .Date.Format (.Site.Params.datesFormat.articleRecent | default "January 2, 2006") }}</span>
<a href="{{ .RelPermalink }}" class="float-end btn btn-outline-info btn-sm">{{ .Site.Params.terms.read | default "Read" }}</a>
</div>
</div>
</div>
Expand Down

0 comments on commit 98f6f9c

Please sign in to comment.