Add support for localizing UI text with a _data file

This commit is contained in:
Michael Rose
2016-03-09 16:33:27 -05:00
parent 927b3d36ff
commit ea8fb6fe33
7 changed files with 48 additions and 13 deletions
+3 -3
View File
@@ -16,15 +16,15 @@
<div class="follow">
<ul>
<li><strong>Follow:</strong></li>
<li><strong>{{ site.data.ui-text.locale[site.locale].follow_label }}</strong></li>
{% if site.twitter.username %}
<li><a href="https://twitter.com/{{ site.twitter.username }}"><i class="fa fa-fw fa-twitter"></i> Twitter</a></li>
{% endif %}
{% if site.facebook.username %}
<li><a href="https://facebook.com/{{ site.facebook.username }}"><i class="fa fa-fw fa-facebook"></i> Facebook</a></li>
{% endif %}
<li><a href="{{ base_path }}/feed.xml"><i class="fa fa-fw fa-rss"></i> Feed</a></li>
<li><a href="{{ base_path }}/feed.xml"><i class="fa fa-fw fa-rss"></i> {{ site.data.ui-text.locale[site.locale].feed_label }}</a></li>
</ul>
</div>
<div class="copyright">&copy; {{ site.time | date: '%Y' }} {{ site.name | default: site.title }}. Powered by <a href="http://jekyllrb.com" rel="nofollow">Jekyll</a> using the <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a> theme.</div>
<div class="copyright">&copy; {{ site.time | date: '%Y' }} {{ site.name | default: site.title }}. {{ site.data.ui-text.locale[site.locale].powered_by }} <a href="http://jekyllrb.com" rel="nofollow">Jekyll</a> &amp; <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div>
+5 -5
View File
@@ -6,9 +6,9 @@
{% comment %} Link for previous page {% endcomment %}
{% if paginator.previous_page %}
{% if paginator.previous_page == 1 %}
<li><a href="{{ base_path }}/" class="btn">Previous</a></li>
<li><a href="{{ base_path }}/" class="btn">{{ site.data.ui-text.locale[site.locale].pagination_previous }}</a></li>
{% else %}
<li><a href="{{ base_path }}/page{{ paginator.previous_page }}/" class="btn">Previous</a></li>
<li><a href="{{ base_path }}/page{{ paginator.previous_page }}/" class="btn">{{ site.data.ui-text.locale[site.locale].pagination_previous }}</a></li>
{% endif %}
{% endif %}
@@ -36,10 +36,10 @@
{% if index == paginator.page %}
<li><strong class="current">{{ index }}</strong></li>
{% else %}
{% comment %} Distance from current page and this link {% endcomment %}
{% comment %}Distance from current page and this link{% endcomment %}
{% assign dist = paginator.page | minus: index %}
{% if dist < 0 %}
{% comment %} Distance must be a positive value {% endcomment %}
{% comment %}Distance must be a positive value{% endcomment %}
{% assign dist = 0 | minus: dist %}
{% endif %}
<li><a href="{{ base_path }}/page{{ index }}/">{{ index }}</a></li>
@@ -59,7 +59,7 @@
{% comment %}Link next page{% endcomment %}
{% if paginator.next_page %}
<li><a href="{{ base_path }}/page{{ paginator.next_page }}/" class="btn">Next</a></li>
<li><a href="{{ base_path }}/page{{ paginator.next_page }}/" class="btn">{{ site.data.ui-text.locale[site.locale].pagination_next }}</a></li>
{% endif %}
</ul>
</nav>
+1 -1
View File
@@ -1,5 +1,5 @@
<div class="social-share">
<h4>Share on</h4>
<h4>{{ site.data.ui-text.locale[site.locale].share_on }}</h4>
<ul>
<li>
<a href="https://twitter.com/intent/tweet?text={{ base_path }}{{ page.url }}" class="twitter" title="Share on Twitter"><i class="fa fa-twitter"></i><span> Twitter</span></a>
+1 -1
View File
@@ -1,5 +1,5 @@
<section id="table-of-contents" class="toc">
<header><h3><i class="fa fa-{{ include.icon | default: 'book' }}"></i> {{ include.title | default: "Overview" }}</h3></header>
<header><h3><i class="fa fa-{{ include.icon | default: 'book' }}"></i> {{ include.title | default: site.data.ui-text.locale[site.locale].toc_label }}</h3></header>
<div id="drawer" markdown="1">
* Auto generated table of contents
{:toc}