forked from python/python-docs-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
39 lines (29 loc) · 939 Bytes
/
__init__.py
File metadata and controls
39 lines (29 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from __future__ import annotations
import gettext
import os
from pathlib import Path
TYPE_CHECKING = False
if TYPE_CHECKING:
from sphinx.application import Sphinx
from sphinx.util.typing import ExtensionMetadata
__version__ = "2025.5"
THEME_PATH = Path(__file__).resolve().parent
def setup_translations(app):
translation = gettext.translation(
domain="messages",
localedir=os.fspath(THEME_PATH / "locales"),
languages=[app.config.language],
fallback=True,
)
app.builder.templates.environment.install_gettext_translations(
translation, newstyle=True
)
def setup(app: Sphinx) -> ExtensionMetadata:
app.require_sphinx("7.3")
app.connect("builder-inited", setup_translations)
app.add_html_theme("python_docs_theme", str(THEME_PATH))
return {
"version": __version__,
"parallel_read_safe": True,
"parallel_write_safe": True,
}