products:pyrog:api:lastest:types:lang_constant
Различия
Показаны различия между двумя версиями страницы.
| products:pyrog:api:lastest:types:lang_constant [2026/05/15 20:49] – создано - внешнее изменение 127.0.0.1 | products:pyrog:api:lastest:types:lang_constant [2026/08/14 15:25] (текущий) – удалено - внешнее изменение (Дата неизвестна) 127.0.0.1 | ||
|---|---|---|---|
| Строка 1: | Строка 1: | ||
| - | ~~NOTOC~~ | ||
| - | <WRAP center round info 80%> | ||
| - | Текст документации сгенерирован автоматически из [[https:// | ||
| - | Если обнаружили ошибку, | ||
| - | </ | ||
| - | |||
| - | ====== LangConstant ====== | ||
| - | |||
| - | |||
| - | |||
| - | |||
| - | Creates a language constant. Keeps original text and it's translations. Use it to have access to translations without loaded dictionaries at any time. | ||
| - | |||
| - | **Attributes: | ||
| - | |||
| - | * **context**: | ||
| - | * **key**: //str// — a source text of the language constant. | ||
| - | * **disambiguation**: | ||
| - | |||
| - | |||
| - | ==== Methods ==== | ||
| - | |||
| - | |||
| - | === unpack === | ||
| - | |||
| - | |||
| - | <code python> | ||
| - | |||
| - | Returns unpacked Language constant as tuple. | ||
| - | |||
| - | **Returns: | ||
| - | * // | ||
| - | |||
| - | |||
| - | === translate === | ||
| - | |||
| - | |||
| - | <code python> | ||
| - | |||
| - | Translates the language constant. | ||
| - | |||
| - | Optionally accept language code to extract translations for plural forms. | ||
| - | Attention: doesn' | ||
| - | |||
| - | **Parameters: | ||
| - | |||
| - | * **lang_code**: | ||
| - | |||
| - | **Returns: | ||
| - | * //None// — (without description) | ||
| - | |||
| - | **Raises:** | ||
| - | * **TypeError** — if arg < | ||
| - | |||
| - | |||
| - | === get_translation === | ||
| - | |||
| - | |||
| - | <code python> | ||
| - | |||
| - | Returns the translation of language constant if exists, source text - otherwise. | ||
| - | |||
| - | **Parameters: | ||
| - | |||
| - | * **n**: //int | float// — a numeral for determining the plural form. | ||
| - | |||
| - | **Returns: | ||
| - | * //str// — the translation of language constant if exists, source text - otherwise. | ||
| - | |||
| - | |||
| - | === delete_translation === | ||
| - | |||
| - | |||
| - | <code python> | ||
| - | |||
| - | Deletes the translation of language constant. | ||
| - | |||
| - | |||
| - | === __call__ === | ||
| - | |||
| - | |||
| - | <code python> | ||
| - | |||
| - | Returns the translation of language constant if exists, source text - otherwise. | ||
| - | |||
| - | **Parameters: | ||
| - | |||
| - | * **n**: //int | float// — a numeral for determining the plural form. | ||
| - | |||
| - | **Returns: | ||
| - | * //str// — the translation of language constant if exists, source text - otherwise. | ||
| - | |||
| - | |||
| - | === __str__ === | ||
| - | |||
| - | |||
| - | <code python> | ||
| - | |||
| - | Returns the translation of language constant if exists, source text - otherwise. | ||
| - | |||
| - | **Returns: | ||
| - | * //str// — the translation of language constant if exists, source text - otherwise. | ||