From 3d34296b29435c82ec370532345336c4bedf1453 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sun, 26 Jan 2025 20:53:15 +0200 Subject: [PATCH 01/54] Fix PR preview links (#215) --- .github/workflows/documentation-links.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/documentation-links.yml b/.github/workflows/documentation-links.yml index f05df37b..a4de7dcd 100644 --- a/.github/workflows/documentation-links.yml +++ b/.github/workflows/documentation-links.yml @@ -6,9 +6,6 @@ on: pull_request_target: types: - opened - paths: - - 'Doc/**' - - '.github/workflows/doc.yml' permissions: pull-requests: write From 01d5bcf0524663037ae68bbcea1248ce5238ce00 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Tue, 28 Jan 2025 01:40:31 +0000 Subject: [PATCH 02/54] Note minimum requirements for Sphinx (#216) --- .pre-commit-config.yaml | 14 +++++++------- README.md | 1 + pyproject.toml | 4 ++++ python_docs_theme/__init__.py | 2 ++ 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 071ad406..f9643647 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,17 +1,17 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.8 + rev: v0.9.3 hooks: - id: ruff args: [--exit-non-zero-on-fix] - repo: https://github.com/psf/black-pre-commit-mirror - rev: 24.8.0 + rev: 24.10.0 hooks: - id: black - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-case-conflict - id: check-merge-conflict @@ -22,24 +22,24 @@ repos: - id: trailing-whitespace - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.29.2 + rev: 0.31.0 hooks: - id: check-dependabot - id: check-github-workflows - repo: https://github.com/rhysd/actionlint - rev: v1.7.2 + rev: v1.7.7 hooks: - id: actionlint - repo: https://github.com/tox-dev/pyproject-fmt - rev: 2.2.4 + rev: v2.5.0 hooks: - id: pyproject-fmt args: [--max-supported-python=3.13] - repo: https://github.com/abravalheri/validate-pyproject - rev: v0.20.2 + rev: v0.23 hooks: - id: validate-pyproject diff --git a/README.md b/README.md index f77b4910..24308f77 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Python Docs Sphinx Theme This is the theme for the Python documentation. +It requires Python 3.9 or newer and Sphinx 3.4 or newer. Note that when adopting this theme, you're also borrowing an element of the trust and credibility established by the CPython core developers over the diff --git a/pyproject.toml b/pyproject.toml index 9b7c60ff..1b34d905 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,6 +28,10 @@ classifiers = [ "Topic :: Documentation", "Topic :: Software Development :: Documentation", ] +dependencies = [ + "sphinx>=3.4", +] + urls.Code = "https://github.com/python/python-docs-theme" urls.Download = "https://pypi.org/project/python-docs-theme/" urls.Homepage = "https://github.com/python/python-docs-theme/" diff --git a/python_docs_theme/__init__.py b/python_docs_theme/__init__.py index 0ee7d25d..295c1c53 100644 --- a/python_docs_theme/__init__.py +++ b/python_docs_theme/__init__.py @@ -53,6 +53,8 @@ def _html_page_context( def setup(app): + app.require_sphinx("3.4") + current_dir = os.path.abspath(os.path.dirname(__file__)) app.add_html_theme("python_docs_theme", current_dir) From 2f15ba657cba97c078a2b2869f1b387bfa24618e Mon Sep 17 00:00:00 2001 From: "Tomas R." Date: Mon, 3 Feb 2025 19:32:00 +0100 Subject: [PATCH 03/54] Horizontally centre the sidebar collapse button (#219) --- python_docs_theme/static/pydoctheme.css | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index 0f6f8d37..bf92e92a 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -191,6 +191,9 @@ div.sphinxsidebar input[type='text'] { } #sidebarbutton { + display: flex; + justify-content: center; + align-items: center; /* Sphinx 4.x and earlier compat */ height: 100%; background-color: #CCCCCC; @@ -200,19 +203,12 @@ div.sphinxsidebar input[type='text'] { cursor: pointer; padding-top: 1px; float: right; - display: table; /* after Sphinx 4.x and earlier is dropped, only the below is needed */ width: 12px; border-radius: 0 5px 5px 0; border-left: none; } -#sidebarbutton span { - /* Sphinx 4.x and earlier compat */ - display: table-cell; - vertical-align: middle; -} - #sidebarbutton:hover { background-color: #AAAAAA; } From b6a1724264c4b4937d973eb73a0472ce9023e291 Mon Sep 17 00:00:00 2001 From: "Tomas R." Date: Tue, 4 Feb 2025 13:50:41 +0100 Subject: [PATCH 04/54] Make sidebar width more flexible (#218) --- python_docs_theme/static/pydoctheme.css | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index bf92e92a..8b7b2cf8 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -140,6 +140,8 @@ span.pre { } div.sphinxsidebar { + display: flex; + width: min(25vw, 350px); float: none; position: sticky; top: 0; @@ -156,13 +158,17 @@ div.sphinxsidebar h4 { margin-top: 1.5em; } +div.bodywrapper { + margin-left: min(25vw, 350px); +} + div.sphinxsidebarwrapper { - width: 217px; box-sizing: border-box; height: 100%; overflow-x: hidden; overflow-y: auto; - float: left; + float: none; + flex-grow: 1; } div.sphinxsidebarwrapper > h3:first-child { @@ -202,9 +208,10 @@ div.sphinxsidebar input[type='text'] { font-size: 1.2em; cursor: pointer; padding-top: 1px; - float: right; + float: none; /* after Sphinx 4.x and earlier is dropped, only the below is needed */ width: 12px; + min-width: 12px; border-radius: 0 5px 5px 0; border-left: none; } @@ -485,7 +492,7 @@ div.genindex-jumpbox a { margin-inline-end: 0; } /* Remove sidebar and top related bar */ - div.related, .sphinxsidebar { + div.related, div.sphinxsidebar { display: none; } /* Anchorlinks are not hidden by fixed-positioned navbar when scrolled to */ From 482321225e574a6c09770a48196a9e4dd99f0b0b Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Tue, 4 Feb 2025 13:42:07 +0000 Subject: [PATCH 05/54] Set ``__version__`` in the runtime package (#222) * Set ``__version__`` in the runtime package * Return the version key in ``setup()`` * Add static type annotations to ``setup()`` * Fix the Python version for ``tomli`` * read ``__version__`` from ``__init__.py`` Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- CONTRIBUTING.rst | 2 +- babel_runner.py | 23 ++++++++++++++++++++--- pyproject.toml | 3 ++- python_docs_theme/__init__.py | 19 +++++++++++++------ requirements.txt | 2 +- 5 files changed, 37 insertions(+), 12 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 2533e96a..c85b77ca 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -2,7 +2,7 @@ How to release -------------- - Update ``CHANGELOG.rst`` -- Bump version (YYYY.MM) in ``pyproject.toml`` +- Bump version (YYYY.MM) in ``python_docs_theme/__init__.py`` - Commit - Push to check tests pass on `GitHub Actions `__ diff --git a/babel_runner.py b/babel_runner.py index da4001c7..ee5af161 100755 --- a/babel_runner.py +++ b/babel_runner.py @@ -3,6 +3,7 @@ from __future__ import annotations import argparse +import ast import subprocess from pathlib import Path @@ -17,6 +18,8 @@ ) from ie PROJECT_DIR = Path(__file__).resolve().parent +PYPROJECT_TOML = PROJECT_DIR / "pyproject.toml" +INIT_PY = PROJECT_DIR / "python_docs_theme" / "__init__.py" # Global variables used by pybabel below (paths relative to PROJECT_DIR) DOMAIN = "messages" @@ -29,9 +32,23 @@ def get_project_info() -> dict: """Retrieve project's info to populate the message catalog template""" - with open(Path(PROJECT_DIR / "pyproject.toml"), "rb") as f: - data = tomllib.load(f) - return data["project"] + pyproject_text = PYPROJECT_TOML.read_text(encoding="utf-8") + project_data = tomllib.loads(pyproject_text)["project"] + + # read __version__ from __init__.py + for child in ast.parse(INIT_PY.read_bytes()).body: + if not isinstance(child, ast.Assign): + continue + target = child.targets[0] + if not isinstance(target, ast.Name) or target.id != "__version__": + continue + version_node = child.value + if not isinstance(version_node, ast.Constant): + continue + project_data["version"] = version_node.value + break + + return project_data def extract_messages() -> None: diff --git a/pyproject.toml b/pyproject.toml index 1b34d905..7eb1cc2b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,6 @@ requires = [ [project] name = "python-docs-theme" -version = "2024.12" description = "The Sphinx theme for the CPython docs and related projects" readme = "README.md" license.file = "LICENSE" @@ -28,6 +27,8 @@ classifiers = [ "Topic :: Documentation", "Topic :: Software Development :: Documentation", ] +dynamic = [ "version" ] + dependencies = [ "sphinx>=3.4", ] diff --git a/python_docs_theme/__init__.py b/python_docs_theme/__init__.py index 295c1c53..d8dd2c74 100644 --- a/python_docs_theme/__init__.py +++ b/python_docs_theme/__init__.py @@ -1,15 +1,22 @@ from __future__ import annotations import hashlib -import os from functools import cache from pathlib import Path -from typing import Any import sphinx.application from sphinx.builders.html import StandaloneHTMLBuilder -THEME_PATH = Path(__file__).parent.resolve() +TYPE_CHECKING = False +if TYPE_CHECKING: + from typing import Any + + from sphinx.application import Sphinx + from sphinx.util.typing import ExtensionMetadata + +__version__ = "2024.12" + +THEME_PATH = Path(__file__).resolve().parent @cache @@ -52,15 +59,15 @@ def _html_page_context( ) -def setup(app): +def setup(app: Sphinx) -> ExtensionMetadata: app.require_sphinx("3.4") - current_dir = os.path.abspath(os.path.dirname(__file__)) - app.add_html_theme("python_docs_theme", current_dir) + app.add_html_theme("python_docs_theme", str(THEME_PATH)) app.connect("html-page-context", _html_page_context) return { + "version": __version__, "parallel_read_safe": True, "parallel_write_safe": True, } diff --git a/requirements.txt b/requirements.txt index 18e6c17c..ad829d49 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,4 @@ setuptools Babel Jinja2 -tomli; python_version < "3.10" +tomli; python_version < "3.11" From 24ed1541324a8d94e5113b4116943aec0ec43681 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Tue, 4 Feb 2025 14:55:00 +0000 Subject: [PATCH 06/54] Prepare 2025.2 release (#223) --- CHANGELOG.rst | 12 ++++++++++++ python_docs_theme/__init__.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 47eef33d..74b09cad 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,18 @@ Changelog ========= +`2025.2 `_ +--------------------------------------------------------------------------- + +- Note minimum requirements for Sphinx (#216) + Contributed by Adam Turner +- Horizontally centre the sidebar collapse button (#219) + Contributed by Tomas Roun +- Make sidebar width more flexible (#218) + Contributed by Tomas Roun +- Set ``__version__`` in the runtime package (#222) + Contributed by Adam Turner + `2024.12 `_ ----------------------------------------------------------------------------- diff --git a/python_docs_theme/__init__.py b/python_docs_theme/__init__.py index d8dd2c74..5a84c840 100644 --- a/python_docs_theme/__init__.py +++ b/python_docs_theme/__init__.py @@ -14,7 +14,7 @@ from sphinx.application import Sphinx from sphinx.util.typing import ExtensionMetadata -__version__ = "2024.12" +__version__ = "2025.2" THEME_PATH = Path(__file__).resolve().parent From f5d080f2ae0318db0c93f5afff79d27482ef7b4d Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Thu, 13 Feb 2025 01:42:59 +0000 Subject: [PATCH 07/54] Require Python 3.10 and Sphinx 7.3 (#221) --- .github/workflows/tests.yml | 2 +- README.md | 2 +- pyproject.toml | 5 +- python_docs_theme/__init__.py | 51 +------------ python_docs_theme/static/pydoctheme.css | 12 ---- python_docs_theme/static/sidebar.js_t | 95 ------------------------- python_docs_theme/theme.conf | 37 ---------- python_docs_theme/theme.toml | 39 ++++++++++ 8 files changed, 44 insertions(+), 199 deletions(-) delete mode 100644 python_docs_theme/static/sidebar.js_t delete mode 100644 python_docs_theme/theme.conf create mode 100644 python_docs_theme/theme.toml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ace177ed..90e4b632 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -56,7 +56,7 @@ jobs: matrix: os: ["ubuntu-latest", "windows-latest"] # Test minimum supported and latest stable from 3.x series - python-version: ["3.9", "3"] + python-version: ["3.10", "3"] steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 diff --git a/README.md b/README.md index 24308f77..133daa0f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Python Docs Sphinx Theme This is the theme for the Python documentation. -It requires Python 3.9 or newer and Sphinx 3.4 or newer. +It requires Python 3.10 or newer and Sphinx 7.3 or newer. Note that when adopting this theme, you're also borrowing an element of the trust and credibility established by the CPython core developers over the diff --git a/pyproject.toml b/pyproject.toml index 7eb1cc2b..e03e2be2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ description = "The Sphinx theme for the CPython docs and related projects" readme = "README.md" license.file = "LICENSE" authors = [ { name = "PyPA", email = "distutils-sig@python.org" } ] -requires-python = ">=3.9" +requires-python = ">=3.10" classifiers = [ "Development Status :: 5 - Production/Stable", "Framework :: Sphinx :: Theme", @@ -19,7 +19,6 @@ classifiers = [ "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", @@ -30,7 +29,7 @@ classifiers = [ dynamic = [ "version" ] dependencies = [ - "sphinx>=3.4", + "sphinx>=7.3", ] urls.Code = "https://github.com/python/python-docs-theme" diff --git a/python_docs_theme/__init__.py b/python_docs_theme/__init__.py index 5a84c840..c5b5fe79 100644 --- a/python_docs_theme/__init__.py +++ b/python_docs_theme/__init__.py @@ -1,16 +1,9 @@ from __future__ import annotations -import hashlib -from functools import cache from pathlib import Path -import sphinx.application -from sphinx.builders.html import StandaloneHTMLBuilder - TYPE_CHECKING = False if TYPE_CHECKING: - from typing import Any - from sphinx.application import Sphinx from sphinx.util.typing import ExtensionMetadata @@ -19,53 +12,11 @@ THEME_PATH = Path(__file__).resolve().parent -@cache -def _asset_hash(path: str) -> str: - """Append a `?digest=` to an url based on the file content.""" - full_path = THEME_PATH / path.replace("_static/", "static/") - digest = hashlib.sha1(full_path.read_bytes()).hexdigest() - - return f"{path}?digest={digest}" - - -def _add_asset_hashes(static: list[str], add_digest_to: list[str]) -> None: - for asset in add_digest_to: - index = static.index(asset) - static[index].filename = _asset_hash(asset) # type: ignore[attr-defined] - - -def _html_page_context( - app: sphinx.application.Sphinx, - pagename: str, - templatename: str, - context: dict[str, Any], - doctree: Any, -) -> None: - if app.config.html_theme != "python_docs_theme": - return - - assert isinstance(app.builder, StandaloneHTMLBuilder) - - if (4,) <= sphinx.version_info < (7, 1) and "css_files" in context: - if "_static/pydoctheme.css" not in context["css_files"]: - raise ValueError( - "This documentation is not using `pydoctheme.css` as the stylesheet. " - "If you have set `html_style` in your conf.py file, remove it." - ) - - _add_asset_hashes( - context["css_files"], - ["_static/pydoctheme.css"], - ) - - def setup(app: Sphinx) -> ExtensionMetadata: - app.require_sphinx("3.4") + app.require_sphinx("7.3") app.add_html_theme("python_docs_theme", str(THEME_PATH)) - app.connect("html-page-context", _html_page_context) - return { "version": __version__, "parallel_read_safe": True, diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index 8b7b2cf8..da47d3e7 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -1,5 +1,3 @@ -@import url('classic.css'); - /* Common colours */ :root { --good-color: rgb(41 100 51); @@ -200,16 +198,6 @@ div.sphinxsidebar input[type='text'] { display: flex; justify-content: center; align-items: center; - /* Sphinx 4.x and earlier compat */ - height: 100%; - background-color: #CCCCCC; - margin-left: 0; - color: #444444; - font-size: 1.2em; - cursor: pointer; - padding-top: 1px; - float: none; - /* after Sphinx 4.x and earlier is dropped, only the below is needed */ width: 12px; min-width: 12px; border-radius: 0 5px 5px 0; diff --git a/python_docs_theme/static/sidebar.js_t b/python_docs_theme/static/sidebar.js_t deleted file mode 100644 index a08aa0fd..00000000 --- a/python_docs_theme/static/sidebar.js_t +++ /dev/null @@ -1,95 +0,0 @@ -/* - * sidebar.js - * ~~~~~~~~~~ - * - * This file is functionally identical to "sidebar.js" in Sphinx 5.0. - * When support for Sphinx 4 and earlier is dropped from the theme, - * this file can be removed. - * - * This script makes the Sphinx sidebar collapsible. - * - * .sphinxsidebar contains .sphinxsidebarwrapper. This script adds - * in .sphinxsidebar, after .sphinxsidebarwrapper, the #sidebarbutton - * used to collapse and expand the sidebar. - * - * When the sidebar is collapsed the .sphinxsidebarwrapper is hidden - * and the width of the sidebar and the margin-left of the document - * are decreased. When the sidebar is expanded the opposite happens. - * This script saves a per-browser/per-session cookie used to - * remember the position of the sidebar among the pages. - * Once the browser is closed the cookie is deleted and the position - * reset to the default (expanded). - * - * :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS. - * :license: BSD, see LICENSE for details. - * - */ - -const initialiseSidebar = () => { - // global elements used by the functions. - const bodyWrapper = document.getElementsByClassName("bodywrapper")[0] - const sidebar = document.getElementsByClassName("sphinxsidebar")[0] - const sidebarWrapper = document.getElementsByClassName("sphinxsidebarwrapper")[0] - - // exit early if the document has no sidebar for some reason - if (typeof sidebar === "undefined") { - return - } - -{# Check if we need to dynamically insert the sidebar button. - # We prefer the ``sphinx_version_tuple`` variable, and if it is undefined we - # know we are running a Sphinx version older than 4.2. - # - # See: https://www.sphinx-doc.org/en/master/development/templating.html#sphinx_version_tuple - #} -{% if sphinx_version_tuple is defined and sphinx_version_tuple[0] >= 5 %} - const sidebarButton = document.getElementById("sidebarbutton") - const sidebarArrow = sidebarButton.querySelector('span') -{% else %} - // create the sidebar button element - const sidebarButton = document.createElement("div") - sidebarButton.id = "sidebarbutton" - // create the sidebar button arrow element - const sidebarArrow = document.createElement("span") - sidebarArrow.innerText = "«" - sidebarButton.appendChild(sidebarArrow) - sidebar.appendChild(sidebarButton) -{% endif %} - - const collapse_sidebar = () => { - bodyWrapper.style.marginLeft = ".8em" - sidebar.style.width = ".8em" - sidebarWrapper.style.display = "none" - sidebarArrow.innerText = "»" - sidebarButton.title = _("Expand sidebar") - window.localStorage.setItem("sidebar", "collapsed") - } - - const expand_sidebar = () => { - bodyWrapper.style.marginLeft = "" - sidebar.style.removeProperty("width") - sidebarWrapper.style.display = "" - sidebarArrow.innerText = "«" - sidebarButton.title = _("Collapse sidebar") - window.localStorage.setItem("sidebar", "expanded") - } - - sidebarButton.addEventListener("click", () => { - (sidebarWrapper.style.display === "none") ? expand_sidebar() : collapse_sidebar() - }) - - const sidebar_state = window.localStorage.getItem("sidebar") - if (sidebar_state === "collapsed") { - collapse_sidebar() - } - else if (sidebar_state === "expanded") { - expand_sidebar() - } -} - -if (document.readyState !== "loading") { - initialiseSidebar() -} -else { - document.addEventListener("DOMContentLoaded", initialiseSidebar) -} diff --git a/python_docs_theme/theme.conf b/python_docs_theme/theme.conf deleted file mode 100644 index 5edf397a..00000000 --- a/python_docs_theme/theme.conf +++ /dev/null @@ -1,37 +0,0 @@ -[theme] -inherit = default -stylesheet = pydoctheme.css -pygments_style = default -pygments_dark_style = monokai - -[options] -bodyfont = -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif -headfont = -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif -footerbgcolor = white -footertextcolor = #555555 -relbarbgcolor = white -relbartextcolor = #666666 -relbarlinkcolor = #444444 -sidebarbgcolor = white -sidebartextcolor = #444444 -sidebarlinkcolor = #444444 -sidebarbtncolor = #cccccc -bgcolor = white -textcolor = #222222 -linkcolor = #0090c0 -visitedlinkcolor = #00608f -headtextcolor = #1a1a1a -headbgcolor = white -headlinkcolor = #aaaaaa -codebgcolor = #eeffcc -codetextcolor = #333333 - -hosted_on = -issues_url = -license_url = -root_name = Python -root_url = https://www.python.org/ -root_icon = py.svg -root_icon_alt_text = Python logo -root_include_title = True -copyright_url = diff --git a/python_docs_theme/theme.toml b/python_docs_theme/theme.toml new file mode 100644 index 00000000..1d3cdbda --- /dev/null +++ b/python_docs_theme/theme.toml @@ -0,0 +1,39 @@ +[theme] +inherit = "default" +stylesheets = [ + "classic.css", + "pydoctheme.css", +] +pygments_style = { default = "default", dark = "monokai" } + +[options] +bodyfont = "-apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif" +headfont = "-apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif" +footerbgcolor = "white" +footertextcolor = "#555555" +relbarbgcolor = "white" +relbartextcolor = "#666666" +relbarlinkcolor = "#444444" +sidebarbgcolor = "white" +sidebartextcolor = "#444444" +sidebarlinkcolor = "#444444" +sidebarbtncolor = "#cccccc" +bgcolor = "white" +textcolor = "#222222" +linkcolor = "#0090c0" +visitedlinkcolor = "#00608f" +headtextcolor = "#1a1a1a" +headbgcolor = "white" +headlinkcolor = "#aaaaaa" +codebgcolor = "#eeffcc" +codetextcolor = "#333333" + +hosted_on = "" +issues_url = "" +license_url = "" +root_name = "Python" +root_url = "https://www.python.org/" +root_icon = "py.svg" +root_icon_alt_text = "Python logo" +root_include_title = "True" +copyright_url = "" From 729fcc106102ebef5473e7f6b12d78f9822d530f Mon Sep 17 00:00:00 2001 From: "Tomas R." Date: Fri, 4 Apr 2025 14:37:48 +0200 Subject: [PATCH 08/54] Add missing i18n for copy button titles (#225) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- .babel.cfg | 2 ++ python_docs_theme/static/copybutton.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.babel.cfg b/.babel.cfg index 692580d8..cc4c9de0 100644 --- a/.babel.cfg +++ b/.babel.cfg @@ -1 +1,3 @@ +[javascript: **.js] + [jinja2: **.html] diff --git a/python_docs_theme/static/copybutton.js b/python_docs_theme/static/copybutton.js index 7367c4af..f176ff6b 100644 --- a/python_docs_theme/static/copybutton.js +++ b/python_docs_theme/static/copybutton.js @@ -33,8 +33,8 @@ const loadCopyButton = () => { /* Add a [>>>] button in the top-right corner of code samples to hide * the >>> and ... prompts and the output and thus make the code * copyable. */ - const hide_text = "Hide the prompts and output" - const show_text = "Show the prompts and output" + const hide_text = _("Hide the prompts and output") + const show_text = _("Show the prompts and output") const button = document.createElement("span") button.classList.add("copybutton") From e0b4a3396b818d41a37e28c5631b3d1a7c27a407 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Mon, 7 Apr 2025 21:15:19 +0300 Subject: [PATCH 09/54] Remove self-closing tags (#226) --- python_docs_theme/footerdonate.html | 2 +- python_docs_theme/layout.html | 34 ++++++++++++++--------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/python_docs_theme/footerdonate.html b/python_docs_theme/footerdonate.html index 2aef2ac2..010014d6 100644 --- a/python_docs_theme/footerdonate.html +++ b/python_docs_theme/footerdonate.html @@ -1,3 +1,3 @@ {% trans %}The Python Software Foundation is a non-profit corporation.{% endtrans %} {% trans %}Please donate.{% endtrans %} -
+
diff --git a/python_docs_theme/layout.html b/python_docs_theme/layout.html index 9762b06c..a74517c9 100644 --- a/python_docs_theme/layout.html +++ b/python_docs_theme/layout.html @@ -14,7 +14,7 @@

{{ _('Navigation') }}

{%- endfor %} {%- block rootrellink %} -
  • {{ theme_root_icon_alt_text }}
  • +
  • {{ theme_root_icon_alt_text }}
  • {{theme_root_name}}{{ reldelim1 }}
  • @@ -48,8 +48,8 @@

    {{ _('Navigation') }}

    {%- if builder != "htmlhelp" %} {%- endif %} @@ -71,7 +71,7 @@

    {{ _('Navigation') }}

    {%- block extrahead -%} - + {%- if builder != "htmlhelp" %} {%- if not embedded %} @@ -93,14 +93,14 @@

    {{ _('Navigation') }}

    {%- if builder != 'htmlhelp' %}
    + aria-pressed="false" aria-expanded="false" role="button" aria-label="{{ _('Menu')}}">
    From 06987c260d882d92e9aa0513d04b8645c981ae39 Mon Sep 17 00:00:00 2001 From: "Tomas R." Date: Thu, 10 Apr 2025 21:18:38 +0200 Subject: [PATCH 10/54] Use consistent line-height in code blocks for light & dark theme (#227) --- python_docs_theme/static/pydoctheme.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index da47d3e7..40d9cb02 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -328,6 +328,10 @@ tt, code, pre { font-size: 96.5%; } +div.body pre { + line-height: 120%; +} + div.body tt, div.body code { border-radius: 3px; From b8b2d49bed1e933e2eaee24d8822ad0e6a946591 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Fri, 11 Apr 2025 15:24:17 +0100 Subject: [PATCH 11/54] Use the correct spelling of the ``--languages`` flag (#228) --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 90e4b632..4054cbf2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -37,7 +37,7 @@ jobs: --group "$(id -g)" --skip-cache-invalidation --theme "$(pwd)" - --language en + --languages en --branch ${{ matrix.branch }} - name: Show logs if: failure() From 6ac5c06d13fa22e25f39ebf95642d00b64f7a895 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sun, 13 Apr 2025 13:33:26 +0300 Subject: [PATCH 12/54] Use --branches for docsbuild-scripts (#232) --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4054cbf2..875123c3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,7 +38,7 @@ jobs: --skip-cache-invalidation --theme "$(pwd)" --languages en - --branch ${{ matrix.branch }} + --branches ${{ matrix.branch }} - name: Show logs if: failure() run: | From d528dbca5dcaf28f19aa1e2ced645320882f1203 Mon Sep 17 00:00:00 2001 From: "Tomas R." Date: Fri, 18 Apr 2025 11:46:36 +0200 Subject: [PATCH 13/54] Add a copy button to code samples (#231) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- python_docs_theme/static/copybutton.js | 106 +++++++++---------- python_docs_theme/static/pydoctheme.css | 22 ++-- python_docs_theme/static/pydoctheme_dark.css | 13 +++ 3 files changed, 76 insertions(+), 65 deletions(-) diff --git a/python_docs_theme/static/copybutton.js b/python_docs_theme/static/copybutton.js index f176ff6b..9df468ee 100644 --- a/python_docs_theme/static/copybutton.js +++ b/python_docs_theme/static/copybutton.js @@ -1,65 +1,59 @@ -// ``function*`` denotes a generator in JavaScript, see -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function* -function* getHideableCopyButtonElements(rootElement) { - // yield all elements with the "go" (Generic.Output), - // "gp" (Generic.Prompt), or "gt" (Generic.Traceback) CSS class - for (const el of rootElement.querySelectorAll('.go, .gp, .gt')) { - yield el - } - // tracebacks (.gt) contain bare text elements that need to be - // wrapped in a span to hide or show the element - for (let el of rootElement.querySelectorAll('.gt')) { - while ((el = el.nextSibling) && el.nodeType !== Node.DOCUMENT_NODE) { - // stop wrapping text nodes when we hit the next output or - // prompt element - if (el.nodeType === Node.ELEMENT_NODE && el.matches(".gp, .go")) { - break - } - // if the node is a text node with content, wrap it in a - // span element so that we can control visibility - if (el.nodeType === Node.TEXT_NODE && el.textContent.trim()) { - const wrapper = document.createElement("span") - el.after(wrapper) - wrapper.appendChild(el) - el = wrapper - } - yield el +// Extract copyable text from the code block ignoring the +// prompts and output. +function getCopyableText(rootElement) { + rootElement = rootElement.cloneNode(true) + // tracebacks (.gt) contain bare text elements that + // need to be removed + const tracebacks = rootElement.querySelectorAll(".gt") + for (const el of tracebacks) { + while ( + el.nextSibling && + (el.nextSibling.nodeType !== Node.DOCUMENT_NODE || + !el.nextSibling.matches(".gp, .go")) + ) { + el.nextSibling.remove() } } + // Remove all elements with the "go" (Generic.Output), + // "gp" (Generic.Prompt), or "gt" (Generic.Traceback) CSS class + const elements = rootElement.querySelectorAll(".gp, .go, .gt") + for (const el of elements) { + el.remove() + } + return rootElement.innerText.trim() } - const loadCopyButton = () => { - /* Add a [>>>] button in the top-right corner of code samples to hide - * the >>> and ... prompts and the output and thus make the code - * copyable. */ - const hide_text = _("Hide the prompts and output") - const show_text = _("Show the prompts and output") - - const button = document.createElement("span") + const button = document.createElement("button") button.classList.add("copybutton") - button.innerText = ">>>" - button.title = hide_text - button.dataset.hidden = "false" - const buttonClick = event => { + button.type = "button" + button.innerText = _("Copy") + button.title = _("Copy to clipboard") + + const makeOnButtonClick = () => { + let timeout = null // define the behavior of the button when it's clicked - event.preventDefault() - const buttonEl = event.currentTarget - const codeEl = buttonEl.nextElementSibling - if (buttonEl.dataset.hidden === "false") { - // hide the code output - for (const el of getHideableCopyButtonElements(codeEl)) { - el.hidden = true + return async event => { + // check if the clipboard is available + if (!navigator.clipboard || !navigator.clipboard.writeText) { + return; } - buttonEl.title = show_text - buttonEl.dataset.hidden = "true" - } else { - // show the code output - for (const el of getHideableCopyButtonElements(codeEl)) { - el.hidden = false + + clearTimeout(timeout) + const buttonEl = event.currentTarget + const codeEl = buttonEl.nextElementSibling + + try { + await navigator.clipboard.writeText(getCopyableText(codeEl)) + } catch (e) { + console.error(e.message) + return } - buttonEl.title = hide_text - buttonEl.dataset.hidden = "false" + + buttonEl.innerText = _("Copied!") + timeout = setTimeout(() => { + buttonEl.innerText = _("Copy") + }, 1500) } } @@ -78,10 +72,8 @@ const loadCopyButton = () => { // if we find a console prompt (.gp), prepend the (deeply cloned) button const clonedButton = button.cloneNode(true) // the onclick attribute is not cloned, set it on the new element - clonedButton.onclick = buttonClick - if (el.querySelector(".gp") !== null) { - el.prepend(clonedButton) - } + clonedButton.onclick = makeOnButtonClick() + el.prepend(clonedButton) }) } diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index 40d9cb02..6d50092f 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -442,17 +442,23 @@ div.genindex-jumpbox a { top: 0; right: 0; font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace; - padding-left: 0.2em; - padding-right: 0.2em; + font-size: 80%; + padding-left: .5em; + padding-right: .5em; + height: 100%; + max-height: min(100%, 2.4em); border-radius: 0 3px 0 0; - color: #ac9; /* follows div.body pre */ - border-color: #ac9; /* follows div.body pre */ - border-style: solid; /* follows div.body pre */ - border-width: 1px; /* follows div.body pre */ + color: #000; + background-color: #fff; + border: 1px solid #ac9; /* follows div.body pre */ +} + +.copybutton:hover { + background-color: #eee; } -.copybutton[data-hidden='true'] { - text-decoration: line-through; +.copybutton:active { + background-color: #ddd; } @media (max-width: 1023px) { diff --git a/python_docs_theme/static/pydoctheme_dark.css b/python_docs_theme/static/pydoctheme_dark.css index 45099605..582e4ddb 100644 --- a/python_docs_theme/static/pydoctheme_dark.css +++ b/python_docs_theme/static/pydoctheme_dark.css @@ -176,3 +176,16 @@ img.invert-in-dark-mode { --versionchanged: var(--middle-color); --deprecated: var(--bad-color); } + +.copybutton { + color: #ac9; /* follows div.body pre */ + background-color: #222222; /* follows body */ +} + +.copybutton:hover { + background-color: #434343; +} + +.copybutton:active { + background-color: #656565; +} From 5b795101f57a47ac8113bd08294f3b7e176f3ff9 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 19 Apr 2025 01:10:06 +0300 Subject: [PATCH 14/54] Drop support for Python 3.10 and 3.11 (#234) --- .github/workflows/tests.yml | 4 ++-- babel_runner.py | 11 +---------- pyproject.toml | 4 +--- requirements.txt | 2 -- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 875123c3..5a8ec726 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - branch: ["origin/main", "3.13", "3.12", "3.11", "3.10"] + branch: ["origin/main", "3.13", "3.12"] steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 @@ -56,7 +56,7 @@ jobs: matrix: os: ["ubuntu-latest", "windows-latest"] # Test minimum supported and latest stable from 3.x series - python-version: ["3.10", "3"] + python-version: ["3.12", "3"] steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 diff --git a/babel_runner.py b/babel_runner.py index ee5af161..0785ae2f 100755 --- a/babel_runner.py +++ b/babel_runner.py @@ -5,18 +5,9 @@ import argparse import ast import subprocess +import tomllib from pathlib import Path -try: - import tomllib -except ImportError: - try: - import tomli as tomllib - except ImportError as ie: - raise ImportError( - "tomli or tomllib is required to parse pyproject.toml" - ) from ie - PROJECT_DIR = Path(__file__).resolve().parent PYPROJECT_TOML = PROJECT_DIR / "pyproject.toml" INIT_PY = PROJECT_DIR / "python_docs_theme" / "__init__.py" diff --git a/pyproject.toml b/pyproject.toml index e03e2be2..f312f8be 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ description = "The Sphinx theme for the CPython docs and related projects" readme = "README.md" license.file = "LICENSE" authors = [ { name = "PyPA", email = "distutils-sig@python.org" } ] -requires-python = ">=3.10" +requires-python = ">=3.12" classifiers = [ "Development Status :: 5 - Production/Stable", "Framework :: Sphinx :: Theme", @@ -19,8 +19,6 @@ classifiers = [ "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Topic :: Documentation", diff --git a/requirements.txt b/requirements.txt index ad829d49..bb631b59 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,3 @@ # for babel_runner.py -setuptools Babel Jinja2 -tomli; python_version < "3.11" From d0b0a152185d8cfe7ec4af57316808fc9b39eb65 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 26 Apr 2025 12:42:29 +0300 Subject: [PATCH 15/54] Replace deprecated classifier with licence expression (PEP 639) (#237) --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f312f8be..11e66cb8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,14 +8,14 @@ requires = [ name = "python-docs-theme" description = "The Sphinx theme for the CPython docs and related projects" readme = "README.md" -license.file = "LICENSE" +license = "PSF-2.0" +license-files = [ "LICENSE" ] authors = [ { name = "PyPA", email = "distutils-sig@python.org" } ] requires-python = ">=3.12" classifiers = [ "Development Status :: 5 - Production/Stable", "Framework :: Sphinx :: Theme", "Intended Audience :: Developers", - "License :: OSI Approved :: Python Software Foundation License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", From 7253ffc89738d2e96deacda61c84cbb66d7eb69b Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Mon, 28 Apr 2025 19:05:17 +0300 Subject: [PATCH 16/54] Add support for Python 3.14 (#236) --- .github/workflows/tests.yml | 5 +++-- .pre-commit-config.yaml | 1 - pyproject.toml | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5a8ec726..23e6c7e6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,12 +12,12 @@ jobs: strategy: fail-fast: false matrix: - branch: ["origin/main", "3.13", "3.12"] + branch: ["3.14", "3.13", "3.12"] steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: 3 + python-version: ${{ matrix.branch }} allow-prereleases: true cache: pip - name: Clone docsbuild scripts @@ -39,6 +39,7 @@ jobs: --theme "$(pwd)" --languages en --branches ${{ matrix.branch }} + ${{ matrix.branch == '3.14' && '--select-output no-html' || '' }} - name: Show logs if: failure() run: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f9643647..9a7e83b3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -36,7 +36,6 @@ repos: rev: v2.5.0 hooks: - id: pyproject-fmt - args: [--max-supported-python=3.13] - repo: https://github.com/abravalheri/validate-pyproject rev: v0.23 diff --git a/pyproject.toml b/pyproject.toml index 11e66cb8..a614351d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ classifiers = [ "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Topic :: Documentation", "Topic :: Software Development :: Documentation", ] @@ -67,3 +68,6 @@ lint.ignore = [ "E241", # Multiple spaces after ',' ] lint.isort.required-imports = [ "from __future__ import annotations" ] + +[tool.pyproject-fmt] +max_supported_python = "3.14" From 4c59313d66516cc8614cad05dc0bf62d44828269 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Tue, 29 Apr 2025 15:09:46 +0300 Subject: [PATCH 17/54] Prepare 2025.4 release (#238) --- CHANGELOG.rst | 11 +++++++++++ README.md | 2 +- python_docs_theme/__init__.py | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 74b09cad..e50c32bd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,17 @@ Changelog ========= +`2025.4 `_ +--------------------------------------------------------------------------- + +* Require Sphinx 7.3 by @AA-Turner in https://github.com/python/python-docs-theme/pull/221 +* Add support for Python 3.14 by @hugovk https://github.com/python/python-docs-theme/pull/236 +* Drop support for Python 3.10 and 3.11 by @hugovk in https://github.com/python/python-docs-theme/pull/234 +* Add a copy button to code samples by @tomasr8 in https://github.com/python/python-docs-theme/pull/231 +* Add missing i18n for copy button titles by @tomasr8 in https://github.com/python/python-docs-theme/pull/225 +* Use consistent line-height for light & dark theme by @tomasr8 in https://github.com/python/python-docs-theme/pull/227 +* Remove self-closing tags by @hugovk in https://github.com/python/python-docs-theme/pull/226 + `2025.2 `_ --------------------------------------------------------------------------- diff --git a/README.md b/README.md index 133daa0f..fedd7f76 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Python Docs Sphinx Theme This is the theme for the Python documentation. -It requires Python 3.10 or newer and Sphinx 7.3 or newer. +It requires Python 3.12 or newer and Sphinx 7.3 or newer. Note that when adopting this theme, you're also borrowing an element of the trust and credibility established by the CPython core developers over the diff --git a/python_docs_theme/__init__.py b/python_docs_theme/__init__.py index c5b5fe79..e4d06bed 100644 --- a/python_docs_theme/__init__.py +++ b/python_docs_theme/__init__.py @@ -7,7 +7,7 @@ from sphinx.application import Sphinx from sphinx.util.typing import ExtensionMetadata -__version__ = "2025.2" +__version__ = "2025.4" THEME_PATH = Path(__file__).resolve().parent From 14e4606a2ffcb8bdde6f9b61cb27642ec5482555 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Tue, 29 Apr 2025 15:18:52 +0300 Subject: [PATCH 18/54] Add licence metadata change to changelog (#239) --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e50c32bd..ec2ef10a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -11,6 +11,7 @@ Changelog * Add missing i18n for copy button titles by @tomasr8 in https://github.com/python/python-docs-theme/pull/225 * Use consistent line-height for light & dark theme by @tomasr8 in https://github.com/python/python-docs-theme/pull/227 * Remove self-closing tags by @hugovk in https://github.com/python/python-docs-theme/pull/226 +* Replace deprecated classifier with licence expression (PEP 639) by @hugovk in https://github.com/python/python-docs-theme/pull/237 `2025.2 `_ --------------------------------------------------------------------------- From d0eaa5e0aadb43167d1f24c805bf58bbf4811042 Mon Sep 17 00:00:00 2001 From: "Tomas R." Date: Wed, 30 Apr 2025 14:05:37 +0200 Subject: [PATCH 19/54] Fix copy button with multiple tracebacks (#240) --- python_docs_theme/static/copybutton.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_docs_theme/static/copybutton.js b/python_docs_theme/static/copybutton.js index 9df468ee..de071f48 100644 --- a/python_docs_theme/static/copybutton.js +++ b/python_docs_theme/static/copybutton.js @@ -8,7 +8,7 @@ function getCopyableText(rootElement) { for (const el of tracebacks) { while ( el.nextSibling && - (el.nextSibling.nodeType !== Node.DOCUMENT_NODE || + (el.nextSibling.nodeType !== Node.ELEMENT_NODE || !el.nextSibling.matches(".gp, .go")) ) { el.nextSibling.remove() From 5d0782523024d488e8a1126852f26d118a82b4b3 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Wed, 30 Apr 2025 15:14:26 +0300 Subject: [PATCH 20/54] Prepare 2025.4.1 release (#241) --- CHANGELOG.rst | 5 +++++ python_docs_theme/__init__.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ec2ef10a..fb43a9f1 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ Changelog ========= +`2025.4.1 `_ +------------------------------------------------------------------------------- + +* Fix copy button with multiple tracebacks by @tomasr8 in https://github.com/python/python-docs-theme/pull/240 + `2025.4 `_ --------------------------------------------------------------------------- diff --git a/python_docs_theme/__init__.py b/python_docs_theme/__init__.py index e4d06bed..75459e1a 100644 --- a/python_docs_theme/__init__.py +++ b/python_docs_theme/__init__.py @@ -7,7 +7,7 @@ from sphinx.application import Sphinx from sphinx.util.typing import ExtensionMetadata -__version__ = "2025.4" +__version__ = "2025.4.1" THEME_PATH = Path(__file__).resolve().parent From 42ade08824a02904332cea9b53886ddd2d4740c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20Hern=C3=A1ndez?= Date: Fri, 23 May 2025 08:33:50 -0400 Subject: [PATCH 21/54] Make copy button appear when hovered (#243) --- python_docs_theme/static/pydoctheme.css | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index 6d50092f..48731163 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -451,6 +451,7 @@ div.genindex-jumpbox a { color: #000; background-color: #fff; border: 1px solid #ac9; /* follows div.body pre */ + display: none; } .copybutton:hover { @@ -461,6 +462,14 @@ div.genindex-jumpbox a { background-color: #ddd; } +.highlight:active .copybutton { + display: block; +} + +.highlight:hover .copybutton { + display: block; +} + @media (max-width: 1023px) { /* Body layout */ div.body { From 8e361585ca0aeb491353252af2a8fd91c4c55316 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Tue, 27 May 2025 16:29:51 +0300 Subject: [PATCH 22/54] Prepare 2025.5 release (#244) --- CHANGELOG.rst | 5 +++++ python_docs_theme/__init__.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index fb43a9f1..07b2735e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ Changelog ========= +`2025.5 `_ +--------------------------------------------------------------------------- + +* Make the copy button only appear when hovered over or clicked on by @kevteg in https://github.com/python/python-docs-theme/pull/243 + `2025.4.1 `_ ------------------------------------------------------------------------------- diff --git a/python_docs_theme/__init__.py b/python_docs_theme/__init__.py index 75459e1a..2336dc1e 100644 --- a/python_docs_theme/__init__.py +++ b/python_docs_theme/__init__.py @@ -7,7 +7,7 @@ from sphinx.application import Sphinx from sphinx.util.typing import ExtensionMetadata -__version__ = "2025.4.1" +__version__ = "2025.5" THEME_PATH = Path(__file__).resolve().parent From 7c4e6c2fdc0c2dba0609016d38137a797e39fa53 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 18:40:33 +0300 Subject: [PATCH 23/54] Bump the actions group with 2 updates (#252) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- .github/workflows/pypi-package.yml | 4 ++-- .github/workflows/tests.yml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 88c0c7cb..795f7b0d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: actions/setup-python@v5 with: python-version: "3.x" diff --git a/.github/workflows/pypi-package.yml b/.github/workflows/pypi-package.yml index 744d49bd..e679e746 100644 --- a/.github/workflows/pypi-package.yml +++ b/.github/workflows/pypi-package.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: hynek/build-and-inspect-python-package@v2 @@ -41,7 +41,7 @@ jobs: steps: - name: Download packages built by build-and-inspect-python-package - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v5 with: name: Packages path: dist diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 23e6c7e6..83a33884 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,7 +14,7 @@ jobs: matrix: branch: ["3.14", "3.13", "3.12"] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: actions/setup-python@v5 with: python-version: ${{ matrix.branch }} @@ -59,7 +59,7 @@ jobs: # Test minimum supported and latest stable from 3.x series python-version: ["3.12", "3"] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} From 4f43aded34b3509c13b2f203cd5ff1496a7eeaab Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Sun, 7 Sep 2025 18:10:55 +0100 Subject: [PATCH 24/54] Enable theme translation (#246) Co-authored-by: Maciej Olko --- .github/workflows/pypi-package.yml | 7 + .github/workflows/tests.yml | 9 +- babel_runner.py | 33 +++-- python_docs_theme/__init__.py | 11 ++ .../pl/LC_MESSAGES/python-docs-theme.po | 127 ++++++++++++++++++ 5 files changed, 170 insertions(+), 17 deletions(-) create mode 100644 python_docs_theme/locale/pl/LC_MESSAGES/python-docs-theme.po diff --git a/.github/workflows/pypi-package.yml b/.github/workflows/pypi-package.yml index e679e746..bec94a2b 100644 --- a/.github/workflows/pypi-package.yml +++ b/.github/workflows/pypi-package.yml @@ -22,6 +22,13 @@ jobs: steps: - uses: actions/checkout@v5 + - uses: actions/setup-python@v5 + + - name: Compile translations + run: | + pip install --upgrade pip + pip install -r requirements.txt + python babel_runner.py compile - uses: hynek/build-and-inspect-python-package@v2 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 83a33884..60257eef 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -71,7 +71,7 @@ jobs: pip install -r requirements.txt - name: Remove locale file for testing shell: bash - run: rm -rf locales/pt_BR/ + run: rm -rf python_docs_theme/locale/pt_BR/ - run: python babel_runner.py extract - run: python babel_runner.py init -l pt_BR - run: python babel_runner.py update @@ -80,10 +80,7 @@ jobs: - run: python babel_runner.py compile -l pt_BR - name: Print .pot file shell: bash - run: cat locales/messages.pot + run: cat python_docs_theme/locale/python-docs-theme.pot - name: Print .po file shell: bash - run: cat locales/pt_BR/LC_MESSAGES/messages.po - - name: list files in locales dir - shell: bash - run: ls -R locales/ + run: cat python_docs_theme/locale/pt_BR/LC_MESSAGES/python-docs-theme.po diff --git a/babel_runner.py b/babel_runner.py index 0785ae2f..677f6da2 100755 --- a/babel_runner.py +++ b/babel_runner.py @@ -1,5 +1,5 @@ -#!/usr/bin/venv python3 """Script for handling translations with Babel""" + from __future__ import annotations import argparse @@ -8,18 +8,18 @@ import tomllib from pathlib import Path -PROJECT_DIR = Path(__file__).resolve().parent -PYPROJECT_TOML = PROJECT_DIR / "pyproject.toml" -INIT_PY = PROJECT_DIR / "python_docs_theme" / "__init__.py" - # Global variables used by pybabel below (paths relative to PROJECT_DIR) -DOMAIN = "messages" +DOMAIN = "python-docs-theme" COPYRIGHT_HOLDER = "Python Software Foundation" -LOCALES_DIR = "locales" -POT_FILE = Path(LOCALES_DIR, f"{DOMAIN}.pot") SOURCE_DIR = "python_docs_theme" MAPPING_FILE = ".babel.cfg" +PROJECT_DIR = Path(__file__).resolve().parent +PYPROJECT_TOML = Path(PROJECT_DIR, "pyproject.toml") +INIT_PY = PROJECT_DIR / SOURCE_DIR / "__init__.py" +LOCALES_DIR = Path(f"{SOURCE_DIR}", "locale") +POT_FILE = Path(LOCALES_DIR, f"{DOMAIN}.pot") + def get_project_info() -> dict: """Retrieve project's info to populate the message catalog template""" @@ -75,13 +75,24 @@ def init_locale(locale: str) -> None: if pofile.exists(): print(f"There is already a message catalog for locale {locale}, skipping.") return - cmd = ["pybabel", "init", "-i", POT_FILE, "-d", LOCALES_DIR, "-l", locale] + cmd = [ + "pybabel", + "init", + "-i", + POT_FILE, + "-d", + LOCALES_DIR, + "-D", + DOMAIN, + "-l", + locale, + ] subprocess.run(cmd, cwd=PROJECT_DIR, check=True) def update_catalogs(locale: str) -> None: """Update translations from existing message catalogs""" - cmd = ["pybabel", "update", "-i", POT_FILE, "-d", LOCALES_DIR] + cmd = ["pybabel", "update", "-i", POT_FILE, "-d", LOCALES_DIR, "-D", DOMAIN] if locale: cmd.extend(["-l", locale]) subprocess.run(cmd, cwd=PROJECT_DIR, check=True) @@ -89,7 +100,7 @@ def update_catalogs(locale: str) -> None: def compile_catalogs(locale: str) -> None: """Compile existing message catalogs""" - cmd = ["pybabel", "compile", "-d", LOCALES_DIR] + cmd = ["pybabel", "compile", "-d", LOCALES_DIR, "-D", DOMAIN] if locale: cmd.extend(["-l", locale]) subprocess.run(cmd, cwd=PROJECT_DIR, check=True) diff --git a/python_docs_theme/__init__.py b/python_docs_theme/__init__.py index 2336dc1e..6b80ad0a 100644 --- a/python_docs_theme/__init__.py +++ b/python_docs_theme/__init__.py @@ -2,6 +2,8 @@ from pathlib import Path +from sphinx.locale import get_translation + TYPE_CHECKING = False if TYPE_CHECKING: from sphinx.application import Sphinx @@ -10,12 +12,21 @@ __version__ = "2025.5" THEME_PATH = Path(__file__).resolve().parent +LOCALE_DIR = THEME_PATH / "locale" +MESSAGE_CATALOG_NAME = "python-docs-theme" def setup(app: Sphinx) -> ExtensionMetadata: app.require_sphinx("7.3") app.add_html_theme("python_docs_theme", str(THEME_PATH)) + app.add_message_catalog(MESSAGE_CATALOG_NAME, LOCALE_DIR) + + def add_translation_to_context(app, pagename, templatename, context, doctree): + _ = get_translation(MESSAGE_CATALOG_NAME) + context["_"] = context["gettext"] = context["ngettext"] = _ + + app.connect("html-page-context", add_translation_to_context) return { "version": __version__, diff --git a/python_docs_theme/locale/pl/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/pl/LC_MESSAGES/python-docs-theme.po new file mode 100644 index 00000000..cb74d912 --- /dev/null +++ b/python_docs_theme/locale/pl/LC_MESSAGES/python-docs-theme.po @@ -0,0 +1,127 @@ +# Polish (Poland) translations for python-docs-theme. +# Copyright (C) 2025 Python Software Foundation +# This file is distributed under the same license as the python-docs-theme +# project. +# Stan Ulbrych, 2025. +# +msgid "" +msgstr "" +"Project-Id-Version: python-docs-theme 2025.5\n" +"Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/issues\n" +"POT-Creation-Date: 2025-08-07 19:09+0200\n" +"PO-Revision-Date: 2025-08-07 15:11+0200\n" +"Last-Translator: Stan Ulbrych \n" +"Language: pl\n" +"Language-Team: pl \n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && " +"(n%100<10 || n%100>=20) ? 1 : 2);\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.16.0\n" + +#: python_docs_theme/footerdonate.html:1 +msgid "The Python Software Foundation is a non-profit corporation." +msgstr "Python Software Foundation jest organizacją non-profit." + +#: python_docs_theme/footerdonate.html:2 +msgid "Please donate." +msgstr "Prosimy o wsparcie." + +#: python_docs_theme/layout.html:6 +msgid "Navigation" +msgstr "Nawigacja" + +#: python_docs_theme/layout.html:51 python_docs_theme/layout.html:111 +msgid "Quick search" +msgstr "Szybkie wyszukiwanie" + +#: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112 +msgid "Go" +msgstr "Szukaj" + +#: python_docs_theme/layout.html:60 +msgid "Theme" +msgstr "Motyw" + +#: python_docs_theme/layout.html:62 +msgid "Auto" +msgstr "auto" + +#: python_docs_theme/layout.html:63 +msgid "Light" +msgstr "jasny" + +#: python_docs_theme/layout.html:64 +msgid "Dark" +msgstr "ciemny" + +#: python_docs_theme/layout.html:96 +msgid "Menu" +msgstr "Menu" + +#: python_docs_theme/layout.html:142 +msgid "Copyright" +msgstr "Prawa autorskie" + +#: python_docs_theme/layout.html:147 +msgid "" +"This page is licensed under the Python Software Foundation License " +"Version 2." +msgstr "" +"Ta strona jest objęta licencją Python Software " +"Foundation w wersji 2." + +#: python_docs_theme/layout.html:149 +msgid "" +"Examples, recipes, and other code in the documentation are additionally " +"licensed under the Zero Clause BSD License." +msgstr "" +"Przykłady, przepisy i inny kod w dokumentacji są dodatkowo objęte " +"licencją Zero Clause BSD." + +#: python_docs_theme/layout.html:152 +#, python-format +msgid "" +"See History and License for more " +"information." +msgstr "" +"Zobacz Historię i licencję aby uzyskać " +"więcej informacji." + +#: python_docs_theme/layout.html:155 +#, python-format +msgid "Hosted on %(hosted_on)s." +msgstr "Hostowane na %(hosted_on)s." + +#: python_docs_theme/layout.html:163 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "Ostatnia aktualizacja %(last_updated)s." + +#: python_docs_theme/layout.html:166 +#, python-format +msgid "Found a bug?" +msgstr "Znalazłeś(-aś) błąd?" + +#: python_docs_theme/layout.html:170 +#, python-format +msgid "" +"Created using Sphinx " +"%(sphinx_version)s." +msgstr "" +"Stworzone za pomocą Sphinx " +"%(sphinx_version)s." + +#: python_docs_theme/static/copybutton.js:30 +#: python_docs_theme/static/copybutton.js:55 +msgid "Copy" +msgstr "Kopiuj" + +#: python_docs_theme/static/copybutton.js:31 +msgid "Copy to clipboard" +msgstr "Skopiuj do schowka" + +#: python_docs_theme/static/copybutton.js:53 +msgid "Copied!" +msgstr "Skopiowano!" From 663d34655eabb6379355b6b442485a8ee4e218cc Mon Sep 17 00:00:00 2001 From: Daniel Nylander Date: Sun, 7 Sep 2025 19:44:50 +0200 Subject: [PATCH 25/54] Adding Swedish translation (#250) --- .../locales/sv_SE/LC_MESSAGES/messages.po | 128 ++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 python_docs_theme/locales/sv_SE/LC_MESSAGES/messages.po diff --git a/python_docs_theme/locales/sv_SE/LC_MESSAGES/messages.po b/python_docs_theme/locales/sv_SE/LC_MESSAGES/messages.po new file mode 100644 index 00000000..7bf73ef1 --- /dev/null +++ b/python_docs_theme/locales/sv_SE/LC_MESSAGES/messages.po @@ -0,0 +1,128 @@ +# Swedish translations for python-docs-theme. +# Copyright (C) 2025 Python Software Foundation +# This file is distributed under the same license as the python-docs-theme +# project. +# Daniel Nylander, 2025. +# +msgid "" +msgstr "" +"Project-Id-Version: python-docs-theme 2025.5\n" +"Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/" +"issues\n" +"POT-Creation-Date: 2025-08-07 19:09+0200\n" +"PO-Revision-Date: 2025-08-29 07:03+0200\n" +"Last-Translator: Daniel Nylander \n" +"Language-Team: sv\n" +"Language: sv\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Generated-By: Babel 2.16.0\n" +"X-Generator: Poedit 3.7\n" + +#: python_docs_theme/footerdonate.html:1 +msgid "The Python Software Foundation is a non-profit corporation." +msgstr "Python Software Foundation är ett icke-vinstdrivande företag." + +#: python_docs_theme/footerdonate.html:2 +msgid "Please donate." +msgstr "Donera." + +#: python_docs_theme/layout.html:6 +msgid "Navigation" +msgstr "Navigering" + +#: python_docs_theme/layout.html:51 python_docs_theme/layout.html:111 +msgid "Quick search" +msgstr "Snabbsök" + +#: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112 +msgid "Go" +msgstr "Start" + +#: python_docs_theme/layout.html:60 +msgid "Theme" +msgstr "Tema" + +#: python_docs_theme/layout.html:62 +msgid "Auto" +msgstr "Auto" + +#: python_docs_theme/layout.html:63 +msgid "Light" +msgstr "Ljus" + +#: python_docs_theme/layout.html:64 +msgid "Dark" +msgstr "Mörk" + +#: python_docs_theme/layout.html:96 +msgid "Menu" +msgstr "Meny" + +#: python_docs_theme/layout.html:142 +msgid "Copyright" +msgstr "Upphovsrätt" + +#: python_docs_theme/layout.html:147 +msgid "" +"This page is licensed under the Python Software Foundation License " +"Version 2." +msgstr "" +"Denna sida är licensierad enligt Python Software Foundation License " +"version 2." + +#: python_docs_theme/layout.html:149 +msgid "" +"Examples, recipes, and other code in the documentation are additionally " +"licensed under the Zero Clause BSD License." +msgstr "" +"Exempel, recept och annan kod i dokumentationen är dessutom " +"licensierade under Zero Clause BSD-licensen." + +#: python_docs_theme/layout.html:152 +#, python-format +msgid "" +"See History and License for more " +"information." +msgstr "" +"Se Historik och licens för mer " +"information." + +#: python_docs_theme/layout.html:155 +#, python-format +msgid "Hosted on %(hosted_on)s." +msgstr "Hosting %(hosted_on)s." + +#: python_docs_theme/layout.html:163 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "Senast uppdaterad %(last_updated)s." + +#: python_docs_theme/layout.html:166 +#, python-format +msgid "Found a bug?" +msgstr "Har du hittat ett fel?" + +#: python_docs_theme/layout.html:170 +#, python-format +msgid "" +"Created using Sphinx " +"%(sphinx_version)s." +msgstr "" +"Skapad med hjälp av Sphinx " +"%(sphinx_version)s." + +#: python_docs_theme/static/copybutton.js:30 +#: python_docs_theme/static/copybutton.js:55 +msgid "Copy" +msgstr "Kopiera" + +#: python_docs_theme/static/copybutton.js:31 +msgid "Copy to clipboard" +msgstr "Kopiera till urklipp" + +#: python_docs_theme/static/copybutton.js:53 +msgid "Copied!" +msgstr "Kopierad!" From 2518cd7d7bac6c2b888914984c886e0b5f06e056 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Sun, 7 Sep 2025 19:18:58 +0100 Subject: [PATCH 26/54] Pull translations from Transifex (#253) --- .../pt_BR/LC_MESSAGES/python-docs-theme.po | 131 ++++++++++++++++++ .../sv/LC_MESSAGES/python-docs-theme.po} | 0 .../zh_CN/LC_MESSAGES/python-docs-theme.po | 123 ++++++++++++++++ .../zh_TW/LC_MESSAGES/python-docs-theme.po | 123 ++++++++++++++++ 4 files changed, 377 insertions(+) create mode 100644 python_docs_theme/locale/pt_BR/LC_MESSAGES/python-docs-theme.po rename python_docs_theme/{locales/sv_SE/LC_MESSAGES/messages.po => locale/sv/LC_MESSAGES/python-docs-theme.po} (100%) create mode 100644 python_docs_theme/locale/zh_CN/LC_MESSAGES/python-docs-theme.po create mode 100644 python_docs_theme/locale/zh_TW/LC_MESSAGES/python-docs-theme.po diff --git a/python_docs_theme/locale/pt_BR/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/pt_BR/LC_MESSAGES/python-docs-theme.po new file mode 100644 index 00000000..2ce0936d --- /dev/null +++ b/python_docs_theme/locale/pt_BR/LC_MESSAGES/python-docs-theme.po @@ -0,0 +1,131 @@ +# Translations template for python-docs-theme. +# Copyright (C) 2025 Python Software Foundation +# This file is distributed under the same license as the python-docs-theme +# project. +# FIRST AUTHOR , 2025. +# +# Translators: +# Alexsey Batista da Silva, 2025 +# Rafael Fontenelle , 2025 +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: python-docs-theme 2025.5\n" +"Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/issues\n" +"POT-Creation-Date: 2025-09-06 08:40+0100\n" +"PO-Revision-Date: 2025-09-06 07:41+0000\n" +"Last-Translator: Rafael Fontenelle , 2025\n" +"Language-Team: Portuguese (Brazil) (https://app.transifex.com/python-doc/teams/5390/pt_BR/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.16.0\n" +"Language: pt_BR\n" +"Plural-Forms: nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n" + +#: python_docs_theme/footerdonate.html:1 +msgid "The Python Software Foundation is a non-profit corporation." +msgstr "A Python Software Foundation é uma corporação sem fins lucrativos." + +#: python_docs_theme/footerdonate.html:2 +msgid "Please donate." +msgstr "Por favor, faça sua doação." + +#: python_docs_theme/layout.html:6 +msgid "Navigation" +msgstr "Navegação" + +#: python_docs_theme/layout.html:51 python_docs_theme/layout.html:111 +msgid "Quick search" +msgstr "Pesquisa rápida" + +#: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112 +msgid "Go" +msgstr "Ir" + +#: python_docs_theme/layout.html:60 +msgid "Theme" +msgstr "Tema" + +#: python_docs_theme/layout.html:62 +msgid "Auto" +msgstr "Automático" + +#: python_docs_theme/layout.html:63 +msgid "Light" +msgstr "Claro" + +#: python_docs_theme/layout.html:64 +msgid "Dark" +msgstr "Escuro" + +#: python_docs_theme/layout.html:96 +msgid "Menu" +msgstr "Menu" + +#: python_docs_theme/layout.html:142 +msgid "Copyright" +msgstr "Direitos autorais" + +#: python_docs_theme/layout.html:147 +msgid "" +"This page is licensed under the Python Software Foundation License Version " +"2." +msgstr "" +"Esta página está licenciada sob a Licença da Python Software Foundation " +"Versão 2." + +#: python_docs_theme/layout.html:149 +msgid "" +"Examples, recipes, and other code in the documentation are additionally " +"licensed under the Zero Clause BSD License." +msgstr "" +"Exemplos, receitas e outros códigos na documentação são licenciados " +"adicionalmente sob a licença BSD Zero Clause." + +#: python_docs_theme/layout.html:152 +#, python-format +msgid "" +"See History and License for more " +"information." +msgstr "" +"Consulte Histórico e licença para obter " +"mais informações." + +#: python_docs_theme/layout.html:155 +#, python-format +msgid "Hosted on %(hosted_on)s." +msgstr "Hospedado em %(hosted_on)s." + +#: python_docs_theme/layout.html:163 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "Última atualização em %(last_updated)s." + +#: python_docs_theme/layout.html:166 +#, python-format +msgid "Found a bug?" +msgstr "Encontrou um erro?" + +#: python_docs_theme/layout.html:170 +#, python-format +msgid "" +"Created using Sphinx " +"%(sphinx_version)s." +msgstr "" +"Criado usando o Sphinx " +"%(sphinx_version)s." + +#: python_docs_theme/static/copybutton.js:30 +#: python_docs_theme/static/copybutton.js:55 +msgid "Copy" +msgstr "Copiar" + +#: python_docs_theme/static/copybutton.js:31 +msgid "Copy to clipboard" +msgstr "Copiar para a área de transferência" + +#: python_docs_theme/static/copybutton.js:53 +msgid "Copied!" +msgstr "Copiado!" diff --git a/python_docs_theme/locales/sv_SE/LC_MESSAGES/messages.po b/python_docs_theme/locale/sv/LC_MESSAGES/python-docs-theme.po similarity index 100% rename from python_docs_theme/locales/sv_SE/LC_MESSAGES/messages.po rename to python_docs_theme/locale/sv/LC_MESSAGES/python-docs-theme.po diff --git a/python_docs_theme/locale/zh_CN/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/zh_CN/LC_MESSAGES/python-docs-theme.po new file mode 100644 index 00000000..8fb52a40 --- /dev/null +++ b/python_docs_theme/locale/zh_CN/LC_MESSAGES/python-docs-theme.po @@ -0,0 +1,123 @@ +# Translations template for python-docs-theme. +# Copyright (C) 2025 Python Software Foundation +# This file is distributed under the same license as the python-docs-theme +# project. +# FIRST AUTHOR , 2025. +# +# Translators: +# 汇民 王 , 2025 +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: python-docs-theme 2025.5\n" +"Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/issues\n" +"POT-Creation-Date: 2025-09-06 08:40+0100\n" +"PO-Revision-Date: 2025-09-06 07:41+0000\n" +"Last-Translator: 汇民 王 , 2025\n" +"Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.16.0\n" +"Language: zh_CN\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: python_docs_theme/footerdonate.html:1 +msgid "The Python Software Foundation is a non-profit corporation." +msgstr "Python 软件基金会是一家非营利性公司。" + +#: python_docs_theme/footerdonate.html:2 +msgid "Please donate." +msgstr "请进行捐赠。" + +#: python_docs_theme/layout.html:6 +msgid "Navigation" +msgstr "导航" + +#: python_docs_theme/layout.html:51 python_docs_theme/layout.html:111 +msgid "Quick search" +msgstr "快速搜索" + +#: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112 +msgid "Go" +msgstr "转到" + +#: python_docs_theme/layout.html:60 +msgid "Theme" +msgstr "主题" + +#: python_docs_theme/layout.html:62 +msgid "Auto" +msgstr "自动" + +#: python_docs_theme/layout.html:63 +msgid "Light" +msgstr "明亮" + +#: python_docs_theme/layout.html:64 +msgid "Dark" +msgstr "黑暗" + +#: python_docs_theme/layout.html:96 +msgid "Menu" +msgstr "菜单" + +#: python_docs_theme/layout.html:142 +msgid "Copyright" +msgstr "版权" + +#: python_docs_theme/layout.html:147 +msgid "" +"This page is licensed under the Python Software Foundation License Version " +"2." +msgstr "本页面采用 Python 软件基金会许可证第 2 版授权。" + +#: python_docs_theme/layout.html:149 +msgid "" +"Examples, recipes, and other code in the documentation are additionally " +"licensed under the Zero Clause BSD License." +msgstr "文档中的示例、代码片段及其他代码内容额外采用零条款 BSD 许可证授权。" + +#: python_docs_theme/layout.html:152 +#, python-format +msgid "" +"See History and License for more " +"information." +msgstr "更多信息请参阅《 历史与许可 》。" + +#: python_docs_theme/layout.html:155 +#, python-format +msgid "Hosted on %(hosted_on)s." +msgstr "托管在%(hosted_on)s 上。" + +#: python_docs_theme/layout.html:163 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "最后更新于%(last_updated)s 。" + +#: python_docs_theme/layout.html:166 +#, python-format +msgid "Found a bug?" +msgstr "发现了错误?" + +#: python_docs_theme/layout.html:170 +#, python-format +msgid "" +"Created using Sphinx " +"%(sphinx_version)s." +msgstr "" +"使用Sphinx %(sphinx_version)s 创建。" + +#: python_docs_theme/static/copybutton.js:30 +#: python_docs_theme/static/copybutton.js:55 +msgid "Copy" +msgstr "复制" + +#: python_docs_theme/static/copybutton.js:31 +msgid "Copy to clipboard" +msgstr "复制到剪贴板" + +#: python_docs_theme/static/copybutton.js:53 +msgid "Copied!" +msgstr "已复制!" diff --git a/python_docs_theme/locale/zh_TW/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/zh_TW/LC_MESSAGES/python-docs-theme.po new file mode 100644 index 00000000..719074c6 --- /dev/null +++ b/python_docs_theme/locale/zh_TW/LC_MESSAGES/python-docs-theme.po @@ -0,0 +1,123 @@ +# Translations template for python-docs-theme. +# Copyright (C) 2025 Python Software Foundation +# This file is distributed under the same license as the python-docs-theme +# project. +# FIRST AUTHOR , 2025. +# +# Translators: +# W. H. Wang , 2025 +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: python-docs-theme 2025.5\n" +"Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/issues\n" +"POT-Creation-Date: 2025-09-06 08:40+0100\n" +"PO-Revision-Date: 2025-09-06 07:41+0000\n" +"Last-Translator: W. H. Wang , 2025\n" +"Language-Team: Chinese (Taiwan) (https://app.transifex.com/python-doc/teams/5390/zh_TW/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.16.0\n" +"Language: zh_TW\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: python_docs_theme/footerdonate.html:1 +msgid "The Python Software Foundation is a non-profit corporation." +msgstr "Python 軟體基金會是一家非營利法人。" + +#: python_docs_theme/footerdonate.html:2 +msgid "Please donate." +msgstr "敬請捐贈。" + +#: python_docs_theme/layout.html:6 +msgid "Navigation" +msgstr "導航" + +#: python_docs_theme/layout.html:51 python_docs_theme/layout.html:111 +msgid "Quick search" +msgstr "快速搜索" + +#: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112 +msgid "Go" +msgstr "Go" + +#: python_docs_theme/layout.html:60 +msgid "Theme" +msgstr "主題" + +#: python_docs_theme/layout.html:62 +msgid "Auto" +msgstr "自動" + +#: python_docs_theme/layout.html:63 +msgid "Light" +msgstr "淺色模式" + +#: python_docs_theme/layout.html:64 +msgid "Dark" +msgstr "深色模式" + +#: python_docs_theme/layout.html:96 +msgid "Menu" +msgstr "選單" + +#: python_docs_theme/layout.html:142 +msgid "Copyright" +msgstr "版權所有" + +#: python_docs_theme/layout.html:147 +msgid "" +"This page is licensed under the Python Software Foundation License Version " +"2." +msgstr "此頁面採用 Python 軟體基金會授權條款第 2 版。" + +#: python_docs_theme/layout.html:149 +msgid "" +"Examples, recipes, and other code in the documentation are additionally " +"licensed under the Zero Clause BSD License." +msgstr "文件中的範例、應用技巧與其他程式碼額外採用了 Zero Clause BSD 授權條款。" + +#: python_docs_theme/layout.html:152 +#, python-format +msgid "" +"See History and License for more " +"information." +msgstr "更多訊息請見歷史與授權條款。" + +#: python_docs_theme/layout.html:155 +#, python-format +msgid "Hosted on %(hosted_on)s." +msgstr "託管於 %(hosted_on)s。" + +#: python_docs_theme/layout.html:163 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "最後更新於 %(last_updated)s。" + +#: python_docs_theme/layout.html:166 +#, python-format +msgid "Found a bug?" +msgstr "發現 bug?" + +#: python_docs_theme/layout.html:170 +#, python-format +msgid "" +"Created using Sphinx " +"%(sphinx_version)s." +msgstr "" +"以 Sphinx%(sphinx_version)s建立。 " + +#: python_docs_theme/static/copybutton.js:30 +#: python_docs_theme/static/copybutton.js:55 +msgid "Copy" +msgstr "複製" + +#: python_docs_theme/static/copybutton.js:31 +msgid "Copy to clipboard" +msgstr "複製到剪貼板" + +#: python_docs_theme/static/copybutton.js:53 +msgid "Copied!" +msgstr "已複製!" From 24457674506a7ad3ceab5cb65b2e89b42a035dc0 Mon Sep 17 00:00:00 2001 From: Lysandros Nikolaou Date: Mon, 8 Sep 2025 10:39:48 +0300 Subject: [PATCH 27/54] Add Greek translation (#256) --- .../el/LC_MESSAGES/python-docs-theme.po | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 python_docs_theme/locale/el/LC_MESSAGES/python-docs-theme.po diff --git a/python_docs_theme/locale/el/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/el/LC_MESSAGES/python-docs-theme.po new file mode 100644 index 00000000..c7127f55 --- /dev/null +++ b/python_docs_theme/locale/el/LC_MESSAGES/python-docs-theme.po @@ -0,0 +1,126 @@ +# Greek translations for python-docs-theme. +# Copyright (C) 2025 Python Software Foundation +# This file is distributed under the same license as the python-docs-theme +# project. +# Lysandros Nikolaou , 2025. +# +msgid "" +msgstr "" +"Project-Id-Version: python-docs-theme 2025.5\n" +"Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/issues\n" +"POT-Creation-Date: 2025-09-08 10:23+0300\n" +"PO-Revision-Date: 2025-09-08 10:23+0300\n" +"Last-Translator: Lysandros Nikolaou \n" +"Language: el\n" +"Language-Team: PyGreece \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: python_docs_theme/footerdonate.html:1 +msgid "The Python Software Foundation is a non-profit corporation." +msgstr "Το Python Software Foundation είναι ένας μη κερδοσκοπικός οργανισμός." + +#: python_docs_theme/footerdonate.html:2 +msgid "Please donate." +msgstr "Παρακαλώ κάντε μια δωρεά." + +#: python_docs_theme/layout.html:6 +msgid "Navigation" +msgstr "Πλοήγηση" + +#: python_docs_theme/layout.html:51 python_docs_theme/layout.html:111 +msgid "Quick search" +msgstr "Γρήγορη αναζήτηση" + +#: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112 +msgid "Go" +msgstr "Πήγαινε" + +#: python_docs_theme/layout.html:60 +msgid "Theme" +msgstr "Θέμα" + +#: python_docs_theme/layout.html:62 +msgid "Auto" +msgstr "Αυτόματα" + +#: python_docs_theme/layout.html:63 +msgid "Light" +msgstr "Ανοιχτό" + +#: python_docs_theme/layout.html:64 +msgid "Dark" +msgstr "Σκούρο" + +#: python_docs_theme/layout.html:96 +msgid "Menu" +msgstr "Μενού" + +#: python_docs_theme/layout.html:142 +msgid "Copyright" +msgstr "Πνευματικά δικαιώματα" + +#: python_docs_theme/layout.html:147 +msgid "" +"This page is licensed under the Python Software Foundation License " +"Version 2." +msgstr "" +"Η σελίδα αυτή διατίθεται υπό την άδεια χρήσης του Python Software " +"Foundation, 2η έκδοση." + +#: python_docs_theme/layout.html:149 +msgid "" +"Examples, recipes, and other code in the documentation are additionally " +"licensed under the Zero Clause BSD License." +msgstr "" +"Παραδείγματα, οδηγοί και λοιπά κομμάτια κώδικα στην τεκμηρίωση διατίθενται " +"επιπλέον υπό την άδεια χρήσης Zero Clause BSD." + +#: python_docs_theme/layout.html:152 +#, python-format +msgid "" +"See History and License for more " +"information." +msgstr "" +"Δες την Ιστορία και Άδεια χρήσης για " +"περισσότερες πληροφορίες." + +#: python_docs_theme/layout.html:155 +#, python-format +msgid "Hosted on %(hosted_on)s." +msgstr "Φιλοξενείται στο %(hosted_on)s." + +#: python_docs_theme/layout.html:163 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "Τελευταία ενημέρωση στις %(last_updated)s." + +#: python_docs_theme/layout.html:166 +#, python-format +msgid "Found a bug?" +msgstr "Βρήκες ένα bug?" + +#: python_docs_theme/layout.html:170 +#, python-format +msgid "" +"Created using Sphinx " +"%(sphinx_version)s." +msgstr "" +"Δημιουργήθηκε με την χρήση του Sphinx " +"%(sphinx_version)s." + +#: python_docs_theme/static/copybutton.js:30 +#: python_docs_theme/static/copybutton.js:55 +msgid "Copy" +msgstr "Αντιγραφή" + +#: python_docs_theme/static/copybutton.js:31 +msgid "Copy to clipboard" +msgstr "Αντιγραφή στο πρόχειρο" + +#: python_docs_theme/static/copybutton.js:53 +msgid "Copied!" +msgstr "Αντιγράφηκε!" From 803833f38cd1b1b6b8b853f2c1df6790d09b42c0 Mon Sep 17 00:00:00 2001 From: Panagiotis Skias Date: Mon, 8 Sep 2025 11:13:01 +0300 Subject: [PATCH 28/54] Minor fixes for Greek translation (#257) --- python_docs_theme/locale/el/LC_MESSAGES/python-docs-theme.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python_docs_theme/locale/el/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/el/LC_MESSAGES/python-docs-theme.po index c7127f55..5ade8b82 100644 --- a/python_docs_theme/locale/el/LC_MESSAGES/python-docs-theme.po +++ b/python_docs_theme/locale/el/LC_MESSAGES/python-docs-theme.po @@ -37,7 +37,7 @@ msgstr "Γρήγορη αναζήτηση" #: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112 msgid "Go" -msgstr "Πήγαινε" +msgstr "Μετάβαση" #: python_docs_theme/layout.html:60 msgid "Theme" @@ -49,7 +49,7 @@ msgstr "Αυτόματα" #: python_docs_theme/layout.html:63 msgid "Light" -msgstr "Ανοιχτό" +msgstr "Φωτεινό" #: python_docs_theme/layout.html:64 msgid "Dark" From 44303e12a75c6d5e1319774a258f1d05b4c2518b Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Mon, 8 Sep 2025 20:54:18 +0300 Subject: [PATCH 29/54] Prepare 2025.9 release (#254) Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> --- CHANGELOG.rst | 8 ++++++++ python_docs_theme/__init__.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 07b2735e..696bb883 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,14 @@ Changelog ========= +`2025.9 `_ +--------------------------------------------------------------------------- + +* Enable theme translation and add Polish by @StanFromIreland in https://github.com/python/python-docs-theme/pull/246 +* Add Greek translation by @lysnikolaou and @skpanagiotis in https://github.com/python/python-docs-theme/pull/256 and https://github.com/python/python-docs-theme/pull/257 +* Add Swedish translation by @yeager in https://github.com/python/python-docs-theme/pull/250 +* Pull Brazilian Portuguese, Simplified Chinese, Traditional Chinese, Japanese, Turkish and Spanish translations from `Transifex `_ in https://github.com/python/python-docs-theme/pull/253 and https://github.com/python/python-docs-theme/pull/259 + `2025.5 `_ --------------------------------------------------------------------------- diff --git a/python_docs_theme/__init__.py b/python_docs_theme/__init__.py index 6b80ad0a..cc11f5e9 100644 --- a/python_docs_theme/__init__.py +++ b/python_docs_theme/__init__.py @@ -9,7 +9,7 @@ from sphinx.application import Sphinx from sphinx.util.typing import ExtensionMetadata -__version__ = "2025.5" +__version__ = "2025.9" THEME_PATH = Path(__file__).resolve().parent LOCALE_DIR = THEME_PATH / "locale" From a955b8c4e69e843d4b079e950e08122901aa4a10 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Mon, 8 Sep 2025 20:15:06 +0100 Subject: [PATCH 30/54] Adds, Spanish, Turkish and Japanese from Transifex (#259) --- .../es/LC_MESSAGES/python-docs-theme.po | 128 +++++++++++++++++ .../ja/LC_MESSAGES/python-docs-theme.po | 124 +++++++++++++++++ .../pl/LC_MESSAGES/python-docs-theme.po | 35 ++--- .../tr/LC_MESSAGES/python-docs-theme.po | 130 ++++++++++++++++++ 4 files changed, 400 insertions(+), 17 deletions(-) create mode 100644 python_docs_theme/locale/es/LC_MESSAGES/python-docs-theme.po create mode 100644 python_docs_theme/locale/ja/LC_MESSAGES/python-docs-theme.po create mode 100644 python_docs_theme/locale/tr/LC_MESSAGES/python-docs-theme.po diff --git a/python_docs_theme/locale/es/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/es/LC_MESSAGES/python-docs-theme.po new file mode 100644 index 00000000..34fc30ef --- /dev/null +++ b/python_docs_theme/locale/es/LC_MESSAGES/python-docs-theme.po @@ -0,0 +1,128 @@ +# Translations template for python-docs-theme. +# Copyright (C) 2025 Python Software Foundation +# This file is distributed under the same license as the python-docs-theme +# project. +# FIRST AUTHOR , 2025. +# +# Translators: +# Cristián Maureira-Fredes, 2025 +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: python-docs-theme 2025.5\n" +"Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/issues\n" +"POT-Creation-Date: 2025-09-06 08:40+0100\n" +"PO-Revision-Date: 2025-09-06 07:41+0000\n" +"Last-Translator: Cristián Maureira-Fredes, 2025\n" +"Language-Team: Spanish (https://app.transifex.com/python-doc/teams/5390/es/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.16.0\n" +"Language: es\n" +"Plural-Forms: nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n" + +#: python_docs_theme/footerdonate.html:1 +msgid "The Python Software Foundation is a non-profit corporation." +msgstr "La Python Software Foundation es una corporación sin fines de lucro." + +#: python_docs_theme/footerdonate.html:2 +msgid "Please donate." +msgstr "Por favor dona." + +#: python_docs_theme/layout.html:6 +msgid "Navigation" +msgstr "Navegación" + +#: python_docs_theme/layout.html:51 python_docs_theme/layout.html:111 +msgid "Quick search" +msgstr "Búsqueda rápida" + +#: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112 +msgid "Go" +msgstr "Ir" + +#: python_docs_theme/layout.html:60 +msgid "Theme" +msgstr "Tema" + +#: python_docs_theme/layout.html:62 +msgid "Auto" +msgstr "Auto" + +#: python_docs_theme/layout.html:63 +msgid "Light" +msgstr "Claro" + +#: python_docs_theme/layout.html:64 +msgid "Dark" +msgstr "Oscuro" + +#: python_docs_theme/layout.html:96 +msgid "Menu" +msgstr "Menú" + +#: python_docs_theme/layout.html:142 +msgid "Copyright" +msgstr "Derechos de autor" + +#: python_docs_theme/layout.html:147 +msgid "" +"This page is licensed under the Python Software Foundation License Version " +"2." +msgstr "Ésta página tiene la licencia Python Software Foundation Versión 2." + +#: python_docs_theme/layout.html:149 +msgid "" +"Examples, recipes, and other code in the documentation are additionally " +"licensed under the Zero Clause BSD License." +msgstr "" +"Ejemplos, guías, y otro código en la documentación están bajo la licencia " +"adicional Zero Clause BSD." + +#: python_docs_theme/layout.html:152 +#, python-format +msgid "" +"See History and License for more " +"information." +msgstr "" +"Ver Historia y Licencia para más " +"información." + +#: python_docs_theme/layout.html:155 +#, python-format +msgid "Hosted on %(hosted_on)s." +msgstr "Hospedado en %(hosted_on)s." + +#: python_docs_theme/layout.html:163 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "Última actualización en %(last_updated)s." + +#: python_docs_theme/layout.html:166 +#, python-format +msgid "Found a bug?" +msgstr "Encontraste un bug?" + +#: python_docs_theme/layout.html:170 +#, python-format +msgid "" +"Created using Sphinx " +"%(sphinx_version)s." +msgstr "" +"Creado usando Sphinx%(sphinx_version)s." + +#: python_docs_theme/static/copybutton.js:30 +#: python_docs_theme/static/copybutton.js:55 +msgid "Copy" +msgstr "Copiar" + +#: python_docs_theme/static/copybutton.js:31 +msgid "Copy to clipboard" +msgstr "Copiar al portapapeles" + +#: python_docs_theme/static/copybutton.js:53 +msgid "Copied!" +msgstr "¡Copiado!" diff --git a/python_docs_theme/locale/ja/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/ja/LC_MESSAGES/python-docs-theme.po new file mode 100644 index 00000000..dfea8575 --- /dev/null +++ b/python_docs_theme/locale/ja/LC_MESSAGES/python-docs-theme.po @@ -0,0 +1,124 @@ +# Translations template for python-docs-theme. +# Copyright (C) 2025 Python Software Foundation +# This file is distributed under the same license as the python-docs-theme +# project. +# FIRST AUTHOR , 2025. +# +# Translators: +# Inada Naoki , 2025 +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: python-docs-theme 2025.5\n" +"Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/issues\n" +"POT-Creation-Date: 2025-09-06 08:40+0100\n" +"PO-Revision-Date: 2025-09-06 07:41+0000\n" +"Last-Translator: Inada Naoki , 2025\n" +"Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/ja/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.16.0\n" +"Language: ja\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: python_docs_theme/footerdonate.html:1 +msgid "The Python Software Foundation is a non-profit corporation." +msgstr "Pythonソフトウェア財団は非営利法人です。" + +#: python_docs_theme/footerdonate.html:2 +msgid "Please donate." +msgstr "寄付をするには" + +#: python_docs_theme/layout.html:6 +msgid "Navigation" +msgstr "Navigation" + +#: python_docs_theme/layout.html:51 python_docs_theme/layout.html:111 +msgid "Quick search" +msgstr "検索" + +#: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112 +msgid "Go" +msgstr "Go" + +#: python_docs_theme/layout.html:60 +msgid "Theme" +msgstr "テーマ" + +#: python_docs_theme/layout.html:62 +msgid "Auto" +msgstr "自動" + +#: python_docs_theme/layout.html:63 +msgid "Light" +msgstr "ライト" + +#: python_docs_theme/layout.html:64 +msgid "Dark" +msgstr "ダーク" + +#: python_docs_theme/layout.html:96 +msgid "Menu" +msgstr "メニュー" + +#: python_docs_theme/layout.html:142 +msgid "Copyright" +msgstr "Copyright" + +#: python_docs_theme/layout.html:147 +msgid "" +"This page is licensed under the Python Software Foundation License Version " +"2." +msgstr "このページはPython Software Foundation License Version 2でライセンスされています。" + +#: python_docs_theme/layout.html:149 +msgid "" +"Examples, recipes, and other code in the documentation are additionally " +"licensed under the Zero Clause BSD License." +msgstr "ドキュメント内のサンプル、レシピ等のコードは、Zero Clause BSDライセンスの下で追加的にライセンスされています。" + +#: python_docs_theme/layout.html:152 +#, python-format +msgid "" +"See History and License for more " +"information." +msgstr "詳しくは歴史とライセンスを参照してください。" + +#: python_docs_theme/layout.html:155 +#, python-format +msgid "Hosted on %(hosted_on)s." +msgstr "%(hosted_on)sにてホストされています。" + +#: python_docs_theme/layout.html:163 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "最終更新日: %(last_updated)s" + +#: python_docs_theme/layout.html:166 +#, python-format +msgid "Found a bug?" +msgstr "バグを報告する" + +#: python_docs_theme/layout.html:170 +#, python-format +msgid "" +"Created using Sphinx " +"%(sphinx_version)s." +msgstr "" +"Sphinx%(sphinx_version)sを使って構築されています。" + +#: python_docs_theme/static/copybutton.js:30 +#: python_docs_theme/static/copybutton.js:55 +msgid "Copy" +msgstr "コピー" + +#: python_docs_theme/static/copybutton.js:31 +msgid "Copy to clipboard" +msgstr "クリップボードにコピーする" + +#: python_docs_theme/static/copybutton.js:53 +msgid "Copied!" +msgstr "コピーされました。" diff --git a/python_docs_theme/locale/pl/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/pl/LC_MESSAGES/python-docs-theme.po index cb74d912..461c4c95 100644 --- a/python_docs_theme/locale/pl/LC_MESSAGES/python-docs-theme.po +++ b/python_docs_theme/locale/pl/LC_MESSAGES/python-docs-theme.po @@ -1,24 +1,27 @@ -# Polish (Poland) translations for python-docs-theme. +# Translations template for python-docs-theme. # Copyright (C) 2025 Python Software Foundation # This file is distributed under the same license as the python-docs-theme # project. -# Stan Ulbrych, 2025. +# FIRST AUTHOR , 2025. # +# Translators: +# Stan Ulbrych, 2025 +# +#, fuzzy msgid "" msgstr "" "Project-Id-Version: python-docs-theme 2025.5\n" "Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/issues\n" -"POT-Creation-Date: 2025-08-07 19:09+0200\n" -"PO-Revision-Date: 2025-08-07 15:11+0200\n" -"Last-Translator: Stan Ulbrych \n" -"Language: pl\n" -"Language-Team: pl \n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && " -"(n%100<10 || n%100>=20) ? 1 : 2);\n" +"POT-Creation-Date: 2025-09-06 08:40+0100\n" +"PO-Revision-Date: 2025-09-06 07:41+0000\n" +"Last-Translator: Stan Ulbrych, 2025\n" +"Language-Team: Polish (https://app.transifex.com/python-doc/teams/5390/pl/)\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.16.0\n" +"Language: pl\n" +"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n" #: python_docs_theme/footerdonate.html:1 msgid "The Python Software Foundation is a non-profit corporation." @@ -66,19 +69,17 @@ msgstr "Prawa autorskie" #: python_docs_theme/layout.html:147 msgid "" -"This page is licensed under the Python Software Foundation License " -"Version 2." -msgstr "" -"Ta strona jest objęta licencją Python Software " -"Foundation w wersji 2." +"This page is licensed under the Python Software Foundation License Version " +"2." +msgstr "Ta strona jest objęta licencją Python Software Foundation w wersji 2." #: python_docs_theme/layout.html:149 msgid "" "Examples, recipes, and other code in the documentation are additionally " "licensed under the Zero Clause BSD License." msgstr "" -"Przykłady, przepisy i inny kod w dokumentacji są dodatkowo objęte " -"licencją Zero Clause BSD." +"Przykłady, przepisy i inny kod w dokumentacji są dodatkowo objęte licencją " +"Zero Clause BSD." #: python_docs_theme/layout.html:152 #, python-format diff --git a/python_docs_theme/locale/tr/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/tr/LC_MESSAGES/python-docs-theme.po new file mode 100644 index 00000000..90afb861 --- /dev/null +++ b/python_docs_theme/locale/tr/LC_MESSAGES/python-docs-theme.po @@ -0,0 +1,130 @@ +# Translations template for python-docs-theme. +# Copyright (C) 2025 Python Software Foundation +# This file is distributed under the same license as the python-docs-theme +# project. +# FIRST AUTHOR , 2025. +# +# Translators: +# Ege Akman, 2025 +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: python-docs-theme 2025.5\n" +"Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/issues\n" +"POT-Creation-Date: 2025-09-06 08:40+0100\n" +"PO-Revision-Date: 2025-09-06 07:41+0000\n" +"Last-Translator: Ege Akman, 2025\n" +"Language-Team: Turkish (https://app.transifex.com/python-doc/teams/5390/tr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.16.0\n" +"Language: tr\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: python_docs_theme/footerdonate.html:1 +msgid "The Python Software Foundation is a non-profit corporation." +msgstr "Python Software Foundation kâr amacı gütmeyen bir kuruluştur." + +#: python_docs_theme/footerdonate.html:2 +msgid "Please donate." +msgstr "Lütfen bağış yapın." + +#: python_docs_theme/layout.html:6 +msgid "Navigation" +msgstr "Navigasyon" + +#: python_docs_theme/layout.html:51 python_docs_theme/layout.html:111 +msgid "Quick search" +msgstr "Hızlı arama" + +#: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112 +msgid "Go" +msgstr "Ara" + +#: python_docs_theme/layout.html:60 +msgid "Theme" +msgstr "Tema" + +#: python_docs_theme/layout.html:62 +msgid "Auto" +msgstr "Otomatik" + +#: python_docs_theme/layout.html:63 +msgid "Light" +msgstr "Açık" + +#: python_docs_theme/layout.html:64 +msgid "Dark" +msgstr "Koyu" + +#: python_docs_theme/layout.html:96 +msgid "Menu" +msgstr "Menü" + +#: python_docs_theme/layout.html:142 +msgid "Copyright" +msgstr "Telif Hakkı" + +#: python_docs_theme/layout.html:147 +msgid "" +"This page is licensed under the Python Software Foundation License Version " +"2." +msgstr "" +"Bu sayfa, Python Software Foundation License Version 2 kapsamında " +"lisanslanmıştır." + +#: python_docs_theme/layout.html:149 +msgid "" +"Examples, recipes, and other code in the documentation are additionally " +"licensed under the Zero Clause BSD License." +msgstr "" +"Dokümantasyondaki örnekler, tarifler ve diğer kodlar ek olarak Zero Clause " +"BSD License kapsamında lisanslanmıştır." + +#: python_docs_theme/layout.html:152 +#, python-format +msgid "" +"See History and License for more " +"information." +msgstr "" +"Daha fazla bilgi için Geçmiş ve Lisans " +"bölümüne bakın. " + +#: python_docs_theme/layout.html:155 +#, python-format +msgid "Hosted on %(hosted_on)s." +msgstr "%(hosted_on)s üzerinde barındırılmaktadır." + +#: python_docs_theme/layout.html:163 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "En son %(last_updated)s tarihinde güncellendi." + +#: python_docs_theme/layout.html:166 +#, python-format +msgid "Found a bug?" +msgstr "Bir bug mı buldunuz?" + +#: python_docs_theme/layout.html:170 +#, python-format +msgid "" +"Created using Sphinx " +"%(sphinx_version)s." +msgstr "" +"Sphinx %(sphinx_version)s ile " +"oluşturuldu. " + +#: python_docs_theme/static/copybutton.js:30 +#: python_docs_theme/static/copybutton.js:55 +msgid "Copy" +msgstr "Kopyala" + +#: python_docs_theme/static/copybutton.js:31 +msgid "Copy to clipboard" +msgstr "Panoya kopyala" + +#: python_docs_theme/static/copybutton.js:53 +msgid "Copied!" +msgstr "Kopyalandı!" From 413eb45152b1277f3f5725706271a55db1624226 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Mon, 8 Sep 2025 22:28:15 +0300 Subject: [PATCH 31/54] Prepare 2025.9.1 release (#261) Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> --- CHANGELOG.rst | 7 ++++++- python_docs_theme/__init__.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 696bb883..c411e71f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,13 +1,18 @@ Changelog ========= +`2025.9.1 `_ +------------------------------------------------------------------------------- + +* Add Japanese, Turkish and Spanish translations from Transifex in https://github.com/python/python-docs-theme/pull/259 + `2025.9 `_ --------------------------------------------------------------------------- * Enable theme translation and add Polish by @StanFromIreland in https://github.com/python/python-docs-theme/pull/246 * Add Greek translation by @lysnikolaou and @skpanagiotis in https://github.com/python/python-docs-theme/pull/256 and https://github.com/python/python-docs-theme/pull/257 * Add Swedish translation by @yeager in https://github.com/python/python-docs-theme/pull/250 -* Pull Brazilian Portuguese, Simplified Chinese, Traditional Chinese, Japanese, Turkish and Spanish translations from `Transifex `_ in https://github.com/python/python-docs-theme/pull/253 and https://github.com/python/python-docs-theme/pull/259 +* Add Brazilian Portuguese, Simplified Chinese and Traditional Chinese translations from `Transifex `_ in https://github.com/python/python-docs-theme/pull/253 `2025.5 `_ --------------------------------------------------------------------------- diff --git a/python_docs_theme/__init__.py b/python_docs_theme/__init__.py index cc11f5e9..d9281fff 100644 --- a/python_docs_theme/__init__.py +++ b/python_docs_theme/__init__.py @@ -9,7 +9,7 @@ from sphinx.application import Sphinx from sphinx.util.typing import ExtensionMetadata -__version__ = "2025.9" +__version__ = "2025.9.1" THEME_PATH = Path(__file__).resolve().parent LOCALE_DIR = THEME_PATH / "locale" From d2ceb99b1a34a83ca56d90b49f970fca8efce2dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristi=C3=A1n=20Maureira-Fredes?= Date: Tue, 9 Sep 2025 18:59:29 +0200 Subject: [PATCH 32/54] Add German translation (#262) --- .../de/LC_MESSAGES/python-docs-theme.po | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 python_docs_theme/locale/de/LC_MESSAGES/python-docs-theme.po diff --git a/python_docs_theme/locale/de/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/de/LC_MESSAGES/python-docs-theme.po new file mode 100644 index 00000000..49dddf78 --- /dev/null +++ b/python_docs_theme/locale/de/LC_MESSAGES/python-docs-theme.po @@ -0,0 +1,132 @@ +# Translations template for python-docs-theme. +# Copyright (C) 2025 Python Software Foundation +# This file is distributed under the same license as the python-docs-theme +# project. +# FIRST AUTHOR , 2025. +# +# Translators: +# Cristián Maureira-Fredes, 2025 +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: python-docs-theme 2025.5\n" +"Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/issues\n" +"POT-Creation-Date: 2025-09-06 08:40+0100\n" +"PO-Revision-Date: 2025-09-09 10:20+0200\n" +"Last-Translator: Cristián Maureira-Fredes, 2025\n" +"Language-Team: \n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? " +"1 : 2;\n" +"Generated-By: Babel 2.16.0\n" +"X-Generator: Poedit 3.6\n" + +#: python_docs_theme/footerdonate.html:1 +msgid "The Python Software Foundation is a non-profit corporation." +msgstr "Die Python Software Foundation ist eine gemeinnützige Organisation." + +#: python_docs_theme/footerdonate.html:2 +msgid "Please donate." +msgstr "Spenden Sie bitte." + +#: python_docs_theme/layout.html:6 +msgid "Navigation" +msgstr "Navigation" + +#: python_docs_theme/layout.html:51 python_docs_theme/layout.html:111 +msgid "Quick search" +msgstr "Schnellsuche" + +#: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112 +msgid "Go" +msgstr "Los" + +#: python_docs_theme/layout.html:60 +msgid "Theme" +msgstr "Thema" + +#: python_docs_theme/layout.html:62 +msgid "Auto" +msgstr "Auto" + +#: python_docs_theme/layout.html:63 +msgid "Light" +msgstr "Hell" + +#: python_docs_theme/layout.html:64 +msgid "Dark" +msgstr "Dunkel" + +#: python_docs_theme/layout.html:96 +msgid "Menu" +msgstr "Menü" + +#: python_docs_theme/layout.html:142 +msgid "Copyright" +msgstr "Copyright" + +#: python_docs_theme/layout.html:147 +msgid "" +"This page is licensed under the Python Software Foundation License Version " +"2." +msgstr "" +"Diese Seite ist unter der Python Software Foundation License Version 2 " +"lizenziert." + +#: python_docs_theme/layout.html:149 +msgid "" +"Examples, recipes, and other code in the documentation are additionally " +"licensed under the Zero Clause BSD License." +msgstr "" +"Beispiele, Rezepte und anderer Code in der Dokumentation sind zusätzlich " +"unter der Zero Clause BSD-Lizenz lizenziert." + +#: python_docs_theme/layout.html:152 +#, python-format +msgid "" +"See History and License for more " +"information." +msgstr "" +"Weitere Informationen finden Sie unter Verlauf und Lizenz." + +#: python_docs_theme/layout.html:155 +#, python-format +msgid "Hosted on %(hosted_on)s." +msgstr "Gehostet auf %(hosted_on)s." + +#: python_docs_theme/layout.html:163 +#, python-format +msgid "Last updated on %(last_updated)s." +msgstr "Zuletzt aktualisiert am %(last_updated)s." + +#: python_docs_theme/layout.html:166 +#, python-format +msgid "Found a bug?" +msgstr "Fehler gefunden?" + +#: python_docs_theme/layout.html:170 +#, python-format +msgid "" +"Created using Sphinx " +"%(sphinx_version)s." +msgstr "" +"Erstellt mit Sphinx%(sphinx_version)s." + +#: python_docs_theme/static/copybutton.js:30 +#: python_docs_theme/static/copybutton.js:55 +msgid "Copy" +msgstr "Kopieren" + +#: python_docs_theme/static/copybutton.js:31 +msgid "Copy to clipboard" +msgstr "In die Zwischenablage kopieren" + +#: python_docs_theme/static/copybutton.js:53 +msgid "Copied!" +msgstr "Kopiert!" From d742571723effb29ebacae8864e1a64e82ff5f83 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Mon, 15 Sep 2025 14:05:44 +0100 Subject: [PATCH 33/54] commit (#267) --- python_docs_theme/static/py.png | Bin 695 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 python_docs_theme/static/py.png diff --git a/python_docs_theme/static/py.png b/python_docs_theme/static/py.png deleted file mode 100644 index 93e4a02c3d321c545898a2ebb8873c26dd8a9e5b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 695 zcmV;o0!aOdP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iOD~ z5jY_RGbdgE00K8jL_t(I%Vm>KNL4`;hrfH@vv+$Uln|xSCTLTOHmzE;5FTwpDtJ)a zz)exE-2_34AR^i+ZCXeh7m*-F5k*FrmbSHs%rX_!{PXUec{69`w(#D(>Vd<+%=bIz zH_V)XUD5sE?K5ebbKaSDu}#Dnq^Y!3`tis9>wSO*T+WBP3wS3NNBU~*PAtw^yjZ+< zQ5yK0z%d{y@_Pz6YdL>s7$6Y^hI$}5GUX?Ns>+iCUiRP z7h|*&%kQa?wQA%pYzqpaf*4?WM!x_ygY0K@07rplx^QhGhnE)r4wbx0x11<&3V?63 z=F8ch)p6iQ88E;iumPmSZif%JIwIgKh$T3)*ab8ImGLVf;IoYtVAb11Z&@wm>96=S z)!B&hojbAPoik&f)Lp;=N!HK;X~5oyfJ49$pbcorTyADv dm$H!t;2#0MumAjv0Ga>*002ovPDHLkV1gIiH5UK? From b87195c6719643c779a04d17866eaad230ab1c54 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Mon, 15 Sep 2025 17:19:00 +0100 Subject: [PATCH 34/54] Stretch search button to text width (#268) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- Makefile | 3 ++- python_docs_theme/static/pydoctheme.css | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index bae89325..dda3c238 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ CPYTHON_PATH = ../cpython PYTHON = python3 PACKAGE_ABS_PATH = $(shell pwd)/$(shell find dist/python-docs-theme-*.tar.gz) +SPHINXOPTS = .PHONY: help @@ -22,7 +23,7 @@ venv: .PHONY: html html: venv cd $(CPYTHON_PATH)/Doc && \ - make html + make SPHINXOPTS="$(SPHINXOPTS)" html .PHONY: htmlview htmlview: html diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index 48731163..d7b729f7 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -123,7 +123,9 @@ form.inline-search input { } form.inline-search input[type='submit'] { - width: 40px; + /* In some languages, more than 40px is required */ + width: auto; + min-width: 40px; } div.document { From fee2ae0dbf6251e5df36f621a605085d9f6aa0ec Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Mon, 15 Sep 2025 17:35:03 +0100 Subject: [PATCH 35/54] Fix translation of html pages (#263) --- python_docs_theme/__init__.py | 26 +++++++++++++++---- .../es/LC_MESSAGES/python-docs-theme.po | 1 - .../ja/LC_MESSAGES/python-docs-theme.po | 1 - .../pl/LC_MESSAGES/python-docs-theme.po | 1 - .../pt_BR/LC_MESSAGES/python-docs-theme.po | 1 - .../tr/LC_MESSAGES/python-docs-theme.po | 1 - .../zh_CN/LC_MESSAGES/python-docs-theme.po | 1 - .../zh_TW/LC_MESSAGES/python-docs-theme.po | 1 - 8 files changed, 21 insertions(+), 12 deletions(-) diff --git a/python_docs_theme/__init__.py b/python_docs_theme/__init__.py index d9281fff..875206b4 100644 --- a/python_docs_theme/__init__.py +++ b/python_docs_theme/__init__.py @@ -6,6 +6,8 @@ TYPE_CHECKING = False if TYPE_CHECKING: + from typing import Any + from sphinx.application import Sphinx from sphinx.util.typing import ExtensionMetadata @@ -16,16 +18,30 @@ MESSAGE_CATALOG_NAME = "python-docs-theme" +def add_translation_to_context( + app: Sphinx, + pagename: str, + templatename: str, + context: dict[str, Any], + doctree: None, +) -> None: + theme_gettext = get_translation(MESSAGE_CATALOG_NAME) + sphinx_gettext = get_translation("sphinx") + + def combined(message: str) -> str: + translation = theme_gettext(message) + if translation == message: + return sphinx_gettext(message) + return translation + + context["_"] = context["gettext"] = context["ngettext"] = combined + + def setup(app: Sphinx) -> ExtensionMetadata: app.require_sphinx("7.3") app.add_html_theme("python_docs_theme", str(THEME_PATH)) app.add_message_catalog(MESSAGE_CATALOG_NAME, LOCALE_DIR) - - def add_translation_to_context(app, pagename, templatename, context, doctree): - _ = get_translation(MESSAGE_CATALOG_NAME) - context["_"] = context["gettext"] = context["ngettext"] = _ - app.connect("html-page-context", add_translation_to_context) return { diff --git a/python_docs_theme/locale/es/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/es/LC_MESSAGES/python-docs-theme.po index 34fc30ef..5ac9ab30 100644 --- a/python_docs_theme/locale/es/LC_MESSAGES/python-docs-theme.po +++ b/python_docs_theme/locale/es/LC_MESSAGES/python-docs-theme.po @@ -7,7 +7,6 @@ # Translators: # Cristián Maureira-Fredes, 2025 # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: python-docs-theme 2025.5\n" diff --git a/python_docs_theme/locale/ja/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/ja/LC_MESSAGES/python-docs-theme.po index dfea8575..f0683c22 100644 --- a/python_docs_theme/locale/ja/LC_MESSAGES/python-docs-theme.po +++ b/python_docs_theme/locale/ja/LC_MESSAGES/python-docs-theme.po @@ -7,7 +7,6 @@ # Translators: # Inada Naoki , 2025 # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: python-docs-theme 2025.5\n" diff --git a/python_docs_theme/locale/pl/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/pl/LC_MESSAGES/python-docs-theme.po index 461c4c95..5249a260 100644 --- a/python_docs_theme/locale/pl/LC_MESSAGES/python-docs-theme.po +++ b/python_docs_theme/locale/pl/LC_MESSAGES/python-docs-theme.po @@ -7,7 +7,6 @@ # Translators: # Stan Ulbrych, 2025 # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: python-docs-theme 2025.5\n" diff --git a/python_docs_theme/locale/pt_BR/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/pt_BR/LC_MESSAGES/python-docs-theme.po index 2ce0936d..1006ae92 100644 --- a/python_docs_theme/locale/pt_BR/LC_MESSAGES/python-docs-theme.po +++ b/python_docs_theme/locale/pt_BR/LC_MESSAGES/python-docs-theme.po @@ -8,7 +8,6 @@ # Alexsey Batista da Silva, 2025 # Rafael Fontenelle , 2025 # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: python-docs-theme 2025.5\n" diff --git a/python_docs_theme/locale/tr/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/tr/LC_MESSAGES/python-docs-theme.po index 90afb861..f79742f1 100644 --- a/python_docs_theme/locale/tr/LC_MESSAGES/python-docs-theme.po +++ b/python_docs_theme/locale/tr/LC_MESSAGES/python-docs-theme.po @@ -7,7 +7,6 @@ # Translators: # Ege Akman, 2025 # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: python-docs-theme 2025.5\n" diff --git a/python_docs_theme/locale/zh_CN/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/zh_CN/LC_MESSAGES/python-docs-theme.po index 8fb52a40..73cc2937 100644 --- a/python_docs_theme/locale/zh_CN/LC_MESSAGES/python-docs-theme.po +++ b/python_docs_theme/locale/zh_CN/LC_MESSAGES/python-docs-theme.po @@ -7,7 +7,6 @@ # Translators: # 汇民 王 , 2025 # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: python-docs-theme 2025.5\n" diff --git a/python_docs_theme/locale/zh_TW/LC_MESSAGES/python-docs-theme.po b/python_docs_theme/locale/zh_TW/LC_MESSAGES/python-docs-theme.po index 719074c6..c65766be 100644 --- a/python_docs_theme/locale/zh_TW/LC_MESSAGES/python-docs-theme.po +++ b/python_docs_theme/locale/zh_TW/LC_MESSAGES/python-docs-theme.po @@ -7,7 +7,6 @@ # Translators: # W. H. Wang , 2025 # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: python-docs-theme 2025.5\n" From 6ea8ff6de596ce8b33f37336aac33b68fa2095d1 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Tue, 16 Sep 2025 14:48:19 +0100 Subject: [PATCH 36/54] Remove trailing space from link (#269) --- python_docs_theme/layout.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/python_docs_theme/layout.html b/python_docs_theme/layout.html index a74517c9..1903fad4 100644 --- a/python_docs_theme/layout.html +++ b/python_docs_theme/layout.html @@ -136,13 +136,13 @@

    {{ _('Navigation') }}

    {% block footer %}