mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Fix locale setup in settings.py
This commit is contained in:
parent
44c1fe4840
commit
1c6ea5aab2
2 changed files with 7 additions and 2 deletions
|
|
@ -2,6 +2,8 @@
|
||||||
import os
|
import os
|
||||||
import locale
|
import locale
|
||||||
|
|
||||||
|
from pelican import log
|
||||||
|
|
||||||
DEFAULT_THEME = os.sep.join([os.path.dirname(os.path.abspath(__file__)),
|
DEFAULT_THEME = os.sep.join([os.path.dirname(os.path.abspath(__file__)),
|
||||||
"themes/notmyidea"])
|
"themes/notmyidea"])
|
||||||
_DEFAULT_CONFIG = {'PATH': None,
|
_DEFAULT_CONFIG = {'PATH': None,
|
||||||
|
|
@ -60,6 +62,9 @@ def read_settings(filename):
|
||||||
locales = [locales]
|
locales = [locales]
|
||||||
|
|
||||||
# try to set the different locales, fallback on the default.
|
# try to set the different locales, fallback on the default.
|
||||||
|
if not locales:
|
||||||
|
locales = _DEFAULT_CONFIG['LOCALE']
|
||||||
|
|
||||||
for locale_ in locales:
|
for locale_ in locales:
|
||||||
try:
|
try:
|
||||||
locale.setlocale(locale.LC_ALL, locale_)
|
locale.setlocale(locale.LC_ALL, locale_)
|
||||||
|
|
@ -67,7 +72,7 @@ def read_settings(filename):
|
||||||
except locale.Error:
|
except locale.Error:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
warnings.warn("LOCALE option doesn't contain a correct value")
|
log.warn("LOCALE option doesn't contain a correct value")
|
||||||
|
|
||||||
# set the locale
|
# set the locale
|
||||||
return context
|
return context
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ GITHUB_URL = 'http://github.com/ametaireau/'
|
||||||
DISQUS_SITENAME = "blog-notmyidea"
|
DISQUS_SITENAME = "blog-notmyidea"
|
||||||
PDF_GENERATOR = False
|
PDF_GENERATOR = False
|
||||||
REVERSE_CATEGORY_ORDER = True
|
REVERSE_CATEGORY_ORDER = True
|
||||||
LOCALE = 'fr_FR.utf-8'
|
LOCALE = ""
|
||||||
DEFAULT_PAGINATION = 2
|
DEFAULT_PAGINATION = 2
|
||||||
|
|
||||||
FEED_RSS = 'feeds/all.rss.xml'
|
FEED_RSS = 'feeds/all.rss.xml'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue