Skip to content

Commit 13b1a3c

Browse files
committed
Sphinx 1.6 compatibility
1 parent 3275b8a commit 13b1a3c

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

sphinx_rtd_theme/__init__.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,23 @@
66

77
from os import path
88
import pkg_resources
9-
from sphinx.util import logging
10-
from sphinx.locale import get_translation
9+
10+
from sphinx.locale import _
1111

1212
import sphinx
1313

14+
try:
15+
# Available from Sphinx 1.6
16+
from sphinx.util.logging import getLogger
17+
except ImportError:
18+
from logging import getLogger
19+
1420

1521
__version__ = '0.4.3.dev0'
1622
__version_full__ = __version__
1723

18-
logger = logging.getLogger('sphinx-rtd-theme')
19-
MESSAGE_CATALOG_NAME = 'sphinx'
20-
_ = get_translation(MESSAGE_CATALOG_NAME)
2124

25+
logger = getLogger(__name__)
2226

2327
def get_html_theme_path():
2428
"""Return list of HTML theme paths."""
@@ -31,6 +35,7 @@ def setup(app):
3135
app.add_html_theme('sphinx_rtd_theme', path.abspath(path.dirname(__file__)))
3236

3337
# Warn if a prerelease version of the theme is used
38+
3439
parsed_version = pkg_resources.parse_version(__version__)
3540
if parsed_version.is_prerelease:
3641
logger.warning(_('You are using a pre-release version (%s) of sphinx-rtd-theme.'), __version__)
@@ -41,4 +46,4 @@ def setup(app):
4146
# Add Sphinx message catalog for newer versions of Sphinx
4247
# See http://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx.application.Sphinx.add_message_catalog
4348
rtd_locale_path = path.join(path.abspath(path.dirname(__file__)), 'locale')
44-
app.add_message_catalog(MESSAGE_CATALOG_NAME, rtd_locale_path)
49+
app.add_message_catalog('sphinx', rtd_locale_path)

0 commit comments

Comments
 (0)