Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds i18n support to the theme #49

Merged
merged 11 commits into from
Jun 2, 2019
Prev Previous commit
Next Next commit
Adds i18n support
  • Loading branch information
Robin Persson committed Jul 22, 2018
commit ac65570e2675bc370372c6bc6e3fc0f244186b85
40 changes: 40 additions & 0 deletions i18n/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
- id: view
translation: "View"
- id: code
translation: "Code"
- id: viewAll
translation: "View All"
- id: letsChat
translation: "Let's Chat"
- id: name
translation: "Name"
- id: email
translation: "Email"
- id: subject
translation: "Subject"
- id: message
translation: "Message"
- id: send
translation: "Send"
- id: thanksForYourEmail
translation: "Thanks for your email!"
- id: minuteRead
translation: "minute read"
- id: latestPosts
translation: "Latest Posts"
- id: enableJavaScript
translation: "Please enable JavaScript to view comments powered by"
- id: 404Message
translation: "WHAT DID YOU DO?!"
- id: themeDevelopedBy
translation: "Theme developed by"
- id: copyright
translation: "Copyright"
- id: facebook
translation: "Facebook"
- id: github
translation: "GitHub"
- id: linkedin
translation: "LinkedIn"
- id: twitter
translation: "Twitter"
2 changes: 1 addition & 1 deletion layouts/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="row full center-xs middle-xs">
<div class="col-xs-12">
<h1>404!</h1>
<p>WHAT DID YOU DO?!</p>
<p>{{ i18n "404Message" }}</p>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<article>
<h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<div class=sub-header>
{{ .Date.Format (.Site.Params.dateform | default "January 2, 2006") }} · {{ .ReadingTime }} minute read
{{ .Date.Format (.Site.Params.dateform | default "January 2, 2006") }} · {{ .ReadingTime }} {{ i18n "minuteRead" }}
</div>
</article>
{{ end }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<h1>{{ if .Params.heading }} {{ .Params.heading }} {{ else }} {{ .Title }} {{ end }}</h1>

<div class="sub-header">
{{ .Date.Format (.Site.Params.dateform | default "January 2, 2006") }} · {{ .ReadingTime }} minute read
{{ .Date.Format (.Site.Params.dateform | default "January 2, 2006") }} · {{ .ReadingTime }} {{ i18n "minuteRead" }}
</div>

<article class="entry-content">
Expand Down
6 changes: 3 additions & 3 deletions layouts/partials/blog.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<section class="blog" id="blog">
<div class="container">
<div class="row center-xs">
<div class="col-xs-12"><h1>Latest Posts</h1></div>
<div class="col-xs-12"><h1>{{ i18n "latestPosts" }}</h1></div>
</div>
<div class="row">
<div class="col-xs-12 posts-list">
{{ range first 5 (where .Data.Pages "Section" "blog") }}
<article>
<h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<div class=sub-header>
{{ .Date.Format (.Site.Params.dateform | default "January 2, 2006") }} · {{ .ReadingTime }} minute read
{{ .Date.Format (.Site.Params.dateform | default "January 2, 2006") }} · {{ .ReadingTime }} {{ i18n "minuteRead" }}
</div>
</article>
{{ end }}
</div>
</div>
<div class="row center-xs">
<div class="col-xs-12"><h3><a href="{{ .Site.BaseURL }}/blog/">View All</a></h3></div>
<div class="col-xs-12"><h3><a href="{{ .Site.BaseURL }}/blog/">{{ i18n "viewAll" }}</a></h3></div>
</div>
</div>
</section>
14 changes: 7 additions & 7 deletions layouts/partials/contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@

<div class="row">
<div class="col-xs-12">
<h1>Let's Chat</h1>
<h1>{{ i18n "letsChat" }}</h1>
</div>
</div>

<form id="form-contact" action="https://formspree.io/{{ .Site.Params.email }}" method="POST">
<div class="row center-xs">
<div class="col-xs-12 col-sm-6"><input type="text" name="name" placeholder="Name" required></div>
<div class="col-xs-12 col-sm-6"><input type="email" name="email" placeholder="Email" required></div>
<div class="col-xs-12"><input type="text" name="_subject" placeholder="Subject" required></div>
<div class="col-xs-12"><textarea name="message" placeholder="Message" required></textarea></div>
<div class="col-xs-12 col-sm-6"><input type="text" name="name" placeholder="{{ i18n "name" }}" required></div>
<div class="col-xs-12 col-sm-6"><input type="email" name="email" placeholder="{{ i18n "email" }}" required></div>
<div class="col-xs-12"><input type="text" name="_subject" placeholder="{{ i18n "subject" }}" required></div>
<div class="col-xs-12"><textarea name="message" placeholder="{{ i18n "message" }}" required></textarea></div>
<input type="text" name="_gotcha" style="display:none">
<input type="hidden" name="_next" value="/">
<div class="col-xs-12 contact-submit">
<input id="form-submit" type="submit" value="Send">
<span id="form-thankyou" style="visibility:hidden">Thanks for your email!</span>
<input id="form-submit" type="submit" value="{{ i18n "send" }}">
<span id="form-thankyou" style="visibility:hidden">{{ i18n "thanksForYourEmail" }}</span>
</div>
</div>
</form>
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/disqus.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view comments powered by <a href="http:https://disqus.com/?ref_noscript">Disqus</a>.</noscript>
<noscript>{{ i18n "enableJavaScript" }} <a href="http:https://disqus.com/?ref_noscript">Disqus</a>.</noscript>
</section>
12 changes: 6 additions & 6 deletions layouts/partials/footer.html
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<footer class="row middle-xs center-xs">

{{ if .Site.Params.facebook }}
<div class="col-xs-3 col-md-2"><a target="_blank" href="https://facebook.com/{{ .Site.Params.facebook }}">Facebook</a></div>
<div class="col-xs-3 col-md-2"><a target="_blank" href="https://facebook.com/{{ .Site.Params.facebook }}">{{ i18n "facebook" }}</a></div>
{{ end }}

{{ if .Site.Params.github }}
<div class="col-xs-3 col-md-2"><a target="_blank" href="/{{ .Site.Params.github }}">GitHub</a></div>
<div class="col-xs-3 col-md-2"><a target="_blank" href="/{{ .Site.Params.github }}">{{ i18n "github" }}</a></div>
{{ end }}

{{ if .Site.Params.linkedin }}
<div class="col-xs-3 col-md-2"><a target="_blank" href="https://linkedin.com/in/{{ .Site.Params.linkedin }}">LinkedIn</a></div>
<div class="col-xs-3 col-md-2"><a target="_blank" href="https://linkedin.com/in/{{ .Site.Params.linkedin }}">{{ i18n "linkedin" }}</a></div>
{{ end }}

{{ if .Site.Params.twitter }}
<div class="col-xs-3 col-md-2"><a target="_blank" href="https://twitter.com/{{ .Site.Params.twitter }}">Twitter</a></div>
<div class="col-xs-3 col-md-2"><a target="_blank" href="https://twitter.com/{{ .Site.Params.twitter }}">{{ i18n "twitter" }}</a></div>
{{ end }}

{{ if or (.Site.Params.copyright) (.Site.Params.credit) }}
<div class="col-xs-12">
{{ if .Site.Params.copyright }}
Copyright &copy; {{ now.Format "2006" }} {{ .Site.Title }}.
{{ i18n "copyright" }} &copy; {{ now.Format "2006" }} {{ .Site.Title }}.
{{ end }}
{{ if .Site.Params.credit }}
<a href="https://tomanistor.com" target="_blank">Theme developed by Toma Nistor</a>
<a href="https://tomanistor.com" target="_blank">{{ i18n "themeDevelopedBy" }} Toma Nistor</a>
{{ end }}
</div>
{{ end }}
Expand Down
16 changes: 8 additions & 8 deletions layouts/partials/gallery.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<div class="col-xs-12">
<h2>{{ .Title }}</h2>
<div class="row middle-xs center-xs">
{{ if .Params.link1 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link1 }}">View</a></h3></div>{{ end }}
{{ if .Params.link2 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link2 }}">Code</a></h3></div>{{ end }}
{{ if .Params.link1 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link1 }}">{{ i18n "view" }}</a></h3></div>{{ end }}
{{ if .Params.link2 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link2 }}">{{ i18n "code" }}</a></h3></div>{{ end }}
</div>
</div>
</div>
Expand All @@ -32,8 +32,8 @@ <h2>{{ .Title }}</h2>
<div class="col-xs-12">
<h2>{{ .Title }}</h2>
<div class="row middle-xs center-xs">
{{ if .Params.link1 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link1 }}">View</a></h3></div>{{ end }}
{{ if .Params.link2 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link2 }}">Code</a></h3></div>{{ end }}
{{ if .Params.link1 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link1 }}">{{ i18n "view" }}</a></h3></div>{{ end }}
{{ if .Params.link2 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link2 }}">{{ i18n "code" }}</a></h3></div>{{ end }}
</div>
</div>
</div>
Expand All @@ -56,8 +56,8 @@ <h2>{{ .Title }}</h2>
<div class="col-xs-12">
<h2>{{ .Title }}</h2>
<div class="row middle-xs center-xs">
{{ if .Params.link1 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link1 }}">View</a></h3></div>{{ end }}
{{ if .Params.link2 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link2 }}">Code</a></h3></div>{{ end }}
{{ if .Params.link1 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link1 }}">{{ i18n "view" }}</a></h3></div>{{ end }}
{{ if .Params.link2 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link2 }}">{{ i18n "code" }}</a></h3></div>{{ end }}
</div>
</div>
</div>
Expand All @@ -83,8 +83,8 @@ <h2>{{ .Title }}</h2>
<div class="col-xs-12">
<h2>{{ .Title }}</h2>
<div class="row middle-xs center-xs">
{{ if .Params.link1 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link1 }}">View</a></h3></div>{{ end }}
{{ if .Params.link2 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link2 }}">Code</a></h3></div>{{ end }}
{{ if .Params.link1 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link1 }}">{{ i18n "view" }}</a></h3></div>{{ end }}
{{ if .Params.link2 }}<div class="col-xs-3 col-md-4"><h3><a href="{{ .Params.link2 }}">{{ i18n "code" }}</a></h3></div>{{ end }}
</div>
</div>
</div>
Expand Down