Skip to content

[zh-CN]: update the translation of the promise #27965

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

JasonLamv-t
Copy link
Member

Description

As the title.

Motivation

Ditto.

Additional details

Nope.

Related issues and pull requests

@JasonLamv-t JasonLamv-t requested a review from a team as a code owner July 6, 2025 17:23
@JasonLamv-t JasonLamv-t requested review from jasonren0403 and removed request for a team July 6, 2025 17:23
@github-actions github-actions bot added the l10n-zh Issues related to Chinese content. label Jul 6, 2025
@JasonLamv-t JasonLamv-t changed the title [zh-cn]: update the translation of the promise [zh-CN]: update the translation of the promise Jul 6, 2025
Copy link
Contributor

github-actions bot commented Jul 6, 2025

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@JasonLamv-t JasonLamv-t requested a review from yin1999 July 7, 2025 01:25
@yin1999 yin1999 removed their request for review July 7, 2025 05:14

`.then()` 方法最多接受两个参数;第一个参数是 Promise 兑现时的回调函数,第二个参数是 Promise 拒绝时的回调函数。每个 `.then()` 返回一个新生成的 Promise 对象,这个对象可被用于链式调用,例如:
{{jsxref("Promise.prototype.then()")}}、{{jsxref("Promise.prototype.catch()")}} 和 {{jsxref("Promise.prototype.finally()")}} 方法用于将进一步的操作与已敲定的 Promise 相关联。`.then()` 方法最多接受两个参数;第一个参数是 Promise 兑现时的回调函数,第二个参数是 Promise 拒绝时的回调函数。`.catch()` 和 `.finally()` 方法在内部调用 `.then()`,使错误处理更加简洁。例如,`.catch()` 实际上就是一个没有传递兑现处理器的 `.then()`。由于这些方法返回 Promise,因此它们可以被链式调用。例如:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{{jsxref("Promise.prototype.then()")}}、{{jsxref("Promise.prototype.catch()")}} 和 {{jsxref("Promise.prototype.finally()")}} 方法用于将进一步的操作与已敲定的 Promise 相关联。`.then()` 方法最多接受两个参数;第一个参数是 Promise 兑现时的回调函数,第二个参数是 Promise 拒绝时的回调函数。`.catch()``.finally()` 方法在内部调用 `.then()`,使错误处理更加简洁。例如,`.catch()` 实际上就是一个没有传递兑现处理器的 `.then()`。由于这些方法返回 Promise,因此它们可以被链式调用。例如:
{{jsxref("Promise/then", "then()")}}、{{jsxref("Promise/catch", "catch()")}} 和 {{jsxref("Promise/finally", "finally()")}} 方法用于将进一步的操作与已敲定的 Promise 相关联。`.then()` 方法最多接受两个参数;第一个参数是 Promise 兑现时的回调函数,第二个参数是 Promise 拒绝时的回调函数。`.catch()``.finally()` 方法在内部调用 `.then()`,使错误处理更加简洁。例如,`.catch()` 实际上就是一个没有传递兑现处理器的 `.then()`。由于这些方法返回 Promise,因此它们可以被链式调用。例如:

Comment on lines +371 to +372
另一个使用 `Promise` 和 {{domxref("XMLHttpRequest")}} 加载图像的示例如下所示。
每一步都有注释,可以让你详细了解 Promise 和 XHR 架构。
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
另一个使用 `Promise` 和 {{domxref("XMLHttpRequest")}} 加载图像的示例如下所示。
每一步都有注释,可以让你详细了解 Promise 和 XHR 架构。
另一个使用 `Promise` 和 {{domxref("XMLHttpRequest")}} 加载图像的示例如下所示。每一步都有注释,可以让你详细了解 Promise 和 XHR 架构。

每一步都有注释,可以让你详细了解 Promise 和 XHR 架构。

```html hidden live-sample___promises
<h1>Promise example</h1>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<h1>Promise example</h1>
<h1>Promise 示例</h1>

@@ -449,4 +511,4 @@ btn.addEventListener("click", testPromise);
- [使用 promise](/zh-CN/docs/Web/JavaScript/Guide/Using_promises)
- [Promises/A+ 规范](https://promisesaplus.com/)
- [JavaScript Promise:简介](https://web.developers.google.cn/articles/promises)
- [Domenic Denicola:回调、Promise 和协程——JavaScript 中的异步编程模式](https://www.slideshare.net/domenicdenicola/callbacks-promises-and-coroutines-oh-my-the-evolution-of-asynchronicity-in-javascript)
- [回调、Promise 和协程——JavaScript 中的异步编程模式](https://www.slideshare.net/domenicdenicola/callbacks-promises-and-coroutines-oh-my-the-evolution-of-asynchronicity-in-javascript)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- [回调、Promise 和协程——JavaScript 中的异步编程模式](https://www.slideshare.net/domenicdenicola/callbacks-promises-and-coroutines-oh-my-the-evolution-of-asynchronicity-in-javascript)
- Domenic Denicola 的幻灯片演示(2011):[回调、Promise 和协程——JavaScript 中的异步编程模式](https://www.slideshare.net/domenicdenicola/callbacks-promises-and-coroutines-oh-my-the-evolution-of-asynchronicity-in-javascript)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
l10n-zh Issues related to Chinese content.
Projects
Status: Review requested
Development

Successfully merging this pull request may close these issues.

3 participants