Fix translation feature. Add translation support to the notmyidea theme.

This commit is contained in:
Alexis Metaireau 2011-01-05 16:22:52 +01:00
commit 79576f25b6
9 changed files with 33 additions and 40 deletions

View file

@ -16,7 +16,7 @@ class Page(object):
self.status = "published" # default value
for key, value in metadatas.items():
setattr(self, key, value)
setattr(self, key.lower(), value)
if not hasattr(self, 'author'):
if 'AUTHOR' in settings:

View file

@ -7,18 +7,7 @@
rel="bookmark" title="Permalink to {{ article.title }}">{{ article.title
}}</a></h1> {% include 'twitter.html' %} </header>
<div class="entry-content">
<footer class="post-info">
<abbr class="published" title="{{ article.date.isoformat() }}">
{{ article.date.strftime('%a %d %B %Y') }}
</abbr>
{% if article.author %}
<address class="vcard author">
By <a class="url fn" href="#">{{ article.author }}</a>
</address>
{% endif %}
<p>In <a href="{{ SITEURL }}/category/{{ article.category }}.html">{{ article.category }}</a>.
{% include 'taglist.html' %}
</footer><!-- /.post-info -->
{% include 'article_infos.html' %}
{{ article.content }}
</div><!-- /.entry-content -->
{% if DISQUS_SITENAME %}

View file

@ -0,0 +1,14 @@
<footer class="post-info">
<abbr class="published" title="{{ article.date.isoformat() }}">
{{ article.date.strftime('%a %d %B %Y') }}
</abbr>
{% if article.author %}
<address class="vcard author">
By <a class="url fn" href="#">{{ article.author }}</a>
</address>
{% endif %}
<p>In <a href="{{ SITEURL }}/category/{{ article.category }}.html">{{ article.category }}</a>. {% if PDF_PROCESSOR %}<a href="{{ SITEURL }}/pdf/{{ article.slug }}.pdf">get the pdf</a>{% endif %}</p>
{% include 'taglist.html' %}
{% include 'translations.html' %}
</footer><!-- /.post-info -->

View file

@ -7,19 +7,7 @@
<aside id="featured" class="body"><article>
<h1 class="entry-title"><a href="{{ SITEURL }}/{{ article.url
}}">{{ article.title }}</a></h1>
<footer class="post-info">
<abbr class="published" title="{{ article.date.isoformat() }}">
{{ article.date.strftime('%a %d %B %Y') }}
</abbr>
{% if article.author %}
<address class="vcard author">
By <a class="url fn" href="#">{{ article.author }}</a>
</address>
{% endif %}
<p>In <a href="{{ SITEURL }}/category/{{ article.category }}.html">{{ article.category }}</a>. {% if PDF_PROCESSOR %}<a href="{{ SITEURL }}/pdf/{{ article.slug }}.pdf">get the pdf</a>{% endif %}</p>
{% include 'taglist.html' %}
</footer><!-- /.post-info -->
{% include 'article_infos.html' %}
{{ article.content }}
{% include 'comments.html' %}
</article>
@ -37,18 +25,7 @@
</header>
<div class="entry-content">
<footer class="post-info">
<abbr class="published" title="{{ article.date.isoformat() }}">
{{ article.date.strftime('%a %d %B %Y') }}
</abbr>
<address class="vcard author">
By <a class="url fn" href="#">{{ article.author }}</a>
</address>
<p> In <a href="{{ SITEURL }}/category/{{ article.category }}.html">{{ article.category }}</a></p>
{% include 'taglist.html' %}
<p>{% if PDF_PROCESSOR %}<a href="{{ SITEURL }}/pdf/{{ article.slug }}.pdf">pdf</a>{% endif %}</p>
</footer><!-- /.post-info -->
{% include 'article_infos.html' %}
{{ article.summary }}
<a class="readmore" href="{{ SITEURL }}/{{ article.url }}">read more</a>
{% include 'comments.html' %}

View file

@ -0,0 +1,6 @@
{% if article.translations %}
Translations:
{% for translation in article.translations %}
<a href="{{ SITEURL }}/{{ translation.url }}">{{ translation.lang }}</a>
{% endfor %}
{% endif %}

View file

@ -159,6 +159,7 @@ def process_translations(content_list):
Also, for each content_list item, it
sets attribute 'translations'
"""
content_list.sort(key=attrgetter('slug'))
grouped_by_slugs = groupby(content_list, attrgetter('slug'))
index = []
translations = []

View file

@ -0,0 +1,6 @@
Oh yeah !
#########
:lang: fr
Et voila du contenu en français

View file

@ -1,5 +1,5 @@
Oh yeah !
#########################
#########
:tags: oh, bar, yeah
:date: 2010-10-20 10:14

View file

@ -25,7 +25,7 @@ And here comes the cool stuff_.
.. code-block:: python
>>> from ipdb import set trace
>>> from ipdb import set_trace
>>> set_trace()
→ And now try with some utf8 hell: ééé