1
0
Fork 0
forked from github/pelican

Localize default lang and timezone in pelican-quickstart

Fixes #1971.
This commit is contained in:
Nicolas Stinus 2016-06-04 09:00:17 -04:00
commit c1a5279da9
2 changed files with 19 additions and 4 deletions

View file

@ -28,8 +28,9 @@ by asking some questions about your site::
pelican-quickstart pelican-quickstart
For questions that have default values denoted in brackets, feel free to use For questions that have default values denoted in brackets, feel free to use
the Return key to accept those default values. When asked for your URL prefix, the Return key to accept those default values [#tzlocal_fn]_. When asked for
enter your domain name as indicated (e.g., ``http://example.com``). your URL prefix, enter your domain name as indicated (e.g.,
``http://example.com``).
Create an article Create an article
----------------- -----------------
@ -72,3 +73,10 @@ Continue reading the other documentation sections for more detail, and check out
the Pelican wiki's Tutorials_ page for links to community-published tutorials. the Pelican wiki's Tutorials_ page for links to community-published tutorials.
.. _Tutorials: https://github.com/getpelican/pelican/wiki/Tutorials .. _Tutorials: https://github.com/getpelican/pelican/wiki/Tutorials
Footnotes
---------
.. [#tzlocal_fn] You can help localize default fields by installing the
optional `tzlocal <https://pypi.python.org/pypi/tzlocal>`_
module.

View file

@ -4,12 +4,19 @@ from __future__ import print_function, unicode_literals
import argparse import argparse
import codecs import codecs
import locale
import os import os
import string import string
import sys import sys
import pytz import pytz
try:
import tzlocal
_DEFAULT_TIMEZONE = tzlocal.get_localzone().zone
except:
_DEFAULT_TIMEZONE = 'Europe/Paris'
import six import six
from pelican import __version__ from pelican import __version__
@ -42,8 +49,8 @@ CONF = {
'github_pages_branch': _GITHUB_PAGES_BRANCHES['project'], 'github_pages_branch': _GITHUB_PAGES_BRANCHES['project'],
'default_pagination': 10, 'default_pagination': 10,
'siteurl': '', 'siteurl': '',
'lang': 'en', 'lang': locale.getlocale()[0].split('_')[0],
'timezone': 'Europe/Paris' 'timezone': _DEFAULT_TIMEZONE
} }
# url for list of valid timezones # url for list of valid timezones