|
|
|
import datetime
|
|
|
|
import gettext
|
|
|
|
from tornado_py3 import escape as escape
|
|
|
|
from tornado_py3._locale_data import LOCALE_NAMES as LOCALE_NAMES
|
|
|
|
from tornado_py3.log import gen_log as gen_log
|
|
|
|
from typing import Any, Dict, Iterable, Union
|
|
|
|
|
|
|
|
CONTEXT_SEPARATOR: str
|
|
|
|
|
|
|
|
def get(*locale_codes: str) -> Locale: ...
|
|
|
|
def set_default_locale(code: str) -> None: ...
|
|
|
|
def load_translations(directory: str, encoding: str=...) -> None: ...
|
|
|
|
def load_gettext_translations(directory: str, domain: str) -> None: ...
|
|
|
|
def get_supported_locales() -> Iterable[str]: ...
|
|
|
|
|
|
|
|
class Locale:
|
|
|
|
@classmethod
|
|
|
|
def get_closest(cls: Any, *locale_codes: str) -> Locale: ...
|
|
|
|
@classmethod
|
|
|
|
def get(cls: Any, code: str) -> Locale: ...
|
|
|
|
code: Any = ...
|
|
|
|
name: Any = ...
|
|
|
|
rtl: bool = ...
|
|
|
|
def __init__(self, code: str) -> None: ...
|
|
|
|
def translate(self, message: str, plural_message: str=..., count: int=...) -> str: ...
|
|
|
|
def pgettext(self, context: str, message: str, plural_message: str=..., count: int=...) -> str: ...
|
|
|
|
def format_date(self, date: Union[int, float, datetime.datetime], gmt_offset: int=..., relative: bool=..., shorter: bool=..., full_format: bool=...) -> str: ...
|
|
|
|
def format_day(self, date: datetime.datetime, gmt_offset: int=..., dow: bool=...) -> bool: ...
|
|
|
|
def list(self, parts: Any) -> str: ...
|
|
|
|
def friendly_number(self, value: int) -> str: ...
|
|
|
|
|
|
|
|
class CSVLocale(Locale):
|
|
|
|
translations: Any = ...
|
|
|
|
def __init__(self, code: str, translations: Dict[str, Dict[str, str]]) -> None: ...
|
|
|
|
def translate(self, message: str, plural_message: str=..., count: int=...) -> str: ...
|
|
|
|
def pgettext(self, context: str, message: str, plural_message: str=..., count: int=...) -> str: ...
|
|
|
|
|
|
|
|
class GettextLocale(Locale):
|
|
|
|
ngettext: Any = ...
|
|
|
|
gettext: Any = ...
|
|
|
|
def __init__(self, code: str, translations: gettext.NullTranslations) -> None: ...
|
|
|
|
def translate(self, message: str, plural_message: str=..., count: int=...) -> str: ...
|
|
|
|
def pgettext(self, context: str, message: str, plural_message: str=..., count: int=...) -> str: ...
|