Skip to content
Permalink
Browse files

Making INDEX_PATH, RSS_PATH and AUTHOR_PATH translatable (fixes #1914).

  • Loading branch information...
felixfontein committed Dec 5, 2016
1 parent 122380a commit 9c4f0d374b924d2b4edc986442197d0ee481d0a1
Showing with 12 additions and 4 deletions.
  1. +2 −0 CHANGES.txt
  2. +3 −0 nikola/conf.py.in
  3. +3 −0 nikola/nikola.py
  4. +2 −2 nikola/plugins/task/authors.py
  5. +2 −2 nikola/plugins/task/indexes.py
@@ -31,6 +31,8 @@ Features
have been converted to the new system. (Issue #2107)
* Added ``CATEGORIES_INDEX_PATH``, similar to ``TAGS_INDEX_PATH``.
(Issue #2567)
* Made ``INDEX_PATH``, ``RSS_PATH`` and ``AUTHOR_PATH`` translatable.
(Issue #1914)

New in v7.8.1
=============
@@ -389,6 +389,7 @@ HIDDEN_CATEGORIES = []
# output / TRANSLATION[lang] / AUTHOR_PATH / index.html (list of tags)
# output / TRANSLATION[lang] / AUTHOR_PATH / author.html (list of posts for a tag)
# output / TRANSLATION[lang] / AUTHOR_PATH / author.xml (RSS feed for a tag)
# (translatable)
# AUTHOR_PATH = "authors"

# If AUTHOR_PAGES_ARE_INDEXES is set to True, each author's page will contain
@@ -413,6 +414,7 @@ HIDDEN_AUTHORS = ['Guest']

# Final location for the main blog page and sibling paginated pages is
# output / TRANSLATION[lang] / INDEX_PATH / index-*.html
# (translatable)
# INDEX_PATH = ""

# Optional HTML that displayed on “main” blog index.html files.
@@ -461,6 +463,7 @@ USE_BASE_TAG = False

# Final location for the blog main RSS feed is:
# output / TRANSLATION[lang] / RSS_PATH / rss.xml
# (translatable)
# RSS_PATH = ""

# Slug the Tag URL. Easier for users to type, special characters are
@@ -657,6 +657,9 @@ def __init__(self, **config):
'TAGS_INDEX_PATH',
'CATEGORY_PATH',
'CATEGORIES_INDEX_PATH',
'INDEX_INDEX_PATH',
'RSS_INDEX_PATH',
'AUTHOR_INDEX_PATH',
'DATE_FORMAT',
'JS_DATE_FORMAT',
)
@@ -73,15 +73,15 @@ def get_classification_friendly_name(self, author, lang, only_last_component=Fal

def get_overview_path(self, lang, dest_type='page'):
"""A path handler for the list of all classifications."""
return [self.site.config['AUTHOR_PATH']], 'always'
return [self.site.config['AUTHOR_PATH'][lang]], 'always'

def get_path(self, author, lang, dest_type='page'):
"""A path handler for the given classification."""
if self.site.config['SLUG_AUTHOR_PATH']:
slug = utils.slugify(author, lang)
else:
slug = author
return [self.site.config['AUTHOR_PATH'], slug], 'auto'
return [self.site.config['AUTHOR_PATH'][lang], slug], 'auto'

def provide_overview_context_and_uptodate(self, lang):
"""Provide data for the context and the uptodate list for the list of all classifiations."""
@@ -69,7 +69,7 @@ def get_classification_friendly_name(self, classification, lang, only_last_compo
def get_path(self, classification, lang, dest_type='page'):
"""A path handler for the given classification."""
if dest_type == 'rss':
return [self.site.config['RSS_PATH']], True
return [self.site.config['RSS_PATH'][lang]], True
# 'page' (index) or 'feed' (Atom)
page_number = None
if dest_type == 'page':
@@ -78,7 +78,7 @@ def get_path(self, classification, lang, dest_type='page'):
page_number = int(classification)
except:
pass
return [self.site.config['INDEX_PATH']], 'always', page_number
return [self.site.config['INDEX_PATH'][lang]], 'always', page_number

def provide_context_and_uptodate(self, classification, lang, node=None):
"""Provide data for the context and the uptodate list for the list of the given classifiation."""

0 comments on commit 9c4f0d3

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