Skip to content

Commit d91e042

Browse files
committed
Improved Language Support
Open ui.yml, add your language and set the according language in _config.yml
1 parent 65bf86a commit d91e042

File tree

13 files changed

+113
-59
lines changed

13 files changed

+113
-59
lines changed

Icon

Whitespace-only changes.

_config.yml

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ title: 'Simplicity'
1313
description: 'Simplicity is a fast and easy to use jekyll theme for minimalists concentrating on elegance and flexibility.'
1414
slogan: 'A Minimalistic Jekyll Theme'
1515

16+
# The language setting is used in /includes/header.html for html-settings
17+
lang: "en"
1618

1719
# Build settings
1820
url: 'https://phlow.github.io'
@@ -33,8 +35,6 @@ posts_list_limit: 15
3335
# Use <!--more--> in your posts to generate an excerpt and a teaser
3436
excerpt_separator: <!--more-->
3537

36-
# The language setting is used in /includes/header.html for html-settings
37-
language: "en"
3838

3939

4040

@@ -243,35 +243,3 @@ socialmedia:
243243
# rss: # Full URL needed
244244

245245

246-
247-
# __
248-
# / / ____ _____ ____ ___ ______ _____ ____
249-
# / / / __ `/ __ \/ __ `/ / / / __ `/ __ `/ _ \
250-
# / /___/ /_/ / / / / /_/ / /_/ / /_/ / /_/ / __/
251-
# /_____/\__,_/_/ /_/\__, /\__,_/\__,_/\__, /\___/
252-
# /____/ /____/
253-
#
254-
# To translate *Simplicity* just edit the following data.
255-
# The theme uses for example {{ site.language.read_more }} in
256-
# the layout templates to fill in the according information
257-
# given beneath.
258-
259-
language:
260-
html_language: 'en' # The language setting is used in /includes/header.html for html-settings
261-
read_more: 'Read more ›'
262-
show_all_articles: 'Show All Articles ›'
263-
visit_frontpage: 'Visit the frontpage'
264-
comments_headline: 'Comments'
265-
enable_disqus: 'Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a>'
266-
search: 'Search'
267-
search_input_placeholder: 'Search [Hit Tab and start writing]'
268-
written_by: 'Written by'
269-
more_articles: 'More Articles'
270-
follow_me_on: 'Follow me at'
271-
# More on Accesskeys › http://www.cs.tut.fi/~jkorpela/forms/accesskey.html
272-
navigation_search: 'Press Accesskey [4] for Search'
273-
navigation_menu: 'Press Accesskey [6] for Navigation Menu'
274-
navigation_home: 'Press Accesskey [1] for Homepage'
275-
subscribe_to_my_rss_feed: 'Subscribe to my RSS Feed'
276-
source: 'Source'
277-
check_out_link: 'Check out the link ›'

_data/ui.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# __
2+
# / / ____ _____ ____ ___ ______ _____ ____
3+
# / / / __ `/ __ \/ __ `/ / / / __ `/ __ `/ _ \
4+
# / /___/ /_/ / / / / /_/ / /_/ / /_/ / /_/ / __/
5+
# /_____/\__,_/_/ /_/\__, /\__,_/\__,_/\__, /\___/
6+
# /____/ /____/
7+
#
8+
# This is the language file of *Simplicity*
9+
# Add your translation and set the language in
10+
# config.yml
11+
#
12+
# Example for config.yml › lang: 'de'
13+
#
14+
# To translate *Simplicity* just edit the following data.
15+
# The theme uses for example it like this:
16+
#
17+
# {{ site.data.ui[site.lang].read_more | default: "Read More&nbsp;›" }}
18+
19+
20+
# English (default)
21+
# -----------------
22+
# More on Accesskeys › http://www.cs.tut.fi/~jkorpela/forms/accesskey.html
23+
en: &DEFAULT_EN
24+
navigation_search : 'Press Accesskey [4] for Search'
25+
navigation_menu : 'Press Accesskey [6] for Navigation Menu'
26+
navigation_home : 'Press Accesskey [1] for Homepage'
27+
read_more : 'Read more ›'
28+
show_all_articles : 'Show All Articles ›'
29+
visit_frontpage : 'Visit the frontpage'
30+
comments_headline : 'Comments'
31+
enable_disqus : 'Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a>'
32+
search : 'Search'
33+
search_input_placeholder : 'Search [Hit Tab and start writing]'
34+
written_by : 'Written by'
35+
more_articles : 'More Articles'
36+
follow_me_on : 'Follow me at'
37+
subscribe_to_my_rss_feed : 'Subscribe to my RSS Feed'
38+
source : 'Source'
39+
check_out_link : 'Check out the link ›'
40+
41+
en-US:
42+
<<: *DEFAULT_EN
43+
en-CA:
44+
<<: *DEFAULT_EN
45+
en-GB:
46+
<<: *DEFAULT_EN
47+
en-AU:
48+
<<: *DEFAULT_EN
49+
50+
51+
52+
# German / Deutsch
53+
# -----------------
54+
de: &DEFAULT_DE
55+
navigation_search : 'Drück den Accesskey [4] für Suche'
56+
navigation_menu : 'Drück den Accesskey [6] für das Navigation Menü'
57+
navigation_home : 'Drück den Accesskey [1] für die Startseite'
58+
read_more : 'Weiterlesen&nbsp;›'
59+
show_all_articles : 'Zeige alle Beiträge&nbsp;›'
60+
visit_frontpage : 'Besuch die Startseite'
61+
comments_headline : 'Kommentare'
62+
enable_disqus : 'Bitte schalte Javascript ein, um die Kommentare zu lesen. <a href="http://disqus.com/?ref_noscript">Kommentarfunktion von Disqus.</a>'
63+
search : 'Suche'
64+
search_input_placeholder : 'Suchen [Drücke Tab und schreib los]'
65+
written_by : 'Geschrieben von'
66+
more_articles : 'Mehr Artikel'
67+
follow_me_on : 'Folge mir auf'
68+
subscribe_to_my_rss_feed : 'Abonnier meinen RSS Feed'
69+
source : 'Source'
70+
check_out_link : 'Schau Dir den Link an ›'
71+
72+
de-DE:
73+
<<: *DEFAULT_DE
74+
de-AT:
75+
<<: *DEFAULT_DE
76+
de-CH:
77+
<<: *DEFAULT_DE
78+
de-BE:
79+
<<: *DEFAULT_DE
80+
de-LI:
81+
<<: *DEFAULT_DE
82+
de-LU:
83+
<<: *DEFAULT_DE
84+
85+
# Another locale
86+
# --------------

_includes/_1_head.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
{% assign title = title | strip_html | escape | strip_newlines %}
2020

2121
{% endcapture %}<!doctype html>
22-
<html lang="{% if site.language == nil %}en{% else %}{{ site.language.html_language }}{% endif %}">
22+
<html lang="{{ site.lang | slice: 0,2 | default: "en" }}">
2323
<head>
2424
<meta charset="utf-8">
2525
<meta name="viewport" content="width=device-width, initial-scale=1">

_includes/_comments.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% if page.comments %}
2-
<h3 id="comments" class="t60">{{ site.language.comments_headline }}</h3>
2+
<h3 id="comments" class="t60">{{ site.data.ui[site.lang].comments_headline }}</h3>
33
<div id="disqus_thread"></div>
44
<script type="text/javascript">
55
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
@@ -13,7 +13,7 @@ <h3 id="comments" class="t60">{{ site.language.comments_headline }}</h3>
1313
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
1414
})();
1515
</script>
16-
<noscript>{{ site.language.enable_disqus }}</noscript>
16+
<noscript>{{ site.data.ui[site.lang].enable_disqus | default: 'Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a>' }}</noscript>
1717
{% endif %}
1818

1919

_includes/_social_media_icons.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,33 @@
1313
#
1414
{% endcomment %}
1515
{% if site.socialmedia.github %}
16-
<li class="social-media-icon"><a href="https://github.com/{{ site.socialmedia.github }}" target="_blank" title="{{ site.language.follow_me_on }} Github">{% include svg-social-media/github_ring.svg %}</a></li>
16+
<li class="social-media-icon"><a href="https://github.com/{{ site.socialmedia.github }}" target="_blank" title="{{ site.data.ui[site.lang].follow_me_on | default: '' }} Github">{% include svg-social-media/github_ring.svg %}</a></li>
1717
{% endif %}
1818

1919
{% if site.socialmedia.youtube %}
20-
<li class="social-media-icon"><a href="https://www.youtube.com/user/{{ site.socialmedia.youtube }}" target="_blank" title="{{ site.language.follow_me_on }} Youtube">{% include svg-social-media/youtube.svg %}</a></li>
20+
<li class="social-media-icon"><a href="https://www.youtube.com/user/{{ site.socialmedia.youtube }}" target="_blank" title="{{ site.data.ui[site.lang].follow_me_on | default: '' }} Youtube">{% include svg-social-media/youtube.svg %}</a></li>
2121
{% endif %}
2222

2323
{% if site.socialmedia.twitter %}
24-
<li class="social-media-icon"><a href="https://twitter.com/{{ site.socialmedia.twitter }}" target="_blank" title="{{ site.language.follow_me_on }} Twitter">{% include svg-social-media/twitter.svg %}</a></li>
24+
<li class="social-media-icon"><a href="https://twitter.com/{{ site.socialmedia.twitter }}" target="_blank" title="{{ site.data.ui[site.lang].follow_me_on | default: '' }} Twitter">{% include svg-social-media/twitter.svg %}</a></li>
2525
{% endif %}
2626

2727
{% if site.socialmedia.facebook %}
28-
<li class="social-media-icon"><a href="https://facebook.com/{{ site.socialmedia.facebook }}" target="_blank" title="{{ site.language.follow_me_on }} Facebook">{% include svg-social-media/facebook_square.svg %}</a></li>
28+
<li class="social-media-icon"><a href="https://facebook.com/{{ site.socialmedia.facebook }}" target="_blank" title="{{ site.data.ui[site.lang].follow_me_on | default: '' }} Facebook">{% include svg-social-media/facebook_square.svg %}</a></li>
2929
{% endif %}
3030

3131
{% if site.socialmedia.soundcloud %}
32-
<li class="social-media-icon"><a href="https://soundcloud.com/{{ site.socialmedia.soundcloud }}" target="_blank" title="{{ site.language.follow_me_on }} Soundcloud">{% include svg-social-media/soundcloud_notext.svg %}</a></li>
32+
<li class="social-media-icon"><a href="https://soundcloud.com/{{ site.socialmedia.soundcloud }}" target="_blank" title="{{ site.data.ui[site.lang].follow_me_on | default: '' }} Soundcloud">{% include svg-social-media/soundcloud_notext.svg %}</a></li>
3333
{% endif %}
3434

3535
{% if site.socialmedia.instagram %}
36-
<li class="social-media-icon"><a href="https://www.instagram.com/{{ site.socialmedia.instagram }}" target="_blank" title="{{ site.language.follow_me_on }} Instagram">{% include svg-social-media/instagram.svg %}</a></li>
36+
<li class="social-media-icon"><a href="https://www.instagram.com/{{ site.socialmedia.instagram }}" target="_blank" title="{{ site.data.ui[site.lang].follow_me_on | default: '' }} Instagram">{% include svg-social-media/instagram.svg %}</a></li>
3737
{% endif %}
3838

3939
{% if site.socialmedia.tumblr %}
40-
<li class="social-media-icon"><a href="https://{{ site.socialmedia.tumblr }}.tumblr.com/" target="_blank" title="{{ site.language.follow_me_on }} tumblr">{% include svg-social-media/tumblr.svg %}</a></li>
40+
<li class="social-media-icon"><a href="https://{{ site.socialmedia.tumblr }}.tumblr.com/" target="_blank" title="{{ site.data.ui[site.lang].follow_me_on | default: '' }} tumblr">{% include svg-social-media/tumblr.svg %}</a></li>
4141
{% endif %}
4242

4343
{% if site.socialmedia.rss %}
44-
<li class="social-media-icon"><a href="{{ site.socialmedia.rss }}" target="_blank" title="{{ site.language.subscribe_to_my_rss_feed }}">{% include svg-social-media/rss.svg %}</a></li>
44+
<li class="social-media-icon"><a href="{{ site.socialmedia.rss }}" target="_blank" title="{{ site.data.ui[site.lang].subscribe_to_my_rss_feed | default: '' }}">{% include svg-social-media/rss.svg %}</a></li>
4545
{% endif %}

_includes/list-posts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@
2828
{% for post in site.posts limit:include.entries offset:include.offset %}
2929
<li><a href="{{ site.url }}{{ post.url }}">{% if post.subheadline %}{{ post.subheadline }} &middot; {% endif %}<strong>{{ post.title }}</strong></a></li>
3030
{% endfor %}
31-
<li class="text-right"><a href="{{ site.url }}/blog/archive/"><strong>{{ site.language.more }}</strong></a></li>
31+
<li class="text-right"><a href="{{ site.url }}/blog/archive/"><strong>{{ site.data.ui[site.lang].more }}</strong></a></li>
3232

3333

3434
{% elsif category %}
3535

3636
{% for post in site.categories.[category] limit:include.entries offset:include.offset %}
3737
<li><a href="{{ site.url }}{{ post.url }}">{% if post.subheadline %}{{ post.subheadline }} &middot; {% endif %}<strong>{{ post.title }}</strong></a></li>
3838
{% endfor %}
39-
<li class="text-right"><a href="{{ site.url }}/blog/archive/"><strong>{{ site.language.more }}</strong></a></li>
39+
<li class="text-right"><a href="{{ site.url }}/blog/archive/"><strong>{{ site.data.ui[site.lang].more }}</strong></a></li>
4040

4141

4242
{% elsif tag %}

_includes/next-previous-post-in-category

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
{% endif %}
2626
{% endfor %}
2727
{% if next_post %}
28-
<a class="left button tiny radius icon-chevron-left r15" href="{{ next_post }}">{{ site.language.next_post_in }} {{ cat | upcase }}</a>
28+
<a class="left button tiny radius icon-chevron-left r15" href="{{ next_post }}">{{ site.data.ui[site.lang].next_post_in }} {{ cat | upcase }}</a>
2929
{% endif %}
3030
{% if prev_post %}
31-
<a class="button tiny radius" href="{{ prev_post }}">{{ site.language.previous_post_in }} {{ cat | upcase }}<span class="icon-chevron-right"></span></a>
31+
<a class="button tiny radius" href="{{ prev_post }}">{{ site.data.ui[site.lang].previous_post_in }} {{ cat | upcase }}<span class="icon-chevron-right"></span></a>
3232
{% endif %}
3333

_includes/search

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
*
77
{% endcomment %}
88
<form id="search-container" action="{{ "/search/" | absolute_url }}" method="get">
9-
<input accesskey="4" tabindex="1" class="search-input" type="search" placeholder="{{ site.language.search_input_placeholder }}" id="search-box" name="query">
10-
<button class="search-button" type="submit">{{ site.language.search }}</button>
9+
<input accesskey="4" tabindex="1" class="search-input" type="search" placeholder="{{ site.data.ui[site.lang].search_input_placeholder }}" id="search-box" name="query">
10+
<button class="search-button" type="submit">{{ site.data.ui[site.lang].search }}</button>
1111
</form>

_layouts/frontpage.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,20 @@ <h1><a href="{{ post.link }}" target="_blank">{{ post.title }}</a></h1>
6565
<h1><a href="{{ post.url | absolute_url }}">{{ post.title }}</a></h1>
6666
<p class="teaser">
6767
{{ post.excerpt | replace: '<p>', '' | replace: '</p>', ''}}
68-
<a href="{{ post.url | absolute_url }}">{{ site.language.read_more }}</a>
68+
<a href="{{ post.url | absolute_url }}">{{ site.data.ui[site.lang].read_more }}</a>
6969
</p>
7070
{% endif %}
7171

7272
<div class="tem2 bem2">&nbsp;</div>
7373
{% endfor %}
7474

7575

76-
<h2>{{ site.language.more_articles }}</h2>
76+
<h2>{{ site.data.ui[site.lang].more_articles }}</h2>
7777
<ul class="toc">
7878
{% for post in site.posts limit:site.posts_list_limit offset:site.posts_with_teaser_limit %}
7979
{% if forloop.last %}
8080
<li><a href="{{ post.url | absolute_url }}">{% if post.subheadline %}<span>{{ post.subheadline }}</span>{% endif %}{{ post.title }}</a></li>
81-
<li class="text-right archive-link"><a href="{{ "/archive/" | absolute_url }}">{{ site.language.show_all_articles }}</a></li>
81+
<li class="text-right archive-link"><a href="{{ "/archive/" | absolute_url }}">{{ site.data.ui[site.lang].show_all_articles }}</a></li>
8282
</ul>
8383
{% else %}
8484
<li><a href="{{ post.url | absolute_url }}">{% if post.subheadline %}<span>{{ post.subheadline }}</span>{% endif %}{{ post.title }}</a></li>

0 commit comments

Comments
 (0)