Skip to content

Commit 3514397

Browse files
authored
[gettext] Deprecate l*gettext() functions and related (#14535)
1 parent d2eb9ac commit 3514397

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

stdlib/gettext.pyi

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import sys
33
from _typeshed import StrPath
44
from collections.abc import Callable, Container, Iterable, Sequence
55
from typing import Any, Final, Literal, Protocol, TypeVar, overload, type_check_only
6+
from typing_extensions import deprecated
67

78
__all__ = [
89
"NullTranslations",
@@ -145,9 +146,16 @@ else:
145146
fallback: bool = False,
146147
codeset: str | None = None,
147148
) -> NullTranslations: ...
149+
@overload
148150
def install(
149-
domain: str, localedir: StrPath | None = None, codeset: str | None = None, names: Container[str] | None = None
151+
domain: str, localedir: StrPath | None = None, codeset: None = None, names: Container[str] | None = None
150152
) -> None: ...
153+
@overload
154+
@deprecated("The `codeset` parameter is deprecated since Python 3.8; removed in Python 3.11.")
155+
def install(domain: str, localedir: StrPath | None, codeset: str, /, names: Container[str] | None = None) -> None: ...
156+
@overload
157+
@deprecated("The `codeset` parameter is deprecated since Python 3.8; removed in Python 3.11.")
158+
def install(domain: str, localedir: StrPath | None = None, *, codeset: str, names: Container[str] | None = None) -> None: ...
151159

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

163171
if sys.version_info < (3, 11):
172+
@deprecated("Deprecated since Python 3.8; removed in Python 3.11. Use `gettext()` instead.")
164173
def lgettext(message: str) -> str: ...
174+
@deprecated("Deprecated since Python 3.8; removed in Python 3.11. Use `dgettext()` instead.")
165175
def ldgettext(domain: str, message: str) -> str: ...
176+
@deprecated("Deprecated since Python 3.8; removed in Python 3.11. Use `ngettext()` instead.")
166177
def lngettext(msgid1: str, msgid2: str, n: int) -> str: ...
178+
@deprecated("Deprecated since Python 3.8; removed in Python 3.11. Use `dngettext()` instead.")
167179
def ldngettext(domain: str, msgid1: str, msgid2: str, n: int) -> str: ...
180+
@deprecated("Deprecated since Python 3.8; removed in Python 3.11. Use `bindtextdomain()` instead.")
168181
def bind_textdomain_codeset(domain: str, codeset: str | None = None) -> str: ...
169182

170183
Catalog = translation

0 commit comments

Comments
 (0)