From ea8fb6fe335c9d8a693396af1bf08ad4d87e666d Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Wed, 9 Mar 2016 16:33:27 -0500 Subject: [PATCH] Add support for localizing UI text with a _data file --- _data/ui-text.yml | 19 +++++++++++++++++++ _includes/footer | 6 +++--- _includes/pagination | 10 +++++----- _includes/social-share | 2 +- _includes/toc | 2 +- _layouts/single.html | 8 +++++--- _posts/2010-01-07-post-modified.md | 14 ++++++++++++++ 7 files changed, 48 insertions(+), 13 deletions(-) create mode 100644 _data/ui-text.yml create mode 100644 _posts/2010-01-07-post-modified.md diff --git a/_data/ui-text.yml b/_data/ui-text.yml new file mode 100644 index 00000000..dea7b695 --- /dev/null +++ b/_data/ui-text.yml @@ -0,0 +1,19 @@ +# User interface text for localization + +locale: + # English (default) + # ----------------- + en: &DEFAULT_EN + pagination_previous: "Previous" + pagination_next: "Next" + toc_label: "Overview" + share_on: "Share on" + date_label: "Last Updated:" + related_label: "You May Also Enjoy" + follow_label: "Follow:" + feed_label: "Feed" + powered_by: "Powered by" + en_US: + <<: *DEFAULT_EN + en_UK: + <<: *DEFAULT_EN \ No newline at end of file diff --git a/_includes/footer b/_includes/footer index 16bca6ac..b040ab1e 100644 --- a/_includes/footer +++ b/_includes/footer @@ -16,15 +16,15 @@
- + diff --git a/_includes/pagination b/_includes/pagination index ac3bafc0..975b1626 100644 --- a/_includes/pagination +++ b/_includes/pagination @@ -6,9 +6,9 @@ {% comment %} Link for previous page {% endcomment %} {% if paginator.previous_page %} {% if paginator.previous_page == 1 %} -
  • Previous
  • +
  • {{ site.data.ui-text.locale[site.locale].pagination_previous }}
  • {% else %} -
  • Previous
  • +
  • {{ site.data.ui-text.locale[site.locale].pagination_previous }}
  • {% endif %} {% endif %} @@ -36,10 +36,10 @@ {% if index == paginator.page %}
  • {{ index }}
  • {% 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 %}
  • {{ index }}
  • @@ -59,7 +59,7 @@ {% comment %}Link next page{% endcomment %} {% if paginator.next_page %} -
  • Next
  • +
  • {{ site.data.ui-text.locale[site.locale].pagination_next }}
  • {% endif %} diff --git a/_includes/social-share b/_includes/social-share index e2662182..ee72890f 100644 --- a/_includes/social-share +++ b/_includes/social-share @@ -1,5 +1,5 @@
    -

    Share on

    +

    {{ site.data.ui-text.locale[site.locale].share_on }}