-
Notifications
You must be signed in to change notification settings - Fork 88
doc: translate hooks-overview #35
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
Conversation
Deploy preview for zh-hant-reactjs-org ready! Built with commit c43ad02 |
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.
Hi @BruceWeng! In another PR, you used "Hook" (singular) consistently over the entire translation. But here you alternate between "Hooks" and "Hook". Can you fix them?
Also, please take a look at the glossary: https://github.com/reactjs/zh-hant.reactjs.org/wiki/Glossary
These are the words the community agrees to keep in English.
I didn't fix everything in this PR. Can you fix the rest? Thanks!
content/docs/hooks-overview.md
Outdated
@@ -1,30 +1,30 @@ | |||
--- | |||
id: hooks-overview | |||
title: Hooks at a Glance | |||
title: 第一眼 Hooks |
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.
At a glance does not mean 第一眼. It means a brief summary.
title: 第一眼 Hooks | |
title: Hook 概論 |
content/docs/hooks-overview.md
Outdated
permalink: docs/hooks-overview.html | ||
next: hooks-state.html | ||
prev: hooks-intro.html | ||
--- | ||
|
||
*Hooks* are a new addition in React 16.8. They let you use state and other React features without writing a class. | ||
*Hooks* 是 React 16.8 新加的功能,他們讓你可以不用寫 class 就能使用 state 與其他 React 的功能。 |
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.
*Hooks* 是 React 16.8 新加的功能,他們讓你可以不用寫 class 就能使用 state 與其他 React 的功能。 | |
*Hook* 是 React 16.8 新加的功能,他們讓你可以不用寫 class 就能使用 state 與其他 React 的功能。 |
Singular.
content/docs/hooks-overview.md
Outdated
|
||
Hooks are [backwards-compatible](/docs/hooks-intro.html#no-breaking-changes). This page provides an overview of Hooks for experienced React users. This is a fast-paced overview. If you get confused, look for a yellow box like this: | ||
Hooks [向後兼容](/docs/hooks-intro.html#no-breaking-changes)。這一頁提供 Hooks 的簡介給有經驗的 React 使用者們。這是一個快節奏的簡介,如果你有疑惑,看一下黃色框框如下: |
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.
Hooks [向後兼容](/docs/hooks-intro.html#no-breaking-changes)。這一頁提供 Hooks 的簡介給有經驗的 React 使用者們。這是一個快節奏的簡介,如果你有疑惑,看一下黃色框框如下: | |
Hook [向後兼容](/docs/hooks-intro.html#no-breaking-changes)。這一頁提供 Hook 的簡介給有經驗的 React 使用者們。這是一個快節奏的簡介,如果你有疑惑,看一下黃色框框如下: |
Singular
content/docs/hooks-overview.md
Outdated
> | ||
>Read the [Motivation](/docs/hooks-intro.html#motivation) to learn why we're introducing Hooks to React. | ||
>讀[動機](/docs/hooks-intro.html#motivation)來了解為什麼我們將 Hooks 加入 React。 |
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/hooks-intro.html#motivation)來了解為什麼我們將 Hooks 加入 React。 | |
>讀[動機](/docs/hooks-intro.html#motivation)來了解為什麼我們將 Hook 加入 React。 |
content/docs/hooks-overview.md
Outdated
|
||
**↑↑↑ Each section ends with a yellow box like this.** They link to detailed explanations. | ||
**↑↑↑ 每一個章節結束都有一個黃色框框像這樣。**他們連到詳細解釋。 |
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.
content/docs/hooks-overview.md
Outdated
|
||
## 🔌 Other Hooks {#other-hooks} | ||
## 🔌 其他 Hooks {#other-hooks} |
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.
## 🔌 其他 Hooks {#other-hooks} | |
## 🔌 其他 Hook {#other-hooks} |
content/docs/hooks-overview.md
Outdated
> | ||
>You can learn more about all the built-in Hooks on a dedicated page: [Hooks API Reference](/docs/hooks-reference.html). | ||
>你可以在 [Hooks API Reference](/docs/hooks-reference.html) 了解更多所有的內建 Hooks。 |
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.
>你可以在 [Hooks API Reference](/docs/hooks-reference.html) 了解更多所有的內建 Hooks。 | |
>你可以在 [Hooks API Reference](/docs/hooks-reference.html) 了解更多所有的內建 Hook。 |
content/docs/nav.yml
Outdated
- id: hooks-overview | ||
title: Hooks at a Glance | ||
title: 第一眼 Hooks |
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.
Again, at a glance means a brief summary here.
content/docs/hooks-overview.md
Outdated
|
||
You can also check out the [Hooks API reference](/docs/hooks-reference.html) and the [Hooks FAQ](/docs/hooks-faq.html). | ||
你也可以看看 [Hooks API reference](/docs/hooks-reference.html) 與 [Hooks 常見問題](/docs/hooks-faq.html)。 |
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.
你也可以看看 [Hooks API reference](/docs/hooks-reference.html) 與 [Hooks 常見問題](/docs/hooks-faq.html)。 | |
你也可以看看 [Hook API reference](/docs/hooks-reference.html) 與 [Hook 常見問題](/docs/hooks-faq.html)。 |
content/docs/hooks-overview.md
Outdated
|
||
Finally, don't miss the [introduction page](/docs/hooks-intro.html) which explains *why* we're adding Hooks and how we'll start using them side by side with classes -- without rewriting our apps. | ||
最後,不要漏了[隆重介紹頁面](/docs/hooks-intro.html),這裡解釋了 *為什麼* 我們加入了 Hooks 與我們如何和 class 一起使用——不用重寫我們的應用程式。 |
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/hooks-intro.html),這裡解釋了 *為什麼* 我們加入了 Hooks 與我們如何和 class 一起使用——不用重寫我們的應用程式。 | |
最後,不要漏了[隆重介紹頁面](/docs/hooks-intro.html),這裡解釋了 *為什麼* 我們加入了 Hook 與我們如何和 class 一起使用——不用重寫我們的應用程式。 |
Hi @chloewlin ,
Let me know if you find a further suggestion in the article. Thanks! |
content/docs/hooks-overview.md
Outdated
const [age, setAge] = useState(42); | ||
const [fruit, setFruit] = useState('banana'); | ||
const [todos, setTodos] = useState([{ text: 'Learn Hooks' }]); | ||
// ... | ||
} | ||
``` | ||
|
||
The [array destructuring](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Array_destructuring) syntax lets us give different names to the state variables we declared by calling `useState`. These names aren't a part of the `useState` API. Instead, React assumes that if you call `useState` many times, you do it in the same order during every render. We'll come back to why this works and when this is useful later. | ||
[Array destructuring](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Array_destructuring) 語法讓我們可以給用呼叫 `useState` 宣告的 state 變數不同的名字,這些名字不是 `useState` API 的一部份。相反地,React 假設如果你呼叫 `usetState` 多次,你在每次 render 用同樣的順序。我們之後將會回來討論為什麼可以這樣做與什麼時候他很有用。 |
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.
[Array destructuring](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Array_destructuring) 語法讓我們可以給用呼叫 `useState` 宣告的 state 變數不同的名字,這些名字不是 `useState` API 的一部份。相反地,React 假設如果你呼叫 `usetState` 多次,你在每次 render 用同樣的順序。我們之後將會回來討論為什麼可以這樣做與什麼時候他很有用。 | |
[Array destructuring](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Array_destructuring) 語法讓我們可以給用呼叫 `useState` 宣告的 state 變數不同的名字,這些名字不是 `useState` API 的一部份。相反地,React 假設如果你呼叫 `useState` 多次,你在每次 render 用同樣的順序。我們之後將會回來討論為什麼可以這樣做與什麼時候他很有用。 |
content/docs/hooks-overview.md
Outdated
@@ -229,19 +229,19 @@ function FriendListItem(props) { | |||
} | |||
``` | |||
|
|||
The state of these components is completely independent. Hooks are a way to reuse *stateful logic*, not state itself. In fact, each *call* to a Hook has a completely isolated state -- so you can even use the same custom Hook twice in one component. | |||
這兩個 component 的 state 是完全獨立的。Hook 是一種重複使用 *statefule 邏輯* 的方式,不是 state 本身。實際上,每一次呼叫一個 Hook 都有一個完全獨立且隔離的 state —— 所以你甚至可以在一個 component 使用同一個客製化 Hook 兩次。 |
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.
這兩個 component 的 state 是完全獨立的。Hook 是一種重複使用 *statefule 邏輯* 的方式,不是 state 本身。實際上,每一次呼叫一個 Hook 都有一個完全獨立且隔離的 state —— 所以你甚至可以在一個 component 使用同一個客製化 Hook 兩次。 | |
這兩個 component 的 state 是完全獨立的。Hook 是一種重複使用 *stateful 邏輯* 的方式,不是 state 本身。實際上,每一次呼叫一個 Hook 都有一個完全獨立且隔離的 state —— 所以你甚至可以在一個 component 使用同一個客製化 Hook 兩次。 |
content/docs/hooks-overview.md
Outdated
|
||
Custom Hooks are more of a convention than a feature. If a function's name starts with "`use`" and it calls other Hooks, we say it is a custom Hook. The `useSomething` naming convention is how our linter plugin is able to find bugs in the code using Hooks. | ||
客製化 Hook 比較像慣例而不是功能,如果一個 function 的名字是「`use`」開頭且他呼叫其他 Hook,我們將他稱之為客製化 Hook。使用 Hook 時,`useSometing`的命名慣例是我們的 linter plugin 如何能夠在程式碼中找到 bug 的原因。 |
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.
客製化 Hook 比較像慣例而不是功能,如果一個 function 的名字是「`use`」開頭且他呼叫其他 Hook,我們將他稱之為客製化 Hook。使用 Hook 時,`useSometing`的命名慣例是我們的 linter plugin 如何能夠在程式碼中找到 bug 的原因。 | |
客製化 Hook 比較像慣例而不是功能,如果一個 function 的名字是「`use`」開頭且他呼叫其他 Hook,我們將他稱之為客製化 Hook。使用 Hook 時,`useSomething`的命名慣例是我們的 linter plugin 如何能夠在程式碼中找到 bug 的原因。 |
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.
Just some typos.
Hi @vrabe , |
Hi @chloewlin, |
Hey, @BruceWeng thanks for your contribution.👍 |
Translate Introducing Hooks
5ef51f2
to
c43ad02
Compare
Thanks @bugtender . I have rebased the PR to HEAD. |
Ready to review!
I made an independent PR for each article for easier merging.
I will keep doc: Translate Hooks #32 open until all the Hooks topics are done.
I will track the Hooks translation progress there, which will be friendly for newcomers following current progress.
Also, I find it hard to avoid my hooks-intro.md work. Please cherry-pick hooks-overview.md commits in this PR and I will pull the result on master and start from there on my next translation.
Let me know if you have any thought!
Update: I have resolved conflict on hooks-intro.md by deleting my part. This PR should have no collision with the master branch now.