Add locale.gettext and related stubs, fixes #7164 (#7165)

This commit is contained in:
Luna Nova
2022-02-11 17:18:45 -08:00
committed by GitHub
parent d014533f36
commit 846c2dfa4f

View File

@@ -1,4 +1,5 @@
import sys
from _typeshed import StrPath
# This module defines a function "str()", which is why "str" can't be used
# as a type annotation or type alias.
@@ -103,6 +104,17 @@ def atof(string: _str, func: Callable[[_str], float] = ...) -> float: ...
def atoi(string: _str) -> int: ...
def str(val: float) -> _str: ...
# native gettext functions
# https://docs.python.org/3/library/locale.html#access-to-message-catalogs
# https://github.com/python/cpython/blob/f4c03484da59049eb62a9bf7777b963e2267d187/Modules/_localemodule.c#L626
if sys.platform == "linux" or sys.platform == "darwin":
def gettext(__msg: _str) -> _str: ...
def dgettext(__domain: _str | None, __msg: _str) -> _str: ...
def dcgettext(__domain: _str | None, __msg: _str, __category: int) -> _str: ...
def textdomain(__domain: _str | None) -> _str: ...
def bindtextdomain(__domain: _str, __dir: StrPath | None) -> _str: ...
def bind_textdomain_codeset(__domain: _str, __codeset: _str | None) -> _str | None: ...
locale_alias: dict[_str, _str] # undocumented
locale_encoding_alias: dict[_str, _str] # undocumented
windows_locale: dict[int, _str] # undocumented