Skip to content

Conversation

ZhibangYue
Copy link
Contributor

Add Chinese translation for docs/zh/docs/advanced/events.md
为【事件:启动 - 关闭】一章进行了更新,使之与英文最新版同步。

@github-actions github-actions bot added the lang-all Translations label Oct 23, 2024
Copy link
Contributor

@alejsdev alejsdev changed the title Add Chinese translation for docs/zh/docs/advanced/events.md 🌐 Add Chinese translation for docs/zh/docs/advanced/events.md Oct 23, 2024
@alejsdev alejsdev added lang-zh Chinese translations awaiting-review labels Oct 23, 2024
只是为好奇者提供的技术细节。🤓

在底层,这部分是<a href="https://asgi.readthedocs.io/en/latest/specs/lifespan.html" class="external-link" target="_blank">生命周期协议</a>的一部分,参见 ASGI 技术规范,定义了称为启动(`startup`)和关闭(`shutdown`)的事件。

/// info | "说明"

有关事件处理器的详情,请参阅 <a href="https://www.starlette.io/events/" class="external-link" target="_blank">Starlette 官档 - 事件</a>。
Copy link

@YGuang233 YGuang233 Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://www.starlette.io/events/这个地址也需要修改,改为https://www.starlette.io/lifespan/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@YGuang233 你说得对,谢谢你的指正。我会修改这个错误。

Copy link
Contributor

但在我们上面的例子里,我们并不是直接使用,而是传递给 FastAPI 来供其使用。

`FastAPI()` 的 `lifespan` 参数接受一个**异步上下文管理器**,所以我们可以把我们新定义的上下文管理器 `lifespan` 传给它。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

相较英文文档,此处缺少了一个传入lifespan参数的示例代码块

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你说得对,谢谢你的指正。我会修改这个错误。

Copy link
Contributor

Copy link
Contributor

@Zhongheng-Cheng Zhongheng-Cheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

Copy link
Contributor

@alejsdev alejsdev merged commit a559f8f into fastapi:master Dec 17, 2024
50 checks passed
@alejsdev
Copy link
Member

Thank you! @ZhibangYue 🚀
And thanks for the reviews @YGuang233 @Zhongheng-Cheng 🔍

gerry-sabar pushed a commit to gerry-sabar/fastapi that referenced this pull request Dec 18, 2024
s-rigaud pushed a commit to s-rigaud/fastapi that referenced this pull request Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved-1 lang-all Translations lang-zh Chinese translations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants