mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Enables custom locale while feed generation.
Fixes wrong language of month names in feed links. Related to #1198
This commit is contained in:
parent
cb11bea1f2
commit
5ea3a36a3f
1 changed files with 30 additions and 33 deletions
|
|
@ -93,9 +93,7 @@ class Writer(object):
|
||||||
"""
|
"""
|
||||||
if not is_selected_for_writing(self.settings, path):
|
if not is_selected_for_writing(self.settings, path):
|
||||||
return
|
return
|
||||||
old_locale = locale.setlocale(locale.LC_ALL)
|
|
||||||
locale.setlocale(locale.LC_ALL, str('C'))
|
|
||||||
try:
|
|
||||||
self.site_url = context.get(
|
self.site_url = context.get(
|
||||||
'SITEURL', path_to_url(get_relative_path(path)))
|
'SITEURL', path_to_url(get_relative_path(path)))
|
||||||
|
|
||||||
|
|
@ -124,8 +122,7 @@ class Writer(object):
|
||||||
|
|
||||||
signals.feed_written.send(complete_path, context=context, feed=feed)
|
signals.feed_written.send(complete_path, context=context, feed=feed)
|
||||||
return feed
|
return feed
|
||||||
finally:
|
|
||||||
locale.setlocale(locale.LC_ALL, old_locale)
|
|
||||||
|
|
||||||
def write_file(self, name, template, context, relative_urls=False,
|
def write_file(self, name, template, context, relative_urls=False,
|
||||||
paginated=None, override_output=False, **kwargs):
|
paginated=None, override_output=False, **kwargs):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue