Skip to content

Commit ada3dd8

Browse files
authored
Merge pull request #199 from fozg/master
Translate Navigation & Profiler API
2 parents e1f3047 + 774c825 commit ada3dd8

File tree

7 files changed

+87
-87
lines changed

7 files changed

+87
-87
lines changed

content/docs/add-react-to-a-website.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
id: add-react-to-a-website
3-
title: Add React to a Website
3+
title: Thêm React vào một Website
44
permalink: docs/add-react-to-a-website.html
55
redirect_from:
66
- "docs/add-react-to-an-existing-app.html"

content/docs/nav.yml

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,26 @@
77
- id: create-a-new-react-app
88
title: Tạo một App React mới
99
- id: cdn-links
10-
title: CDN Links
10+
title: Các liên kết CDN
1111
- id: release-channels
12-
title: Release Channels
12+
title: Các kênh phát hành
1313
- title: Khái niệm chính
1414
isOrdered: true
1515
items:
1616
- id: hello-world
1717
title: Hello World
1818
- id: introducing-jsx
19-
title: Introducing JSX
19+
title: Giới thiệu JSX
2020
- id: rendering-elements
2121
title: Rendering Elements
2222
- id: components-and-props
2323
title: Components and Props
2424
- id: state-and-lifecycle
2525
title: State and Lifecycle
2626
- id: handling-events
27-
title: Handling Events
27+
title: Xử lý Events
2828
- id: conditional-rendering
29-
title: Conditional Rendering
29+
title: Rendering có điều kiện
3030
- id: lists-and-keys
3131
title: Lists and Keys
3232
- id: forms
@@ -36,37 +36,37 @@
3636
- id: composition-vs-inheritance
3737
title: Composition vs Inheritance
3838
- id: thinking-in-react
39-
title: Thinking In React
39+
title: Tư duy trong React
4040
- title: Hướng dẫn nâng cao
4141
items:
4242
- id: accessibility
43-
title: Accessibility
43+
title: Khả năng tiếp cận
4444
- id: code-splitting
4545
title: Code-Splitting
4646
- id: context
4747
title: Context
4848
- id: error-boundaries
4949
title: Error Boundaries
5050
- id: forwarding-refs
51-
title: Forwarding Refs
51+
title: Chuyển tiếp Refs
5252
- id: fragments
5353
title: Fragments
5454
- id: higher-order-components
5555
title: Higher-Order Components
5656
- id: integrating-with-other-libraries
57-
title: Integrating with Other Libraries
57+
title: Tích hợp với các thư viện khác
5858
- id: jsx-in-depth
5959
title: JSX In Depth
6060
- id: optimizing-performance
61-
title: Optimizing Performance
61+
title: Tối ưu hiệu năng
6262
- id: portals
6363
title: Portals
6464
- id: profiler
65-
title: Profiler
65+
title: Phân tích (Profiler)
6666
- id: react-without-es6
67-
title: React Without ES6
67+
title: React nhưng không sử dụng ES6
6868
- id: react-without-jsx
69-
title: React Without JSX
69+
title: React nhưng không sử dụng JSX
7070
- id: reconciliation
7171
title: Reconciliation
7272
- id: refs-and-the-dom
@@ -78,7 +78,7 @@
7878
- id: strict-mode
7979
title: Strict Mode
8080
- id: typechecking-with-proptypes
81-
title: Typechecking With PropTypes
81+
title: Kiểm tra kiểu với PropTypes
8282
- id: uncontrolled-components
8383
title: Uncontrolled Components
8484
- id: web-components
@@ -103,9 +103,9 @@
103103
- id: test-renderer
104104
title: Test Renderer
105105
- id: javascript-environment-requirements
106-
title: JS Environment Requirements
106+
title: Môi trường JS yêu cầu
107107
- id: glossary
108-
title: Glossary
108+
title: Bảng chú giải
109109
- title: Hooks
110110
isOrdered: true
111111
items:
@@ -124,26 +124,26 @@
124124
- id: hooks-reference
125125
title: Tham chiếu Hooks API
126126
- id: hooks-faq
127-
title: Hooks FAQ
128-
- title: Testing
127+
title: Hooks và các câu hỏi thường gặp
128+
- title: Kiểm thử
129129
items:
130130
- id: testing
131-
title: Testing Overview
131+
title: Tổng quan kiểm thử
132132
- id: testing-recipes
133-
title: Testing Recipes
133+
title: Phương thức kiểu thử
134134
- id: testing-environments
135-
title: Testing Environments
136-
- title: Contributing
135+
title: Môi trường kiểm thử
136+
- title: Đóng góp
137137
items:
138138
- id: how-to-contribute
139-
title: How to Contribute
139+
title: Làm sao để đóng góp
140140
- id: codebase-overview
141-
title: Codebase Overview
141+
title: Tổng quan về Codebase
142142
- id: implementation-notes
143-
title: Implementation Notes
143+
title: Ghi chú Triển khai
144144
- id: design-principles
145-
title: Design Principles
146-
- title: FAQ
145+
title: Nguyên tắc thiết kế
146+
- title: Cầu hỏi thường gặp
147147
items:
148148
- id: faq-ajax
149149
title: AJAX và APIs
@@ -156,8 +156,8 @@
156156
- id: faq-styling
157157
title: Styling và CSS
158158
- id: faq-structure
159-
title: File Structure
159+
title: Cấu trúc File
160160
- id: faq-versioning
161-
title: Versioning Policy
161+
title: Quy tắc đặt tên phiên bản
162162
- id: faq-internals
163163
title: Virtual DOM and Internals

content/docs/reference-profiler.md

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
---
22
id: profiler
3-
title: Profiler API
3+
title: Profiler API (Công cụ Phân tích)
44
layout: docs
55
category: Reference
66
permalink: docs/profiler.html
77
---
88

9-
The `Profiler` measures how often a React application renders and what the "cost" of rendering is.
10-
Its purpose is to help identify parts of an application that are slow and may benefit from [optimizations such as memoization](/docs/hooks-faq.html#how-to-memoize-calculations).
9+
Công cụ `Profiler` (tạm gọi là `Công cụ Phân tích`) đánh giá xem ứng dụng React thực hiện việc render và "chi phí" để thực hiện nó.
10+
Mục đích của nó là để xác định xem phần nào của ứng dụng chạy chậm và có thể được hưởng lợi từ việc [tối ưu hóa như là ghi nhớ (memoization)](/docs/hooks-faq.html#how-to-memoize-calculations).
1111

12-
> Note:
12+
> Ghi chú:
1313
>
14-
> Profiling adds some additional overhead, so **it is disabled in [the production build](/docs/optimizing-performance.html#use-the-production-build)**.
14+
> Việc Phân tích sẽ tốn thêm tài nguyên, vì vậy **nó sẽ bị vô hiệu hóa trên [môi trường Production](/docs/optimizing-performance.html#use-the-production-build)**.
1515
>
16-
> To opt into production profiling, React provides a special production build with profiling enabled.
17-
> Read more about how to use this build at [fb.me/react-profiling](https://fb.me/react-profiling)
16+
> Nếu bạn muốn sử dụng nó trên môi trường Production, React có thể cung cấp một bản build đặc biệt đã bật chức năng này cho môi trường Production.
17+
> Đọc thêm về cách sử dụng bản build đáy tại [fb.me/react-profiling](https://fb.me/react-profiling)
1818
19-
## Usage {#usage}
19+
## Sử dụng {#usage}
2020

21-
A `Profiler` can be added anywhere in a React tree to measure the cost of rendering that part of the tree.
22-
It requires two props: an `id` (string) and an `onRender` callback (function) which React calls any time a component within the tree "commits" an update.
21+
`Công cụ Phân tích (Profiler)` có thể thêm vào bất kì đâu trong React tree để tính toán việc render ở nơi mà `Profiler` component được thêm vào.
22+
Nó cần 2 props: một là `id` (string) và một là `onRender` (hàm callback) để React có thể gọi bất kỳ lúc nào khi component ở bên trong cây (tree) có sự thay đổi.
2323

24-
For example, to profile a `Navigation` component and its descendants:
24+
Ví dụ, để phân tích component `Navigation` và các component con (descendants) của nó:
2525

2626
```js{3}
2727
render(
@@ -34,7 +34,7 @@ render(
3434
);
3535
```
3636

37-
Multiple `Profiler` components can be used to measure different parts of an application:
37+
Có thể sử dụng nhiều `Profiler` component để đánh giá nhiều nơi khác nhau trong ứng dụng:
3838
```js{3,6}
3939
render(
4040
<App>
@@ -48,7 +48,7 @@ render(
4848
);
4949
```
5050

51-
`Profiler` components can also be nested to measure different components within the same subtree:
51+
`Profiler` component có thể sử dụng lồng nhau để phân tích các component khác nhau trong cùng một subtree:
5252
```js{3,5,8}
5353
render(
5454
<App>
@@ -66,54 +66,54 @@ render(
6666
);
6767
```
6868

69-
> Note
69+
> Ghi chú
7070
>
71-
> Although `Profiler` is a light-weight component, it should be used only when necessary; each use adds some CPU and memory overhead to an application.
71+
> Mặc dù `Profiler` là một component nhẹ, nhưng bạn chỉ nên sử dụng khi cần thiết; mỗi lần sử dụng sẽ tốn thêm tài nguyên CPU và bộ nhớ RAM cho ứng dụng của bạn
7272
7373
## `onRender` Callback {#onrender-callback}
7474

75-
The `Profiler` requires an `onRender` function as a prop.
76-
React calls this function any time a component within the profiled tree "commits" an update.
77-
It receives parameters describing what was rendered and how long it took.
75+
`Profiler` cần một hàm `onRender` giống như prop.
76+
React sẽ gọi hàm này mỗi khi component được bọc bởi `Profiler` thực hiện một thay đổi.
77+
Nó nhận thông tin mô tả những gì đã render và thời gian thực hiện.
7878

7979
```js
8080
function onRenderCallback(
81-
id, // the "id" prop of the Profiler tree that has just committed
82-
phase, // either "mount" (if the tree just mounted) or "update" (if it re-rendered)
83-
actualDuration, // time spent rendering the committed update
84-
baseDuration, // estimated time to render the entire subtree without memoization
85-
startTime, // when React began rendering this update
86-
commitTime, // when React committed this update
87-
interactions // the Set of interactions belonging to this update
81+
id, // "id" của Profiler tree vừa thực hiện thay đổi
82+
phase, // một trong hai "mount" (nếu tree vừa được mounted) hoặc "update" (nếu nó re-rendered)
83+
actualDuration, // thời gian để rendering cập nhật mới
84+
baseDuration, // thời gian ước tính để hiển thị toàn bộ subtree mà không cần ghi nhớ
85+
startTime, // khi React bắt đầu hiển thị bản cập nhật này
86+
commitTime, // khi React hoàn thành cập nhật
87+
interactions // tập hợp các tương tác thuộc về bản cập nhật
8888
) {
89-
// Aggregate or log render timings...
89+
// Tổng hợp hoặc log thời gian render...
9090
}
9191
```
9292

93-
Let's take a closer look at each of the props:
93+
Xem kỹ hơn từng prop:
9494

9595
* **`id: string`** -
96-
The `id` prop of the `Profiler` tree that has just committed.
97-
This can be used to identify which part of the tree was committed if you are using multiple profilers.
96+
"id" của Profiler tree vừa thực hiện thay đổi
97+
Nó có thể dùng để xem thành phần nào của tree đã thay đổi nếu bạn sử dụng nhiều công cụ Phân tích (profilers).
9898
* **`phase: "mount" | "update"`** -
99-
Identifies whether the tree has just been mounted for the first time or re-rendered due to a change in props, state, or hooks.
99+
Xác định xem tree được mounted lần đầu tiên hay do re-rendered props, state hay hooks.
100100
* **`actualDuration: number`** -
101-
Time spent rendering the `Profiler` and its descendants for the current update.
102-
This indicates how well the subtree makes use of memoization (e.g. [`React.memo`](/docs/react-api.html#reactmemo), [`useMemo`](/docs/hooks-reference.html#usememo), [`shouldComponentUpdate`](/docs/hooks-faq.html#how-do-i-implement-shouldcomponentupdate)).
103-
Ideally this value should decrease significantly after the initial mount as many of the descendants will only need to re-render if their specific props change.
101+
Thời gian bỏ ra để rendering `Profiler` và các components con của nó.
102+
Điều này cho biết bạn có nên sử dụng các công cụ memoization cho subtree hay không (ví dụ [`React.memo`](/docs/react-api.html#reactmemo), [`useMemo`](/docs/hooks-reference.html#usememo), [`shouldComponentUpdate`](/docs/hooks-faq.html#how-do-i-implement-shouldcomponentupdate)).
103+
Lý tưởng nhất là giá trị này nên giảm đáng kể sau lần mount đầu tiên vì nhiều component con chỉ cần re-render nếu prop cụ thể nào đó của nó thay đổi.
104104
* **`baseDuration: number`** -
105-
Duration of the most recent `render` time for each individual component within the `Profiler` tree.
106-
This value estimates a worst-case cost of rendering (e.g. the initial mount or a tree with no memoization).
105+
Khoảng thời gian `render` gần nhất cho từng component bên trong `Công cụ Phân tích (Profiler)`.
106+
Giá trị này ước tính chi phí lãng phí cho trường hợp tệ nhất khi rendering (ví dụ: lần mount đầu tiên hoặc một tree không sử dụng memoization)
107107
* **`startTime: number`** -
108-
Timestamp when React began rendering the current update.
108+
Thời gian chính xác khi React bắt đầu rendering sự thay đổi.
109109
* **`commitTime: number`** -
110-
Timestamp when React committed the current update.
111-
This value is shared between all profilers in a commit, enabling them to be grouped if desirable.
110+
Thời gian chính xác khi React hoàn thành rendering sự thay đổi.
111+
Giá trì này được chia sẻ giữa các Công cụ Phân tích trong một commit, cho phép chúng được nhóm lại nếu muốn.
112112
* **`interactions: Set`** -
113-
Set of ["interactions"](https://fb.me/react-interaction-tracing) that were being traced when the update was scheduled (e.g. when `render` or `setState` were called).
113+
Tập hợp các ["tương tác"](https://fb.me/react-interaction-tracing) đã được theo dõi khi cập nhật hoặc lên lịch (ví dụ: khi `render` hoặc `setState` được gọi).
114114

115-
> Note
115+
> Ghi chú
116116
>
117-
> Interactions can be used to identify the cause of an update, although the API for tracing them is still experimental.
117+
> Các tương tác có thể được sử dụng để xác định nguồn của một cập nhật, mặc dù API để theo dõi chúng vẫn còn đang thử nghiệm.
118118
>
119-
> Learn more about it at [fb.me/react-interaction-tracing](https://fb.me/react-interaction-tracing)
119+
> Xem thêm tại [fb.me/react-interaction-tracing](https://fb.me/react-interaction-tracing)

content/footerNav.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
community:
2-
title: Community
2+
title: Cộng đồng
33

44
docs:
5-
title: Docs
5+
title: Tài liệu
66

77
more:
8-
title: More
8+
title: Xem thêm
99
items:
10-
- title: Tutorial
10+
- title: Hướng dẫn
1111
to: /tutorial/tutorial.html
1212
- title: Blog
1313
to: /blog
14-
- title: Acknowledgements
14+
- title: Lời cảm ơn
1515
to: /acknowledgements.html
1616
- title: React Native
1717
to: https://reactnative.dev/
1818
external: true
1919

2020
channels:
21-
title: Channels
21+
title: Các kênh
2222
items:
2323
- title: GitHub
2424
to: https://github.com/facebook/react
2525
external: true
2626
- title: Stack Overflow
2727
to: https://stackoverflow.com/questions/tagged/reactjs
2828
external: true
29-
- title: Discussion Forums
29+
- title: Diễn đàn
3030
to: https://reactjs.org/community/support.html#popular-discussion-forums
3131
external: true
3232
- title: Reactiflux Chat

content/headerNav.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
items:
2-
- title: Docs
2+
- title: Tài liệu
33
to: /docs/getting-started.html
44
activeSelector: /docs/
5-
- title: Tutorial
5+
- title: Hướng dẫn
66
to: /tutorial/tutorial.html
77
activeSelector: /tutorial
88
- title: Blog
99
to: /blog/
1010
activeSelector: /blog
11-
- title: Community
11+
- title: Cộng đồng
1212
to: /community/support.html
1313
activeSelector: /community

src/components/LayoutFooter/Footer.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const Footer = ({layoutHasSidebar = false}: {layoutHasSidebar: boolean}) => (
8787
<MetaTitle onDark={true}>{navFooter.community.title}</MetaTitle>
8888
<ExternalFooterLink
8989
href={`https://github.com/facebook/react/blob/main/CODE_OF_CONDUCT.md`}>
90-
Code of Conduct
90+
Quy tắc ứng xử
9191
</ExternalFooterLink>
9292
{sectionListCommunity.map(section => (
9393
<FooterLink
@@ -101,10 +101,10 @@ const Footer = ({layoutHasSidebar = false}: {layoutHasSidebar: boolean}) => (
101101
<MetaTitle onDark={true}>{navFooter.more.title}</MetaTitle>
102102
<SectionLinks links={navFooter.more.items} />
103103
<ExternalFooterLink href="https://opensource.facebook.com/legal/privacy">
104-
Privacy
104+
Chính sách bảo mật
105105
</ExternalFooterLink>
106106
<ExternalFooterLink href="https://opensource.facebook.com/legal/terms">
107-
Terms
107+
Điều khoản
108108
</ExternalFooterLink>
109109
</FooterNav>
110110
</div>
@@ -145,7 +145,7 @@ const Footer = ({layoutHasSidebar = false}: {layoutHasSidebar: boolean}) => (
145145
color: colors.subtleOnDark,
146146
paddingTop: 15,
147147
}}>
148-
{`Copyright © ${new Date().getFullYear()} Facebook Inc.`}
148+
{`Bản quyền © ${new Date().getFullYear()} Facebook Inc.`}
149149
</p>
150150
</section>
151151
</div>

src/components/MarkdownPage/MarkdownPage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ const MarkdownPage = ({
133133
<a
134134
css={sharedStyles.articleLayout.editLink}
135135
href={`https://github.com/reactjs/reactjs.org/tree/main/${markdownRemark.fields.path}`}>
136-
Edit this page
136+
Sửa trang này
137137
</a>
138138
</div>
139139
)}

0 commit comments

Comments
 (0)