120 lines
3.1 KiB
Python
120 lines
3.1 KiB
Python
"""
|
|
This type stub file was generated by pyright.
|
|
"""
|
|
|
|
from typing import Any, TYPE_CHECKING, TypeVar
|
|
from docutils import nodes
|
|
from sphinx.transforms import SphinxTransform
|
|
from collections.abc import Sequence
|
|
from sphinx.application import Sphinx
|
|
from sphinx.config import Config
|
|
|
|
"""Docutils transforms used by Sphinx when reading documents."""
|
|
if TYPE_CHECKING:
|
|
...
|
|
logger = ...
|
|
EXCLUDED_PENDING_XREF_ATTRIBUTES = ...
|
|
N = TypeVar('N', bound=nodes.Node)
|
|
def publish_msgstr(app: Sphinx, source: str, source_path: str, source_line: int, config: Config, settings: Any) -> nodes.Element:
|
|
"""Publish msgstr (single line) into docutils document
|
|
|
|
:param sphinx.application.Sphinx app: sphinx application
|
|
:param str source: source text
|
|
:param str source_path: source path for warning indication
|
|
:param source_line: source line for warning indication
|
|
:param sphinx.config.Config config: sphinx config
|
|
:param docutils.frontend.Values settings: docutils settings
|
|
:return: document
|
|
:rtype: docutils.nodes.document
|
|
"""
|
|
...
|
|
|
|
def parse_noqa(source: str) -> tuple[str, bool]:
|
|
...
|
|
|
|
class PreserveTranslatableMessages(SphinxTransform):
|
|
"""
|
|
Preserve original translatable messages before translation
|
|
"""
|
|
default_priority = ...
|
|
def apply(self, **kwargs: Any) -> None:
|
|
...
|
|
|
|
|
|
|
|
class _NodeUpdater:
|
|
"""Contains logic for updating one node with the translated content."""
|
|
def __init__(self, node: nodes.Element, patch: nodes.Element, document: nodes.document, noqa: bool) -> None:
|
|
...
|
|
|
|
def compare_references(self, old_refs: Sequence[nodes.Element], new_refs: Sequence[nodes.Element], warning_msg: str) -> None:
|
|
"""Warn about mismatches between references in original and translated content."""
|
|
...
|
|
|
|
def update_title_mapping(self) -> bool:
|
|
...
|
|
|
|
def update_autofootnote_references(self) -> None:
|
|
...
|
|
|
|
def update_refnamed_references(self) -> None:
|
|
...
|
|
|
|
def update_refnamed_footnote_references(self) -> None:
|
|
...
|
|
|
|
def update_citation_references(self) -> None:
|
|
...
|
|
|
|
def update_pending_xrefs(self) -> None:
|
|
...
|
|
|
|
def update_leaves(self) -> None:
|
|
...
|
|
|
|
|
|
|
|
class Locale(SphinxTransform):
|
|
"""
|
|
Replace translatable nodes with their translated doctree.
|
|
"""
|
|
default_priority = ...
|
|
def apply(self, **kwargs: Any) -> None:
|
|
...
|
|
|
|
|
|
|
|
class TranslationProgressTotaliser(SphinxTransform):
|
|
"""
|
|
Calculate the number of translated and untranslated nodes.
|
|
"""
|
|
default_priority = ...
|
|
def apply(self, **kwargs: Any) -> None:
|
|
...
|
|
|
|
|
|
|
|
class AddTranslationClasses(SphinxTransform):
|
|
"""
|
|
Add ``translated`` or ``untranslated`` classes to indicate translation status.
|
|
"""
|
|
default_priority = ...
|
|
def apply(self, **kwargs: Any) -> None:
|
|
...
|
|
|
|
|
|
|
|
class RemoveTranslatableInline(SphinxTransform):
|
|
"""
|
|
Remove inline nodes used for translation as placeholders.
|
|
"""
|
|
default_priority = ...
|
|
def apply(self, **kwargs: Any) -> None:
|
|
...
|
|
|
|
|
|
|
|
def setup(app: Sphinx) -> dict[str, Any]:
|
|
...
|
|
|