diff options
author | Jenkins <jenkins@review.openstack.org> | 2014-08-27 00:54:51 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2014-08-27 00:54:51 +0000 |
commit | 75ea61a87b07137114c8a6df857016ed4c4a668f (patch) | |
tree | 23a645d8cbaf08e525ed156561b64e210d8154ef | |
parent | 106387b6b8b200c5239123f2aa56c383a333f067 (diff) | |
parent | a4fc251e94c94c4a33a218c99271f601dd87b268 (diff) | |
download | oslo-i18n-75ea61a87b07137114c8a6df857016ed4c4a668f.tar.gz |
Merge "Remove mention of Message objects from public docs"
-rw-r--r-- | oslo/i18n/_gettextutils.py | 5 | ||||
-rw-r--r-- | oslo/i18n/log.py | 12 |
2 files changed, 9 insertions, 8 deletions
diff --git a/oslo/i18n/_gettextutils.py b/oslo/i18n/_gettextutils.py index d7ddeb5..466c2c9 100644 --- a/oslo/i18n/_gettextutils.py +++ b/oslo/i18n/_gettextutils.py @@ -45,11 +45,6 @@ def install(domain): NOVA_LOCALEDIR). :param domain: the translation domain - :param lazy: indicates whether or not to install the lazy _() function. - The lazy _() introduces a way to do deferred translation - of messages by installing a _ that builds Message objects, - instead of strings, which can then be lazily translated into - any available locale. """ from six import moves tf = _factory.TranslatorFactory(domain) diff --git a/oslo/i18n/log.py b/oslo/i18n/log.py index a2bd4c8..8ae19e6 100644 --- a/oslo/i18n/log.py +++ b/oslo/i18n/log.py @@ -25,9 +25,15 @@ from oslo.i18n import _translate class TranslationHandler(handlers.MemoryHandler): """Handler that translates records before logging them. - The TranslationHandler takes a locale and a target logging.Handler object - to forward LogRecord objects to after translating them. This handler - depends on Message objects being logged, instead of regular strings. + When lazy translation is enabled in the application (see + :func:`~oslo.i18n.enable_lazy`), the :class:`TranslationHandler` + uses its locale configuration setting to determine how to + translate LogRecord objects before forwarding them to the + logging.Handler. + + When lazy translation is disabled, the message in the LogRecord is + converted to unicode without any changes and then forwarded to the + logging.Handler. The handler can be configured declaratively in the ``logging.conf`` as follows:: |