Take the localization debug info from GrampsLocale instead of locale

svn: r22025
This commit is contained in:
John Ralls 2013-04-20 23:08:53 +00:00
parent 6400b8b29c
commit 0a6ff725ac

View File

@ -40,7 +40,6 @@ if sys.version_info[0] < 3:
import os import os
import signal import signal
import locale
import logging import logging
LOG = logging.getLogger(".") LOG = logging.getLogger(".")
@ -60,11 +59,12 @@ from .gen.constfunc import win
# #
# Setup logging # Setup logging
# #
# Ideally, this needs to be done before any Gramps modules are imported, so that # Ideally, this needs to be done before any Gramps modules are
# any code that is executed as the modules are imported can log errors or # imported, so that any code that is executed as the modules are
# warnings. Errors and warnings are particularly applicable to TransUtils and # imported can log errors or warnings. const and constfunc have to be
# setting up internationalisation in this module. const and constfunc have to be # imported before this code is executed because they are used in this
# imported before this code is executed because they are used in this code. # code. That unfortunately initializes GrampsLocale, so it has its own
# logging setup during initialization.
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
"""Setup basic logging support.""" """Setup basic logging support."""
@ -401,36 +401,13 @@ def run():
# Calls to LOG must be after setup_logging() and ArgParser() # Calls to LOG must be after setup_logging() and ArgParser()
LOG = logging.getLogger(".locale") LOG = logging.getLogger(".locale")
if hasattr(locale, 'LC_CTYPE'): LOG.debug("Encoding: %s", glocale.encoding)
LOG.debug('Using locale: LC_CTYPE %s %s' % LOG.debug("Translating Gramps to %s", glocale.language[0])
locale.getlocale(locale.LC_CTYPE)) LOG.debug("Collation Locale: %s", glocale.collation)
else: LOG.debug("Date/Time Locale: %s", glocale.calendar)
LOG.debug('locale: LC_CTYPE is not defined') LOG.debug("Currency Locale: %s", glocale.currency)
if hasattr(locale, 'LC_COLLATE'): LOG.debug("Number-format Locale: %s", glocale.numeric)
LOG.debug('Using locale: LC_COLLATE %s %s' %
locale.getlocale(locale.LC_COLLATE))
else:
LOG.debug('locale: LC_COLLATE is not defined')
if hasattr(locale, 'LC_TIME'):
LOG.debug('Using locale: LC_TIME %s %s' %
locale.getlocale(locale.LC_TIME))
else:
LOG.debug('locale: LC_TIME is not defined')
if hasattr(locale, 'LC_MONETARY'):
LOG.debug('Using locale: LC_MONETARY %s %s' %
locale.getlocale(locale.LC_MONETARY))
else:
LOG.debug('locale: LC_MONETARY is not defined')
if hasattr(locale, 'LC_MESSAGES'):
LOG.debug('Using locale: LC_MESSAGES %s %s' %
locale.getlocale(locale.LC_MESSAGES))
else:
LOG.debug('locale: LC_MESSAGES is not defined')
if hasattr(locale, 'LC_NUMERIC'):
LOG.debug('Using locale: LC_NUMERIC %s %s' %
locale.getlocale(locale.LC_NUMERIC))
else:
LOG.debug('locale: LC_NUMERIC is not defined')
if 'LANG' in os.environ: if 'LANG' in os.environ:
LOG.debug('Using LANG: %s' % LOG.debug('Using LANG: %s' %
os.environ.get('LANG')) os.environ.get('LANG'))