Skip to content
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

[Beta] docs(cn): translate reference/render.md #632

Merged
merged 18 commits into from
Nov 25, 2021

Conversation

liu-jin-yi
Copy link
Collaborator

No description provided.

@liu-jin-yi liu-jin-yi changed the title [Beta]: tramslation reference render.md done [Beta]: docs(cn) tramslation reference render.md done Nov 4, 2021
@liu-jin-yi liu-jin-yi changed the title [Beta]: docs(cn) tramslation reference render.md done [Beta]: docs(cn) translation reference-render.md done Nov 4, 2021
Co-authored-by: QiChang Li <github@liqichang.com>
liu-jin-yi and others added 4 commits November 25, 2021 22:14
Co-authored-by: QiChang Li <github@liqichang.com>
Co-authored-by: QiChang Li <github@liqichang.com>
Co-authored-by: QiChang Li <github@liqichang.com>
Co-authored-by: QiChang Li <github@liqichang.com>
liu-jin-yi and others added 2 commits November 25, 2021 22:17
Co-authored-by: QiChang Li <github@liqichang.com>
Co-authored-by: QiChang Li <github@liqichang.com>
liu-jin-yi and others added 4 commits November 25, 2021 22:18
Co-authored-by: QiChang Li <github@liqichang.com>
Co-authored-by: QiChang Li <github@liqichang.com>
Co-authored-by: QiChang Li <github@liqichang.com>
Co-authored-by: QiChang Li <github@liqichang.com>
liu-jin-yi and others added 2 commits November 25, 2021 22:21
Co-authored-by: QiChang Li <github@liqichang.com>
Co-authored-by: QiChang Li <github@liqichang.com>
liu-jin-yi and others added 2 commits November 25, 2021 22:23
Co-authored-by: QiChang Li <github@liqichang.com>
Co-authored-by: QiChang Li <github@liqichang.com>
@QC-L QC-L changed the title [Beta]: docs(cn) translation reference-render.md done [Beta] docs(cn): translate reference/render.md Nov 25, 2021
@QC-L QC-L merged commit 36bea19 into reactjs:main Nov 25, 2021
@QC-L QC-L mentioned this pull request Dec 7, 2021
Copy link
Contributor

@Neo42 Neo42 left a comment

Choose a reason for hiding this comment

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

发现了一些错误,麻烦看一下 @QC-L

---

<Intro>

`render` renders a piece of [JSX](/learn/writing-markup-with-jsx) ("React element") into a browser DOM container node. It instructs React to change the DOM inside of the `container` so that it matches the passed JSX.
`render` 函数会将 [JSX](/learn/writing-markup-with-jsx)(“React 元素”)渲染到浏览器 DOM 容器节点中。它可以让 React 改变 `container` 中 DOM,使其与传递的 JSX 相匹配。
Copy link
Contributor

@Neo42 Neo42 Dec 14, 2021

Choose a reason for hiding this comment

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

修改建议:

  1. ”它可以让 React 改变 container 中的 DOM“
  2. ”所传递的 JSX“


</AnatomyStep>

<AnatomyStep title="DOM container">

The DOM node you want to render your UI into. The container itself isn’t modified, only its children are.
用于渲染 UI 界面的 DOM 节点。该容器不能被修改,只能修改它的子节点。
Copy link
Contributor

Choose a reason for hiding this comment

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

这句明显错了,应该是"该容器本身不会被修改"、”只有其子节点会被修改“

@@ -38,7 +41,7 @@ render(<App />, container);

</APIAnatomy>

In apps fully built with React, you will do this once at the top level of your app--to render the "root" component.
在完全由 React 构建的应用程序中,你需要在你的应用程序的入口文件执行该操作(渲染 "root" 组件)。
Copy link
Contributor

Choose a reason for hiding this comment

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

”在完全 使用 React 构建的应用程序中,你需要在你应用程序的最顶层执行一次该操作——渲染 "根" 组件。“

  1. with 应该翻译成使用
  2. 入口文件 entry file 是 webpack 中的概念,不应该用在这里,因为不是所有 react 应用都是用 webpack 写的,建议按原文直译

<Comment text="Hello!" author="Sophie" />
<Comment text="How are you?" author="Sunil" />
<Comment text="你好!" author="Sophie" />
<Comment text="你是谁?" author="Sunil" />
Copy link
Contributor

Choose a reason for hiding this comment

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

你好吗?

How are you 不是 who are you


<br />


## Behavior in detail {/*behavior-in-detail*/}
## 行为细节 {/*behavior-in-detail*/}
Copy link
Contributor

Choose a reason for hiding this comment

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

behavior 除了可以指行为,还可以指特性,这里译为特性更合适

@@ -134,9 +137,9 @@ nav ul li { display: inline-block; margin-right: 20px; }

<br />

## Updating the rendered tree {/*updating-the-rendered-tree*/}
## 更新已渲染的 DOM {/*updating-the-rendered-tree*/}
Copy link
Contributor

Choose a reason for hiding this comment

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

建议改成 更新已渲染的树 或 更新已渲染的组件树,因为组件树是 React 中的,DOM 树是浏览器中的,两者不能混淆,而且下文中有对两者关系的叙述,应该区别清楚,避免增加理解难度


The first time you call `render`, any existing DOM elements inside `container` are replaced. If you call `render` again, React will update the DOM as necessary to reflect the latest JSX. React will decide which parts of the DOM can be reused and which need to be recreated by ["matching it up"](/learn/preserving-and-resetting-state) with the previously rendered tree. Calling `render` repeatedly is similar to calling `setState`--in both cases, React avoids unnecessary DOM updates.
在你第一次调用 `render` 时,`container` 内的任何已有 DOM 元素都会被替换。如果你再次调用 `render` 时,React 将会通过与先前渲染的组件树 ["匹配"](/learn/preserving-and-resetting-state) 的方式,来决定 DOM 的哪些部分可以重用,哪些需要重新创建。重复调用 `render` 与调用 `setState` 效果类似。无论哪种情况,React 都会避免不必要的 DOM 更新。
Copy link
Contributor

Choose a reason for hiding this comment

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

如果你再次调用 render 的话,React 会为了体现最新的 JSX 而进行必要的 DOM 更新。React 会通过将 DOM 与先前渲染的组件树进行 "匹配" 的方式,来决定 DOM 的哪些部分可以重用,哪些需要重新创建。重复调用 render 与调用 setState 类似——在这两种情况下,React 都会避免不必要的 DOM 更新。

  1. 这里”React will update the DOM as necessary to reflect the latest JSX.“漏译了
  2. matching it up 中的 it 指的是 DOM,应该翻译出来
  3. 建议把”效果类似“中的”效果“去掉。不应该说两种调用的效果类似,因为本质上 render 是负责挂载组件的而 setState 是负责改变 state 的。只能说在避免不必要的 DOM 更新方面两者是类似的。


You can pass a callback as the third argument. React will call it after your component is in the DOM.
你可以将一个回调函数,作为 `render` 的第三个参数。React 会在你的组件在 DOM 中出现后,调用它。
Copy link
Contributor

Choose a reason for hiding this comment

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

你可以将一个回调函数作为第三个参数传递给 render。React 会在你的组件在 DOM 中出现后调用它。

  1. pass 漏译了
  2. 谓语之前不要加逗号

@KimYangOfCat
Copy link
Contributor

KimYangOfCat commented Dec 31, 2021

@Neo42 你的建议非常中肯,但此 PR 已经merge了,非常建议你能拉取最新的分支,新建分支并做出修改建议后重新提交新的PR,以便问题被更好地 merge

@Neo42
Copy link
Contributor

Neo42 commented Jan 2, 2022

@Neo42 你的建议非常中肯,但此 PR 已经merge了,非常建议你能拉取最新的分支,新建分支并做出修改建议后重新提交新的PR,以便问题被更好地 merge

@KimYangOfCat 好的,我会尽快提交

@Neo42
Copy link
Contributor

Neo42 commented Jan 3, 2022

@KimYangOfCat 已提交 pr #703

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants