Skip to content
Permalink
Browse files

Adding tag/category/section translations. Adding default author trans…

…lations. Unifying some variables for taxonomy pages.
  • Loading branch information
felixfontein committed May 21, 2017
1 parent 8c59277 commit 49c741f2aeb4a6aac3d71bb3e70cd7c925419a02
@@ -250,6 +250,7 @@ Classification pages (lists)
================================== ============== =============================================================
Name Type Description
================================== ============== =============================================================
``kind`` str The classification name
``items`` list? List of items for ``list.tmpl`` *(title, permalink, None)*
``posts`` list<Post>? List of items for other templates
``kind`` str The classification name
@@ -303,6 +304,7 @@ The archive navigation variables are available only if ``create_archive_navigati
============================== ============== ========================================================================
Name Type Description
============================== ============== ========================================================================
``kind`` str Always ``"archive"``
``archive_name`` str? Name of the archive (only if using indexes)
``create_archive_navigation`` bool ``CREATE_ARCHIVE_NAVIGATION`` setting
``has_archive_navigation`` bool Whether or not archive navigation is available
@@ -313,7 +315,7 @@ Name Type Description
``next_archive`` str? Link to the next archive
``next_archive_name`` str? Name of the next archive
``archive_nodelevel`` int? Level of the archive
``other_archive_languages`` list List of tuples ``(lang, path, name)`` of same archive in other languages
``other_languages`` list List of tuples ``(lang, path, name)`` of same archive in other languages
============================== ============== ========================================================================


@@ -322,29 +324,32 @@ Variables available in author pages

.. class:: table table-bordered table-striped

============== ====== ============================
Name Type Description
============== ====== ============================
``author`` str Author name
``rss_link`` str Link to RSS (HTML fragment)
============== ====== ============================
=================== =========== =========================================================================
Name Type Description
=================== =========== =========================================================================
``kind`` str Always ``"author"``
``author`` str Author name
``rss_link`` str Link to RSS (HTML fragment)
``other_languages`` list<tuple> List of tuples ``(lang, author, name)`` of same author in other languages
=================== =========== =========================================================================


Variables available in category pages
-------------------------------------

.. class:: table table-bordered table-striped

================== ========== =====================================================
Name Type Description
================== ========== =====================================================
``kind`` str Always ``"category"``
``category`` str Category name
``category_path`` list<str> Category hierarchy
``rss_link`` str? Link to RSS (HTML fragment, only if using indexes)
``subcategories`` list List of subcategories (contains *name, link* tuples)
``tag`` str Friendly category name
================== ========== =====================================================
=================== =========== =============================================================================
Name Type Description
=================== =========== =============================================================================
``kind`` str Always ``"category"``
``category`` str Category name
``category_path`` list<str> Category hierarchy
``rss_link`` str? Link to RSS (HTML fragment, only if using indexes)
``subcategories`` list List of subcategories (contains *name, link* tuples)
``tag`` str Friendly category name
``other_languages`` list<tuple> List of tuples ``(lang, category, name)`` of same category in other languages
=================== =========== =============================================================================

Variables available in galleries
--------------------------------
@@ -380,17 +385,30 @@ Name Type Description
``source_link`` str Link to the source file
================== ========== ========================================

Variables available in section pages
------------------------------------

.. class:: table table-bordered table-striped

=================== =========== ===========================================================================
Name Type Description
=================== =========== ===========================================================================
``kind`` str Always ``"section"``
``other_languages`` list<tuple> List of tuples ``(lang, section, name)`` of same section in other languages
=================== =========== ===========================================================================

Variables available in tag pages
--------------------------------

.. class:: table table-bordered table-striped

========= ===== =================
Name Type Description
========= ===== =================
``kind`` str Always ``"tag"``
``tag`` str Tag name
========= ===== =================
=================== =========== ===================================================================
Name Type Description
=================== =========== ===================================================================
``kind`` str Always ``"tag"``
``tag`` str Tag name
``other_languages`` list<tuple> List of tuples ``(lang, tag, name)`` of same tag in other languages
=================== =========== ===================================================================

Variables available in the “Tags and categories” page (``tags.tmpl``)
---------------------------------------------------------------------
@@ -292,6 +292,19 @@ POSTS_SECTIONS = True
# },
# }

# A list of dictionaries specifying sections which translate to each other.
# For example:
# [
# {'en': 'private', 'de': 'Privat'},
# {'en': 'business', 'fr': 'Arbeit'},
# ]
# SECTION_TRANSLATIONS = []

# If set to True, a section in a language will be treated as a translation
# of the literally same section in all other languages. Enable this if you
# do not translate sections, for example.
# SECTION_TRANSLATIONS_ADD_DEFAULTS = False

# Paths for different autogenerated bits. These are combined with the
# translation paths.

@@ -343,6 +356,25 @@ HIDDEN_TAGS = ['mathjax']
# However, more obscure tags can be hidden from the tag index page.
# TAGLIST_MINIMUM_POSTS = 1

# A list of dictionaries specifying tags which translate to each other.
# For example:
# [
# {'en': 'car', 'de': 'Auto'},
# {'en': 'window', 'fr': 'fenêtre'},
# ]
# Note that tags in the same language can appear more than once, for
# example if they have different meaning:
# [
# {'en': 'cloud', 'de': 'Wolke'}, # the fluffy thing in the sky
# {'en': 'cloud', 'de': 'Cloud'}, # cloud computing
# ]
# TAG_TRANSLATIONS = []

# If set to True, a tag in a language will be treated as a translation
# of the literally same tag in all other languages. Enable this if you
# do not translate tags, for example.
# TAG_TRANSLATIONS_ADD_DEFAULTS = False

# Final locations are:
# output / TRANSLATION[lang] / CATEGORY_PATH / index.html (list of categories)
# output / TRANSLATION[lang] / CATEGORY_PATH / CATEGORY_PREFIX category.html (list of posts for a category)
@@ -396,6 +428,19 @@ CATEGORY_OUTPUT_FLAT_HIERARCHY = ${CATEGORY_OUTPUT_FLAT_HIERARCHY}
# Category pages will still be generated.
HIDDEN_CATEGORIES = []

# A list of dictionaries specifying categories which translate to each other.
# For example:
# [
# {'en': 'private', 'de': 'Privat'},
# {'en': 'business', 'fr': 'Arbeit'},
# ]
# CATEGORY_TRANSLATIONS = []

# If set to True, a category in a language will be treated as a translation
# of the literally same category in all other languages. Enable this if you
# do not translate categories, for example.
# CATEGORY_TRANSLATIONS_ADD_DEFAULTS = False

# If ENABLE_AUTHOR_PAGES is set to True and there is more than one
# author, author pages are generated.
# ENABLE_AUTHOR_PAGES = True
@@ -23,13 +23,5 @@
</ul>
</nav>
{% endif %}
{% if other_archive_languages %}
<div class="translationslist translations">
<h3 class="translationslist-intro">{{ messages("Also available in:") }}</h3>
{% for language, archive_path, _ in other_archive_languages %}
<p><a href="{{ _link('archive', archive_path, language) }}" rel="alternate">{{ messages("LANGUAGE", language) }}</a></p>
{% endfor %}
</div>
{% endif %}
{% endif %}
{% endmacro %}
@@ -11,11 +11,9 @@
{% elif generate_atom %}
<link rel="alternate" type="application/atom+xml" title="Atom for the {{ archive_name }} archive" href="{{ _link("archive_atom", archive_name) }}">
{% endif %}
{% for language, archive_path, _ in other_archive_languages %}
<link rel="alternate" hreflang="{{ language }}" href="{{ _link('archive', archive_path, language) }}">
{% endfor %}
{% endblock %}

{% block content_header %}
{{ archive_nav.archive_navigation() }}
{{ parent.content_header() }}
{% endblock %}
@@ -11,10 +11,24 @@
<link rel="prefetch" href="{{ posts[0].permalink() }}" type="text/html">
{% endif %}
{{ math.math_styles_ifposts(posts) }}
{% if other_languages is defined and other_languages %}
{% for language, classification, _ in other_languages %}
<link rel="alternate" hreflang="{{ language }}" href="{{ _link(kind, classification, language) }}">
{% endfor %}
{% endif %}
{% endblock %}

{% block content %}
{% block content_header %}{% endblock %}
{% block content_header %}
{% if other_languages is defined and other_languages %}
<div class="translationslist translations">
<h3 class="translationslist-intro">{{ messages("Also available in:") }}</h3>
{% for language, classification, name in other_languages %}
<p><a href="{{ _link(kind, classification, language) }}" rel="alternate">{{ messages("LANGUAGE", language) }} ({{ name|e }})</a></p>
{% endfor %}
</div>
{% endif %}
{% endblock %}
{% if 'main_index' in pagekind %}
{{ front_index_header }}
{% endif %}
@@ -3,11 +3,11 @@
{% import 'archive_navigation_helper.tmpl' as archive_nav with context %}

{% block extra_head %}
{% if 'archive_page' in pagekind %}
{% for language, archive_path, _ in other_archive_languages %}
<link rel="alternate" hreflang="{{ language }}" href="{{ _link('archive', archive_path, language) }}">
{% endfor %}
{% endif %}
{% if other_languages is defined and other_languages %}
{% for language, classification, _ in other_languages %}
<link rel="alternate" hreflang="{{ language }}" href="{{ _link(kind, classification, language) }}">
{% endfor %}
{% endif %}
{% endblock %}

{% block content %}
@@ -16,6 +16,14 @@
<h1>{{ title|e }}</h1>
</header>
{{ archive_nav.archive_navigation() }}
{% if other_languages is defined and other_languages %}
<div class="translationslist translations">
<h3 class="translationslist-intro">{{ messages("Also available in:") }}</h3>
{% for language, classification, name in other_languages %}
<p><a href="{{ _link(kind, classification, language) }}" rel="alternate">{{ messages("LANGUAGE", language) }} ({{ name|e }})</a></p>
{% endfor %}
</div>
{% endif %}
{% if items %}
<ul class="postlist">
{% for text, link, count in items %}
@@ -3,11 +3,11 @@
{% import 'archive_navigation_helper.tmpl' as archive_nav with context %}

{% block extra_head %}
{% if 'archive_page' in pagekind %}
{% for language, archive_path, _ in other_archive_languages %}
<link rel="alternate" hreflang="{{ language }}" href="{{ _link('archive', archive_path, language) }}">
{% endfor %}
{% endif %}
{% if other_languages is defined and other_languages %}
{% for language, classification, _ in other_languages %}
<link rel="alternate" hreflang="{{ language }}" href="{{ _link(kind, classification, language) }}">
{% endfor %}
{% endif %}
{% endblock %}

{% block content %}
@@ -16,6 +16,14 @@
<h1>{{ title|e }}</h1>
</header>
{{ archive_nav.archive_navigation() }}
{% if other_languages is defined and other_languages %}
<div class="translationslist translations">
<h3 class="translationslist-intro">{{ messages("Also available in:") }}</h3>
{% for language, classification, name in other_languages %}
<p><a href="{{ _link(kind, classification, language) }}" rel="alternate">{{ messages("LANGUAGE", language) }} ({{ name|e }})</a></p>
{% endfor %}
</div>
{% endif %}
{% if posts %}
<ul class="postlist">
{% for post in posts %}
@@ -39,6 +39,14 @@
<p class="feedlink"><a href="{{ _link(kind + "_rss", tag) }}" type="application/rss+xml">{{ messages('RSS feed') }}</a></p>
{% endif %}
</div>
{% if other_languages is defined and other_languages %}
<div class="translationslist translations">
<h3 class="translationslist-intro">{{ messages("Also available in:") }}</h3>
{% for language, classification, name in other_languages %}
<p><a href="{{ _link(kind, classification, language) }}" rel="alternate">{{ messages("LANGUAGE", language) }} ({{ name|e }})</a></p>
{% endfor %}
</div>
{% endif %}
</header>
{% if posts %}
<ul class="postlist">
@@ -2,6 +2,7 @@
{% extends 'index.tmpl' %}

{% block content_header %}
{{ parent.content_header() }}
<header>
<h1>{{ title|e }}</h1>
{% if description %}
@@ -23,13 +23,5 @@
</ul>
</nav>
%endif
%if other_archive_languages:
<div class="translationslist translations">
<h3 class="translationslist-intro">${messages("Also available in:")}</h3>
%for language, archive_path, _ in other_archive_languages:
<p><a href="${_link('archive', archive_path, language)}" rel="alternate">${messages("LANGUAGE", language)}</a></p>
%endfor
</div>
%endif
% endif
</%def>
@@ -11,11 +11,9 @@
%elif generate_atom:
<link rel="alternate" type="application/atom+xml" title="Atom for the ${archive_name} archive" href="${_link("archive_atom", archive_name)}">
%endif
%for language, archive_path, _ in other_archive_languages:
<link rel="alternate" hreflang="${language}" href="${_link('archive', archive_path, language)}">
%endfor
</%block>

<%block name="content_header">
${archive_nav.archive_navigation()}
${parent.content_header()}
</%block>
@@ -11,10 +11,24 @@
<link rel="prefetch" href="${posts[0].permalink()}" type="text/html">
% endif
${math.math_styles_ifposts(posts)}
%if other_languages is not UNDEFINED and other_languages:
%for language, classification, _ in other_languages:
<link rel="alternate" hreflang="${language}" href="${_link(kind, classification, language)}">
%endfor
%endif
</%block>

<%block name="content">
<%block name="content_header"></%block>
<%block name="content_header">
%if other_languages is not UNDEFINED and other_languages:
<div class="translationslist translations">
<h3 class="translationslist-intro">${messages("Also available in:")}</h3>
%for language, classification, name in other_languages:
<p><a href="${_link(kind, classification, language)}" rel="alternate">${messages("LANGUAGE", language)} (${name|h})</a></p>
%endfor
</div>
%endif
</%block>
% if 'main_index' in pagekind:
${front_index_header}
% endif

0 comments on commit 49c741f

Please sign in to comment.
You can’t perform that action at this time.