diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-02-23 14:37:30 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-02-23 15:14:43 +0300 |
commit | ad3edd924cd0a76747a8f8c713f0f3559053b9da (patch) | |
tree | cb2e8eadc47db4b69e60ef65357da395dac5bc0f /sphinx/theming.py | |
parent | faa71ee26d3636ab2aa759635633af701949c5dd (diff) |
Fix #8915: html theme: The translation of sphinx_rtd_theme does not work
Since sphinx_rtd_theme-0.5.0, it supports translations. But Sphinx core
disallows to enable it because theming framework gives special treatment
for the theme for a long time.
This goes to load it via setuptools at first to enable the translations.
Note: The special treatment for sphinx_rtd_theme (< 0.2.5) is not
removed yet. But it will be removed in the future release.
Diffstat (limited to 'sphinx/theming.py')
-rw-r--r-- | sphinx/theming.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/sphinx/theming.py b/sphinx/theming.py index e84f5ae49..bba47b344 100644 --- a/sphinx/theming.py +++ b/sphinx/theming.py @@ -178,8 +178,6 @@ class HTMLThemeFactory: """Try to load a theme having specifed name.""" if name == 'alabaster': self.load_alabaster_theme() - elif name == 'sphinx_rtd_theme': - self.load_sphinx_rtd_theme() else: self.load_external_theme(name) @@ -237,13 +235,13 @@ class HTMLThemeFactory: if name not in self.themes: self.load_extra_theme(name) + if name not in self.themes and name == 'sphinx_rtd_theme': + # sphinx_rtd_theme (< 0.2.5) # RemovedInSphinx60Warning + logger.warning(__('sphinx_rtd_theme (< 0.3.0) found. ' + 'It will not be available since Sphinx-6.0')) + self.load_sphinx_rtd_theme() + if name not in self.themes: - if name == 'sphinx_rtd_theme': - raise ThemeError(__('sphinx_rtd_theme is no longer a hard dependency ' - 'since version 1.4.0. Please install it manually.' - '(pip install sphinx_rtd_theme)')) - else: - raise ThemeError(__('no theme named %r found ' - '(missing theme.conf?)') % name) + raise ThemeError(__('no theme named %r found (missing theme.conf?)') % name) return Theme(name, self.themes[name], factory=self) |