-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
🌐 Add Russian translation for docs/ru/docs/tutorial/middleware.md
#13412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🌐 Add Russian translation for docs/ru/docs/tutorial/middleware.md
#13412
Conversation
docs/ru/docs/tutorial/middleware.md
|
📝 Docs preview for commit 858b7eb at: https://eaaeb1c9.fastapitiangolo.pages.dev Modified Pages |
docs/ru/docs/tutorial/middleware.mddocs/ru/docs/tutorial/middleware.md
|
📝 Docs preview for commit 85b530a at: https://fbaf0b7c.fastapitiangolo.pages.dev Modified Pages |
|
@Rishat-F, @Yarous, @Xewus, @Stepakinoyan, @gitgernit сделайте review пожалуйста 😊 |
|
📝 Docs preview for commit cf513b9 at: https://24d98628.fastapitiangolo.pages.dev Modified Pages |
|
📝 Docs preview for commit 574925f at: https://b80f0c27.fastapitiangolo.pages.dev Modified Pages |
|
📝 Docs preview for commit bb4077a at: https://fdc1988c.fastapitiangolo.pages.dev Modified Pages |
|
📝 Docs preview for commit 7492555 at: https://9f620048.fastapitiangolo.pages.dev Modified Pages |
|
📝 Docs preview for commit 2ec9c79 at: https://7b9a8b67.fastapitiangolo.pages.dev Modified Pages |
docs/ru/docs/tutorial/middleware.md
Outdated
|
|
||
| Вы можете добавить промежуточный слой (middleware) в **FastAPI** приложения. | ||
|
|
||
| "Middleware" это функция, которая выполняется с каждым запросом до его обработки *функцией эндпоинта*. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не знаю, как лучше, но в оригинале используется "path operation", да и в других местах доки это называют операцией пути
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Yarous: имхо, функция эндпоинта понятнее и используется чаще. Но можно и обсудить. 😊
"Middleware" это функция, которая выполняется с каждым запросом до его обработки функцией эндпоинта.
"Middleware" это функция, которая выполняется с каждым запросом до его обработки операцией пути.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
я исхожу из контекста, в данном контексте нужно переводить operation как функцию (тут проблем нет), а
path как эндпоинт (это некорректно с точки зрения русского языка)
вообще-то, если дословно, то "path operation" = "функция пути"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Исходя из предыдущих переводов я думал так:
"path operation" = "операция пути" или "эндпоинт"
"path operation function" = "функция операции пути" или "функция эндпоинта"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endpoint -> url
pass operations -> набор функций/операций, обслуживающих запросы на определенный url
pass operation -> "операция пути" ~ "операция эндпоинта" ~ "функция эндпоинта"
path operation decorator: @app.get("/")
path operation function: async def root()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alv2017 , разве мы не можем просто следующим образом переводить:
- если в оригинале написано "path operation", то переводим "операция пути"
- если в оригинале написано "path operation function", то переводим "функция операции пути"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- можем, но это не всегда работает.
- операция пути не( самый )удачный термин, и в обычной жизни не используется
- и хочется объяснить более доступно, но не всегда получается 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alv2017 , но ведь мы можем пока придерживаться такой (пусть и не самой удачной) терминологии, просто чтобы везде было однообразно.
И потом если кому-то в голову придет более удачный термин, то тогда массово разом везде поправить.
И если везде будут одинаковые неудачные термины, то массово поправить будет легче, чем если они будут везде по-разному прописаны.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rishat-F, мы такой стратегии и придерживаемся, разве нет? 😄
|
экспериментальная middleware 😄 from fastapi import FastAPI, Request
app = FastAPI()
@app.get("/")
def hello():
return {"message": "Hello from GET"}
@app.post("/")
def hello():
return {"message": "Hello from POST"}
@app.middleware("http")
async def add_demo_middleware(request: Request, call_next):
if request.scope["method"] == "GET":
request.scope["method"] = "POST"
elif request.scope["method"] == "POST":
request.scope["method"] = "GET"
response = await call_next(request)
response.headers["X-Method"] = f"Request method: {request.method}"
return response
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="localhost", port=8080, lifespan="on") |
|
📝 Docs preview for commit 0d581e8 at: https://6f693e48.fastapitiangolo.pages.dev Modified Pages |
|
📝 Docs preview for commit b3958a1 at: https://6c9a7d4b.fastapitiangolo.pages.dev Modified Pages |
|
📝 Docs preview for commit f363260 at: https://16c4c7ce.fastapitiangolo.pages.dev Modified Pages |
|
@Yarous, уже всё поправили, ждём тебя 😄 |
Yarous
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Хорошая работа 👍
|
📝 Docs preview for commit 53aaa87 at: https://94a40fe5.fastapitiangolo.pages.dev Modified Pages |
|
@alv2017 , молодчина! Отличная работа! |
|
@Rishat-F, народное творчество! 😄 |
No description provided.