"""
This type stub file was generated by pyright.
"""

import locale
from __future__ import annotations
from gettext import NullTranslations, translation
from os import path
from typing import Any, Callable, TYPE_CHECKING
from collections.abc import Iterable

"""Locale utilities."""
if TYPE_CHECKING:
    ...
class _TranslationProxy:
    """
    The proxy implementation attempts to be as complete as possible, so that
    the lazy objects should mostly work as expected, for example for sorting.
    """
    __slots__ = ...
    def __init__(self, catalogue: str, namespace: str, message: str) -> None:
        ...
    
    def __str__(self) -> str:
        ...
    
    def __dir__(self) -> list[str]:
        ...
    
    def __getattr__(self, name: str) -> Any:
        ...
    
    def __getstate__(self) -> tuple[str, str, str]:
        ...
    
    def __setstate__(self, tup: tuple[str, str, str]) -> None:
        ...
    
    def __copy__(self) -> _TranslationProxy:
        ...
    
    def __repr__(self) -> str:
        ...
    
    def __add__(self, other: str) -> str:
        ...
    
    def __radd__(self, other: str) -> str:
        ...
    
    def __mod__(self, other: str) -> str:
        ...
    
    def __rmod__(self, other: str) -> str:
        ...
    
    def __mul__(self, other: Any) -> str:
        ...
    
    def __rmul__(self, other: Any) -> str:
        ...
    
    def __hash__(self) -> int:
        ...
    
    def __eq__(self, other) -> bool:
        ...
    
    def __lt__(self, string) -> bool:
        ...
    
    def __contains__(self, char): # -> bool:
        ...
    
    def __len__(self): # -> int:
        ...
    
    def __getitem__(self, index): # -> str:
        ...
    


translators: dict[tuple[str, str], NullTranslations] = ...
def init(locale_dirs: Iterable[str | None], language: str | None, catalog: str = ..., namespace: str = ...) -> tuple[NullTranslations, bool]:
    """Look for message catalogs in `locale_dirs` and *ensure* that there is at
    least a NullTranslations catalog set in `translators`. If called multiple
    times or if several ``.mo`` files are found, their contents are merged
    together (thus making ``init`` reentrant).
    """
    ...

_LOCALE_DIR = ...
def init_console(locale_dir: str | None = ..., catalog: str = ...) -> tuple[NullTranslations, bool]:
    """Initialize locale for console.

    .. versionadded:: 1.8
    """
    ...

def get_translator(catalog: str = ..., namespace: str = ...) -> NullTranslations:
    ...

def is_translator_registered(catalog: str = ..., namespace: str = ...) -> bool:
    ...

def get_translation(catalog: str, namespace: str = ...) -> Callable[[str], str]:
    """Get a translation function based on the *catalog* and *namespace*.

    The extension can use this API to translate the messages on the
    extension::

        import os
        from sphinx.locale import get_translation

        MESSAGE_CATALOG_NAME = 'myextension'  # name of *.pot, *.po and *.mo files
        _ = get_translation(MESSAGE_CATALOG_NAME)
        text = _('Hello Sphinx!')


        def setup(app):
            package_dir = os.path.abspath(os.path.dirname(__file__))
            locale_dir = os.path.join(package_dir, 'locales')
            app.add_message_catalog(MESSAGE_CATALOG_NAME, locale_dir)

    With this code, sphinx searches a message catalog from
    ``${package_dir}/locales/${language}/LC_MESSAGES/myextension.mo``.
    The :confval:`language` is used for the searching.

    .. versionadded:: 1.8
    """
    ...

_ = ...
__ = ...
admonitionlabels = ...
