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

docs(cn): translate content/docs/components-and-props.md into Chinese #79

Merged
merged 7 commits into from
Feb 27, 2019
Merged

docs(cn): translate content/docs/components-and-props.md into Chinese #79

merged 7 commits into from
Feb 27, 2019

Conversation

QC-L
Copy link
Member

@QC-L QC-L commented Feb 7, 2019

Review this PR!

Copy link
Member

@hijiangtao hijiangtao left a comment

Choose a reason for hiding this comment

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

有些地方语意不对

content/docs/components-and-props.md Show resolved Hide resolved
content/docs/components-and-props.md Outdated Show resolved Hide resolved
content/docs/components-and-props.md Outdated Show resolved Hide resolved
content/docs/components-and-props.md Outdated Show resolved Hide resolved
content/docs/components-and-props.md Outdated Show resolved Hide resolved
content/docs/components-and-props.md Outdated Show resolved Hide resolved
content/docs/components-and-props.md Outdated Show resolved Hide resolved
content/docs/components-and-props.md Outdated Show resolved Hide resolved
content/docs/components-and-props.md Outdated Show resolved Hide resolved
content/docs/components-and-props.md Outdated Show resolved Hide resolved
@QC-L QC-L added the Pending Re-Review 已修改,待审校阶段 label Feb 12, 2019
@QC-L QC-L mentioned this pull request Feb 14, 2019
@netlify
Copy link

netlify bot commented Feb 14, 2019

Deploy preview for cn-reactjs ready!

Built with commit 3a9c7c8

https://deploy-preview-79--cn-reactjs.netlify.com

hijiangtao
hijiangtao previously approved these changes Feb 14, 2019
content/docs/components-and-props.md Outdated Show resolved Hide resolved

```js
function Welcome(props) {
return <h1>Hello, {props.name}</h1>;
}
```

This function is a valid React component because it accepts a single "props" (which stands for properties) object argument with data and returns a React element. We call such components "function components" because they are literally JavaScript functions.
该函数是一个有效的 React 组件,因为它接受唯一带有数据的 “props”(代表属性)对象与并返回一个 React 元素。这类组件被称为“函数组件”,因为它本质上就是 JavaScript 函数。
Copy link
Member

Choose a reason for hiding this comment

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

  1. 函数参数是统一用接收还是接受?我觉得接收好一些。

  2. 代表属性 => 是 properties 缩写,代表属性。
    properties 翻译出来比较好

  3. 这类组件被称为“函数组件”
    本段小标题是"函数式组件",我觉得用函数组件比较好,和 Vue 的 functional component 区分。

Copy link
Member Author

Choose a reason for hiding this comment

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

我觉得没必要区分,函数式组件就是 React 先提出来的

content/docs/components-and-props.md Outdated Show resolved Hide resolved

## Rendering a Component {#rendering-a-component}
## 组件渲染 {#rendering-a-component}
Copy link
Member

Choose a reason for hiding this comment

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

组件渲染 => 渲染一个组件

Copy link
Member Author

Choose a reason for hiding this comment

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

我觉得渲染一个组件太啰嗦了,渲染组件吧

content/docs/components-and-props.md Outdated Show resolved Hide resolved
@@ -198,7 +198,7 @@ function Comment(props) {
}
```

Next, we will extract a `UserInfo` component that renders an `Avatar` next to the user's name:
接下来,我们将提取 `UserInfo` 组件,该组件在用户名旁渲染 `Avatar` 组件:
Copy link
Member

Choose a reason for hiding this comment

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

用户名旁 => 用户名称旁边

Copy link
Member Author

Choose a reason for hiding this comment

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

感觉有点长

content/docs/components-and-props.md Outdated Show resolved Hide resolved
content/docs/components-and-props.md Outdated Show resolved Hide resolved
content/docs/components-and-props.md Outdated Show resolved Hide resolved

Of course, application UIs are dynamic and change over time. In the [next section](/docs/state-and-lifecycle.html), we will introduce a new concept of "state". State allows React components to change their output over time in response to user actions, network responses, and anything else, without violating this rule.
当然,应用程序的 UI 是动态的,并会伴随着时间的推移而变化。在[下一章节](/docs/state-and-lifecycle.html)中,我们将介绍一种新的概念,称之为 “state”。State 可以在不违反上述规则的情况下,允许 React 组件随用户操作、网络响应或者其他变化而动态更改输出内容。。
Copy link
Member

Choose a reason for hiding this comment

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

State 小写
这句多了个句号

Copy link
Member Author

Choose a reason for hiding this comment

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

State 在作为句首时不应该大写嘛?

Copy link
Member

Choose a reason for hiding this comment

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

中文不需要大写

hijiangtao
hijiangtao previously approved these changes Feb 24, 2019

## Function and Class Components {#function-and-class-components}
## 函数式组件与 class 组件 {#function-and-class-components}
Copy link
Member

Choose a reason for hiding this comment

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

这里感觉有点画蛇添足,没必要翻译成函数式组件,因为是在强调函数定义和类定义两种。
如果前后文有 side effect,也用了 functional,那种情况要翻译成函数式,强调的是函数式编程。

Copy link
Member Author

Choose a reason for hiding this comment

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

区分函数组件与 class 组件


```js
function Welcome(props) {
return <h1>Hello, {props.name}</h1>;
}
```

This function is a valid React component because it accepts a single "props" (which stands for properties) object argument with data and returns a React element. We call such components "function components" because they are literally JavaScript functions.
该函数是一个有效的 React 组件,因为它接收唯一带有数据的 “props”(代表属性)对象与并返回一个 React 元素。这类组件被称为“函数式组件”,因为它本质上就是 JavaScript 函数。
Copy link
Member

Choose a reason for hiding this comment

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

这里的函数式,同上

Copy link
Member

Choose a reason for hiding this comment

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

single 应该不是强调唯一,这里的 single 意思是函数接收单个参数,翻译成“一个”就行


Classes have some additional features that we will discuss in the [next sections](/docs/state-and-lifecycle.html). Until then, we will use function components for their conciseness.
我们将在[下一章节](/docs/state-and-lifecycle.html)中讨论关于 class 的额外特性。在那之前,为了保持示例简单明了,将使用函数式组件。
Copy link
Member

Choose a reason for hiding this comment

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

这里的函数式,同上

>
>To learn more about the reasoning behind this convention, please read [JSX In Depth](/docs/jsx-in-depth.html#user-defined-components-must-be-capitalized).
Copy link
Member

Choose a reason for hiding this comment

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

JSX In Depth => 深入 JSX


Of course, application UIs are dynamic and change over time. In the [next section](/docs/state-and-lifecycle.html), we will introduce a new concept of "state". State allows React components to change their output over time in response to user actions, network responses, and anything else, without violating this rule.
当然,应用程序的 UI 是动态的,并会伴随着时间的推移而变化。在[下一章节](/docs/state-and-lifecycle.html)中,我们将介绍一种新的概念,称之为 “state”。State 可以在不违反上述规则的情况下,允许 React 组件随用户操作、网络响应或者其他变化而动态更改输出内容。。
Copy link
Member

Choose a reason for hiding this comment

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

中文不需要大写

dear-lizhihua
dear-lizhihua previously approved these changes Feb 27, 2019
@QC-L QC-L dismissed stale reviews from dear-lizhihua and hijiangtao via 3a9c7c8 February 27, 2019 02:33
@netlify
Copy link

netlify bot commented Feb 27, 2019

Deploy preview for zh-hans-reactjs ready!

Built with commit 3a9c7c8

https://deploy-preview-79--zh-hans-reactjs.netlify.com

@hijiangtao hijiangtao merged commit dab1651 into reactjs:master Feb 27, 2019
@discountry discountry deleted the translate-components-and-props branch May 2, 2019 20:43
OhIAmFine pushed a commit to OhIAmFine/zh-hans.reactjs.org that referenced this pull request May 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pending Re-Review 已修改,待审校阶段
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants