diff options
author | Doug Hellmann <doug@doughellmann.com> | 2016-07-27 11:35:04 -0400 |
---|---|---|
committer | Doug Hellmann <doug@doughellmann.com> | 2016-07-27 11:35:04 -0400 |
commit | b40925328e5ba9e87be42bab1ec3a41bf3d81f78 (patch) | |
tree | 6d86c1d8af7322dc95e16e570afdfbaa74bd181d | |
parent | cdfe1c9028a99caf8f104ef76329292a0e4c9625 (diff) | |
download | oslo-config-b40925328e5ba9e87be42bab1ec3a41bf3d81f78.tar.gz |
disable lazy translation in sphinx extension3.14.0
The sphinx extension depends on all of the help text associated with an
option being regular strings. When oslo_i18n's lazy translation feature
is turned on, the marker functions return Message objects that do not
support all of the features of strings. Add a step to turn off lazy
evaluation when the oslo_context.sphinxext extension is activated.
Change-Id: Icaec4691135cd07d96994f01498e0f9d2e09af58
Closes-Bug: #1605648
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
-rw-r--r-- | oslo_config/sphinxext.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/oslo_config/sphinxext.py b/oslo_config/sphinxext.py index a7efb87..20a44f8 100644 --- a/oslo_config/sphinxext.py +++ b/oslo_config/sphinxext.py @@ -25,6 +25,7 @@ from sphinx.util.nodes import nested_parse_with_titles from oslo_config import cfg from oslo_config import generator +import oslo_i18n import six @@ -432,5 +433,14 @@ class ConfigDomain(Domain): def setup(app): + # NOTE(dhellmann): Try to turn off lazy translation from oslo_i18n + # so any translated help text or deprecation messages associated + # with configuration options are treated as regular strings + # instead of Message objects. Unfortunately this is a bit + # order-dependent, and so it's still possible that importing code + # from another module such as through the autodoc features, or + # even through the plugin scanner, will turn lazy evaluation back + # on. + oslo_i18n.enable_lazy(False) app.add_directive('show-options', ShowOptionsDirective) app.add_domain(ConfigDomain) |