Skip to content

[gettext] Deprecate l*gettext() functions and related #14535

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion stdlib/gettext.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import sys
from _typeshed import StrPath
from collections.abc import Callable, Container, Iterable, Sequence
from typing import Any, Final, Literal, Protocol, TypeVar, overload, type_check_only
from typing_extensions import deprecated

__all__ = [
"NullTranslations",
Expand Down Expand Up @@ -145,9 +146,16 @@ else:
fallback: bool = False,
codeset: str | None = None,
) -> NullTranslations: ...
@overload
def install(
domain: str, localedir: StrPath | None = None, codeset: str | None = None, names: Container[str] | None = None
domain: str, localedir: StrPath | None = None, codeset: None = None, names: Container[str] | None = None
) -> None: ...
@overload
@deprecated("The `codeset` parameter is deprecated since Python 3.8; removed in Python 3.11.")
def install(domain: str, localedir: StrPath | None, codeset: str, /, names: Container[str] | None = None) -> None: ...
@overload
@deprecated("The `codeset` parameter is deprecated since Python 3.8; removed in Python 3.11.")
def install(domain: str, localedir: StrPath | None = None, *, codeset: str, names: Container[str] | None = None) -> None: ...

def textdomain(domain: str | None = None) -> str: ...
def bindtextdomain(domain: str, localedir: StrPath | None = None) -> str: ...
Expand All @@ -161,10 +169,15 @@ def npgettext(context: str, msgid1: str, msgid2: str, n: int) -> str: ...
def dnpgettext(domain: str, context: str, msgid1: str, msgid2: str, n: int) -> str: ...

if sys.version_info < (3, 11):
@deprecated("Deprecated since Python 3.8; removed in Python 3.11. Use `gettext()` instead.")
def lgettext(message: str) -> str: ...
@deprecated("Deprecated since Python 3.8; removed in Python 3.11. Use `dgettext()` instead.")
def ldgettext(domain: str, message: str) -> str: ...
@deprecated("Deprecated since Python 3.8; removed in Python 3.11. Use `ngettext()` instead.")
def lngettext(msgid1: str, msgid2: str, n: int) -> str: ...
@deprecated("Deprecated since Python 3.8; removed in Python 3.11. Use `dngettext()` instead.")
def ldngettext(domain: str, msgid1: str, msgid2: str, n: int) -> str: ...
@deprecated("Deprecated since Python 3.8; removed in Python 3.11. Use `bindtextdomain()` instead.")
def bind_textdomain_codeset(domain: str, codeset: str | None = None) -> str: ...

Catalog = translation
Expand Down
Loading