-
Notifications
You must be signed in to change notification settings - Fork 112
feat(i18n): translate src/content/learn/adding-interactivity.md from English to Vietnamese #471
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
base: main
Are you sure you want to change the base?
Conversation
…English to Vietnamese
…English to Vietnamese
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
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.
Thanks for the contribution! Great translation. Please check out my suggestions.
--- | ||
|
||
<Intro> | ||
|
||
Some things on the screen update in response to user input. For example, clicking an image gallery switches the active image. In React, data that changes over time is called *state.* You can add state to any component, and update it as needed. In this chapter, you'll learn how to write components that handle interactions, update their state, and display different output over time. | ||
Một số thứ trên màn hình cập nhật để phản hồi đầu vào của người dùng. Ví dụ, nhấp vào thư viện ảnh sẽ chuyển đổi ảnh đang hoạt động. Trong React, data thay đổi theo thời gian được gọi là *state*. Bạn có thể thêm state vào bất kỳ component nào và cập nhật nó khi cần thiết. Trong chương này, bạn sẽ học cách viết các component xử lý tương tác, cập nhật state của chúng và hiển thị output khác nhau theo thời gian. |
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.
Một số thứ trên màn hình cập nhật để phản hồi đầu vào của người dùng. Ví dụ, nhấp vào thư viện ảnh sẽ chuyển đổi ảnh đang hoạt động. Trong React, data thay đổi theo thời gian được gọi là *state*. Bạn có thể thêm state vào bất kỳ component nào và cập nhật nó khi cần thiết. Trong chương này, bạn sẽ học cách viết các component xử lý tương tác, cập nhật state của chúng và hiển thị output khác nhau theo thời gian. | |
Một số thứ trên màn hình cập nhật theo phản hồi đầu vào của người dùng. Ví dụ, nhấp vào thư viện ảnh sẽ chuyển đổi ảnh đang được hiện thị. Trong React, data thay đổi theo thời gian được gọi là *state*. Bạn có thể thêm state vào bất kỳ component nào và cập nhật nó khi cần thiết. Trong chương này, bạn sẽ học cách viết các component xử lý tương tác, cập nhật state của chúng và hiển thị output khác nhau theo thời gian. |
* [Cách làm cho component "nhớ" thông tin với state](/learn/state-a-components-memory) | ||
* [Cách React cập nhật UI trong hai giai đoạn](/learn/render-and-commit) | ||
* [Tại sao state không cập nhật ngay sau khi bạn thay đổi nó](/learn/state-as-a-snapshot) | ||
* [Cách xếp hàng đợi nhiều cập nhật state](/learn/queueing-a-series-of-state-updates) |
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.
* [Cách xếp hàng đợi nhiều cập nhật state](/learn/queueing-a-series-of-state-updates) | |
* [Cách xử lí nhiều lần cập nhật state liên tiếp](/learn/queueing-a-series-of-state-updates) |
|
||
Components often need to change what's on the screen as a result of an interaction. Typing into the form should update the input field, clicking "next" on an image carousel should change which image is displayed, clicking "buy" puts a product in the shopping cart. Components need to "remember" things: the current input value, the current image, the shopping cart. In React, this kind of component-specific memory is called *state.* | ||
Các component thường cần thay đổi những gì hiển thị trên màn hình kết quả của một tương tác. Gõ vào form sẽ cập nhật trường input, nhấp "tiếp theo" trên carousel ảnh sẽ thay đổi ảnh nào được hiển thị, nhấp "mua" sẽ đưa sản phẩm vào giỏ hàng. Các component cần "nhớ" các thứ: giá trị input hiện tại, ảnh hiện tại, giỏ hàng. Trong React, loại bộ nhớ cụ thể của component này được gọi là *state*. |
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.
Các component thường cần thay đổi những gì hiển thị trên màn hình kết quả của một tương tác. Gõ vào form sẽ cập nhật trường input, nhấp "tiếp theo" trên carousel ảnh sẽ thay đổi ảnh nào được hiển thị, nhấp "mua" sẽ đưa sản phẩm vào giỏ hàng. Các component cần "nhớ" các thứ: giá trị input hiện tại, ảnh hiện tại, giỏ hàng. Trong React, loại bộ nhớ cụ thể của component này được gọi là *state*. | |
Các component thường cần thay đổi những gì hiển thị trên màn hình theo kết quả của một tương tác. Gõ vào form sẽ cập nhật trường input, nhấp "tiếp theo" trên carousel ảnh sẽ thay đổi ảnh nào được hiển thị, nhấp "mua" sẽ đưa sản phẩm vào giỏ hàng. Các component cần "nhớ" các thứ: giá trị input hiện tại, ảnh hiện tại, giỏ hàng. Trong React, loại bộ nhớ cụ thể của component này được gọi là *state*. |
|
||
Arrays are another type of mutable JavaScript objects you can store in state and should treat as read-only. Just like with objects, when you want to update an array stored in state, you need to create a new one (or make a copy of an existing one), and then set state to use the new array: | ||
Array là một loại object JavaScript có thể thay đổi khác mà bạn có thể lưu trữ trong state và nên coi như chỉ đọc. Giống như với object, khi bạn muốn cập nhật một array được lưu trữ trong state, bạn cần tạo một cái mới (hoặc tạo một bản sao của một cái hiện có), và sau đó thiết lập state để sử dụng array mới: |
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 là một loại object JavaScript có thể thay đổi khác mà bạn có thể lưu trữ trong state và nên coi như chỉ đọc. Giống như với object, khi bạn muốn cập nhật một array được lưu trữ trong state, bạn cần tạo một cái mới (hoặc tạo một bản sao của một cái hiện có), và sau đó thiết lập state để sử dụng array mới: | |
Array là một loại object JavaScript có thể thay đổi (mutable) khác mà bạn có thể lưu trữ trong state, nhưng nên coi như chỉ đọc được (read-only). Giống như với object, khi bạn muốn cập nhật một array được lưu trữ trong state, bạn cần tạo một cái mới (hoặc tạo một bản sao của một cái hiện có), và sau đó thiết lập state để sử dụng array mới: |
…English to Vietnamese
Thank you @chriskhoa! Your suggestion greatly improves the readability and naturalness of the Vietnamese translation. I've implemented the changes based on your feedback. Here's a summary of the translation improvements: Ngôn ngữ tự nhiên: "dữ liệu thay đổi theo thời gian" thay vì "data thay đổi theo thời gian" Thuật ngữ nhất quán: "Bắt sự kiện" thay vì "Phản hồi sự kiện" (cho section header) Cải thiện khác: "cách xử lý nhiều lần cập nhật state liên tiếp" thay vì "cách xử lí nhiều lần cập nhật state liên tiếp" |
|
||
<Sandpack> | ||
|
||
```js | ||
export default function App() { | ||
return ( | ||
<Toolbar | ||
onPlayMovie={() => alert('Playing!')} | ||
onUploadImage={() => alert('Uploading!')} | ||
onPlayMovie={() => alert('Đang phát!')} |
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 @chriskhoa!
Is it allowed to translate code snippets? Because this is the first file I started translating, so there are some code snippets in the file that I have already translated to Vietnamese.
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.
In this case, it makes sense to translate, so you are good!
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.
Looking great! Thanks for the follow-up.
|
||
<Sandpack> | ||
|
||
```js | ||
export default function App() { | ||
return ( | ||
<Toolbar | ||
onPlayMovie={() => alert('Playing!')} | ||
onUploadImage={() => alert('Uploading!')} | ||
onPlayMovie={() => alert('Đang phát!')} |
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.
In this case, it makes sense to translate, so you are good!
🇻🇳 Vietnamese Translation: Adding Interactivity
Hi! I'm starting as a volunteer translator for vi.react.dev, and this is my first contribution.
What's included
src/content/learn/adding-interactivity.md
Changes
Looking forward to contributing more translations to the project! 🚀
Tóm tắt những gì đã được dịch:
Tiêu đề và phần Intro: "Adding Interactivity" → "Thêm Tính Tương Tác"
Các phần chính:
"Responding to events" → "Phản hồi sự kiện"
"State: a component's memory" → "State: bộ nhớ của component"
"Render and commit" → "Render và commit"
"State as a snapshot" → "State như một snapshot"
"Queueing a series of state updates" → "Xếp hàng đợi một chuỗi cập nhật state"
"Updating objects in state" → "Cập nhật object trong state"
"Updating arrays in state" → "Cập nhật array trong state"
"What's next?" → "Tiếp theo là gì?"
Code examples đã được dịch:
Alert messages: 'Playing!' → 'Đang phát!', 'Uploading!' → 'Đang tải lên!'
Button text: 'Play Movie' → 'Phát Phim', 'Upload Image' → 'Tải Lên Ảnh'
Gallery controls: 'Next' → 'Tiếp theo', 'Hide/Show' → 'Ẩn/Hiện'
Form labels: 'Name' → 'Tên', 'Title' → 'Tiêu đề', 'City' → 'Thành phố'
Chat app: 'Send' → 'Gửi', 'Message' → 'Tin nhắn'
Counter: 'Score' → 'Điểm số'
Art Bucket List titles và descriptions
Tuân thủ quy tắc dịch:
Giữ nguyên các thuật ngữ kỹ thuật: Component, Hook, Props, Function, State, Render
Dịch các thuật ngữ user-facing: Application → Ứng dụng, Event → Sự kiện
Sử dụng văn phong kỹ thuật phù hợp cho tiếng Việt
Dịch tất cả LearnMore sections và liên kết nội bộ