Update documentation

This commit is contained in:
2025-12-03 13:51:49 +03:00
parent 2800a7ffc2
commit cd3095f42e
4 changed files with 244 additions and 163 deletions
@@ -21,7 +21,7 @@ msgstr ""
#: ../../root/dependency_injection.rst:4
msgid "Внедрение зависимостей"
msgstr ""
msgstr "Dependency Injection"
#: ../../root/dependency_injection.rst:6
msgid ""
@@ -30,6 +30,9 @@ msgid ""
" и расширяемый код. Вместо того чтобы обработчики сами создавали нужные "
"им объекты (зависимости), они получают их извне."
msgstr ""
"Dependency Injection (DI) is a design pattern that helps write loosely coupled, "
"easily testable, and extensible code. Instead of handlers creating the objects "
"(dependencies) they need themselves, they receive them from outside."
#: ../../root/dependency_injection.rst:8
msgid ""
@@ -39,10 +42,14 @@ msgid ""
"можно прочитать в `официальной документации dishka "
"<https://dishka.readthedocs.io/en/stable/di_intro.html>`_."
msgstr ""
"``Argenta`` uses the ``dishka`` library to implement DI, which allows you to "
"declaratively declare dependencies directly in your handler signatures. You can "
"read more about **DI**, **IoC**, and the API for creating providers in the "
"`official dishka documentation <https://dishka.readthedocs.io/en/stable/di_intro.html>`_."
#: ../../root/dependency_injection.rst:14
msgid "Основная идея"
msgstr ""
msgstr "Main Idea"
#: ../../root/dependency_injection.rst:16
msgid ""
@@ -50,19 +57,24 @@ msgid ""
"данных. Вместо импорта и инициализации соединения внутри функции, вы "
"просто объявляете его как аргумент с аннотацией типа:"
msgstr ""
"Imagine your handler needs access to a database to work. Instead of importing and "
"initializing the connection inside the function, you simply declare it as an "
"argument with a type annotation:"
#: ../../root/dependency_injection.rst:19
msgid ""
"``argenta.di.FromDishka`` является алиасом для ``dishka.FromDishka``, и "
"они полностью взаимозаменяемы."
msgstr ""
"``argenta.di.FromDishka`` is an alias for ``dishka.FromDishka``, and they are "
"fully interchangeable."
#: ../../root/dependency_injection.rst:21
#: ../../root/dependency_injection.rst:29
#: ../../root/dependency_injection.rst:37
#: ../../root/dependency_injection.rst:60
msgid "**Пример использования:**"
msgstr ""
msgstr "**Usage example:**"
#: ../../root/dependency_injection.rst:27
msgid ""
@@ -70,18 +82,20 @@ msgid ""
"``Connection`` и внедрит её. Но прежде чем использовать зависимость, её "
"необходимо объявить в провайдере:"
msgstr ""
"``Argenta`` with ``dishka`` will resolve the dependency by type ``Connection`` and "
"inject it. But before using the dependency, it must be declared in a provider:"
#: ../../root/dependency_injection.rst:35
msgid "После создания провайдера его необходимо зарегистрировать в оркестраторе:"
msgstr ""
msgstr "After creating the provider, it must be registered in the orchestrator:"
#: ../../root/dependency_injection.rst:46
msgid "Как это работает?"
msgstr ""
msgstr "How Does It Work?"
#: ../../root/dependency_injection.rst:48
msgid "В основе DI в Argenta лежат **провайдеры** и **контейнер**."
msgstr ""
msgstr "DI in Argenta is based on **providers** and a **container**."
#: ../../root/dependency_injection.rst:50
msgid ""
@@ -89,16 +103,21 @@ msgid ""
"создавать и настраивать ту или иную зависимость (например, подключение к "
"БД, API-клиент или любой другой сервис)."
msgstr ""
"**Provider (``Provider``)** is a \"recipe\" that explains how to create and "
"configure a particular dependency (for example, a database connection, API client, "
"or any other service)."
#: ../../root/dependency_injection.rst:51
msgid ""
"**Контейнер (IoC Container)** — это \"фабрика\", которая хранит все "
"рецепты (провайдеры) и по запросу создаёт и выдаёт готовые зависимости."
msgstr ""
"**Container (IoC Container)** is a \"factory\" that stores all recipes (providers) "
"and creates and provides ready dependencies on request."
#: ../../root/dependency_injection.rst:56
msgid "Встроенные провайдеры"
msgstr ""
msgstr "Built-in Providers"
#: ../../root/dependency_injection.rst:58
msgid ""
@@ -107,10 +126,14 @@ msgid ""
" можете получить объект ``ArgSpace``, который содержит аргументы "
"командной строки, переданные при запуске приложения."
msgstr ""
"``Argenta`` comes with a built-in provider that gives access to important system "
"dependencies without additional configuration. For example, you can get the "
"``ArgSpace`` object, which contains the command-line arguments passed when the "
"application was launched."
#: ../../root/dependency_injection.rst:69
msgid "Обмен данными между обработчиками"
msgstr ""
msgstr "Data Exchange Between Handlers"
#: ../../root/dependency_injection.rst:71
msgid ""
@@ -118,14 +141,17 @@ msgid ""
"**объект контекста**. В ``Argenta`` эту роль выполняет объект "
"``DataBridge``."
msgstr ""
"In addition to DI, handlers can exchange data within a session through a **context "
"object**. In ``Argenta``, this role is performed by the ``DataBridge`` object."
#: ../../root/dependency_injection.rst:73
msgid ""
"Каждый обработчик может записывать в него данные, а также читать, "
"обновлять и удалять их."
msgstr ""
"Each handler can write data to it, as well as read, update, and delete data."
#: ../../root/dependency_injection.rst:76
msgid "Подробнее об этом можно прочитать в разделе :ref:`root_api_bridge`."
msgstr ""
msgstr "You can read more about this in the :ref:`root_api_bridge` section."