Browse Source

Add support of article translation

Close #87
Talha Mansoor 11 years ago
parent
commit
d3a60bdadc
2 changed files with 12 additions and 0 deletions
  1. 10 0
      templates/_includes/translations.html
  2. 2 0
      templates/article.html

+ 10 - 0
templates/_includes/translations.html

@@ -0,0 +1,10 @@
+{% macro translations_for(article) %}
+{% if article.translations %}
+<p id="list-of-translations">
+This post is also available in:
+    {% for translation in article.translations %}
+    <a href="{{ SITEURL }}/{{ translation.url }}">{{ translation.lang }}</a>{%if not loop.last %}, {% else %}.{% endif %}
+    {% endfor %}
+</p>
+{% endif %}
+{% endmacro %}

+ 2 - 0
templates/article.html

@@ -37,6 +37,8 @@
         <div class="span8 offset2 article-content">
         <div class="span8 offset2 article-content">
             {% endif %}
             {% endif %}
 
 
+            {% import '_includes/translations.html' as translations with context %}
+            {{ translations.translations_for(article) }}
             {{ article.content }}
             {{ article.content }}
             {% from '_includes/comments.html' import comments with context %}
             {% from '_includes/comments.html' import comments with context %}
             {{ comments(article) }}
             {{ comments(article) }}