forked from github/pelican
refactored utils.strftime
This commit is contained in:
parent
a6167f64f1
commit
48f7132ba8
3 changed files with 117 additions and 44 deletions
|
|
@ -10,6 +10,7 @@ from six import StringIO
|
|||
import logging
|
||||
from logging.handlers import BufferingHandler
|
||||
import unittest
|
||||
import locale
|
||||
|
||||
from functools import wraps
|
||||
from contextlib import contextmanager
|
||||
|
|
@ -148,6 +149,18 @@ def module_exists(module_name):
|
|||
return True
|
||||
|
||||
|
||||
def locale_available(locale_):
|
||||
old_locale = locale.setlocale(locale.LC_TIME)
|
||||
|
||||
try:
|
||||
locale.setlocale(locale.LC_TIME, str(locale_))
|
||||
except locale.Error:
|
||||
return False
|
||||
else:
|
||||
locale.setlocale(locale.LC_TIME, old_locale)
|
||||
return True
|
||||
|
||||
|
||||
def get_settings():
|
||||
settings = _DEFAULT_CONFIG.copy()
|
||||
settings['DIRECT_TEMPLATES'] = ['archives']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue