diff --git a/docs/settings.rst b/docs/settings.rst
index 404b7f68..c1e24671 100644
--- a/docs/settings.rst
+++ b/docs/settings.rst
@@ -31,7 +31,10 @@ Setting name what it does ?
(no rss)
`CSS_FILE` To specify the CSS file you want to load, if it's not
the default one ('main.css')
+`DATE_FORMATS` If you do manage multiple languages, you can set
+ the date formatting here.
`DEFAULT_CATEGORY` The default category to fallback on. `misc` by default.
+`DEFAULT_DATE_FORMAT` The default date format you want to use.
`DEFAULT_LANG` The default language to use. Default is 'en'.
`DISPLAY_PAGES_ON_MENU` Display or not the pages on the menu of the template.
Templates can follow or not this settings.
@@ -46,6 +49,7 @@ Setting name what it does ?
Default is no extensions (the empty list).
`KEEP_OUTPUT_DIRECTORY` Keep the output directory and just update all the
generated files.
+`LOCALE` Change the locale. Default is the system locale.
Default is to delete the output directory.
`MARKUP` A list of available markup languages you want to use.
For the moment, only available values are `rst` and `md`.
diff --git a/pelican/contents.py b/pelican/contents.py
index b6e71b75..1ace659f 100644
--- a/pelican/contents.py
+++ b/pelican/contents.py
@@ -47,6 +47,15 @@ class Page(object):
if filename:
self.filename = filename
+ if not hasattr(self, 'date_format'):
+ if self.lang in settings['DATE_FORMATS']:
+ self.date_format = settings['DATE_FORMATS'][self.lang]
+ else:
+ self.date_format = settings['DEFAULT_DATE_FORMAT']
+
+ # store the settings ref.
+ self._settings = settings
+
def check_properties(self):
"""test that each mandatory property is set."""
for prop in self.mandatory_properties:
@@ -65,6 +74,11 @@ class Page(object):
def summary(self):
return truncate_html_words(self.content, 50)
+ @property
+ def locale_date(self):
+ return self.date.strftime(self.date_format)
+
+
class Article(Page):
mandatory_properties = ('title', 'date', 'category')
diff --git a/pelican/settings.py b/pelican/settings.py
index 3fd0a6da..3070ad15 100644
--- a/pelican/settings.py
+++ b/pelican/settings.py
@@ -1,4 +1,5 @@
import os
+import locale
_DEFAULT_THEME = os.sep.join([os.path.dirname(os.path.abspath(__file__)),
"themes/notmyidea"])
@@ -24,7 +25,10 @@ _DEFAULT_CONFIG = {'PATH': None,
'RELATIVE_URLS': True,
'DEFAULT_LANG': 'en',
'PELICAN_CLASS': 'pelican.Pelican',
+ 'DEFAULT_DATE_FORMAT': '%a %d %B %Y',
+ 'DATE_FORMATS': {},
'JINJA_EXTENSIONS': [],
+ 'LOCALE': '', # default to user locale
}
def read_settings(filename):
@@ -37,4 +41,7 @@ def read_settings(filename):
for key in tempdict:
if key.isupper():
context[key] = tempdict[key]
+
+ # set the locale
+ locale.setlocale(locale.LC_ALL, context['LOCALE'])
return context
diff --git a/pelican/themes/brownstone/templates/archives.html b/pelican/themes/brownstone/templates/archives.html
index a023ecee..5adaacb6 100644
--- a/pelican/themes/brownstone/templates/archives.html
+++ b/pelican/themes/brownstone/templates/archives.html
@@ -6,7 +6,7 @@