Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #2601 from getnikola/archive-improvements
Browse files Browse the repository at this point in the history
Improving friendly archive names.
  • Loading branch information
Kwpolska committed Dec 25, 2016
2 parents c81a222 + 493ac54 commit 6076df5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
2 changes: 2 additions & 0 deletions nikola/data/themes/base/messages/messages_en.py
Expand Up @@ -41,4 +41,6 @@
"Write your post here.": "Write your post here.",
"old posts, page %d": "old posts, page %d",
"page %d": "page %d",
"{month} {day}, {year}": "{month} {day}, {year}",
"{month} {year}": "{month} {year}",
}
16 changes: 13 additions & 3 deletions nikola/plugins/task/archive.py
Expand Up @@ -97,10 +97,20 @@ def get_classification_friendly_name(self, classification, lang, only_last_compo
elif len(classification) == 1:
return classification[0]
elif len(classification) == 2:
return nikola.utils.LocaleBorg().get_month_name(int(classification[1]), lang)
month = nikola.utils.LocaleBorg().get_month_name(int(classification[1]), lang)
if only_last_component:
return month
else:
year = classification[0]
return self.site.MESSAGES[lang]['{month} {year}'].format(year=year, month=month)
else:
# Fallback
return '/'.join(classification)
day = int(classification[2])
if only_last_component:
return str(day)
else:
year = classification[0]
month = nikola.utils.LocaleBorg().get_month_name(int(classification[1]), lang)
return self.site.MESSAGES[lang]['{month} {day}, {year}'].format(year=year, month=month, day=day)

def get_path(self, classification, lang, dest_type='page'):
"""A path handler for the given classification."""
Expand Down
8 changes: 8 additions & 0 deletions translations/nikola.messages/en.po
Expand Up @@ -146,3 +146,11 @@ msgstr "Posts by %s"

msgid "Toggle navigation"
msgstr "Toggle navigation"

#. Used to format months per year
msgid "{month} {year}"
msgstr "{month} {year}"

#. Used to format a date
msgid "{month} {day}, {year}"
msgstr "{month} {day}, {year}"

0 comments on commit 6076df5

Please sign in to comment.