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 reference/react-dom/hooks/useFormState into Chinese #1367

Merged
merged 17 commits into from
Nov 13, 2023

Conversation

lony2003
Copy link
Contributor

@lony2003 lony2003 commented Oct 28, 2023

close #1363 .

@github-actions
Copy link

github-actions bot commented Oct 28, 2023

Size changes

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@lony2003
Copy link
Contributor Author

lony2003 commented Oct 28, 2023

存在问题:

  1. “随 form action 被调用” 处链接为无效链接,但原版就是这样的
  2. “在 hydration 完成前显示” 这部分本来想翻成在服务端渲染完成前显示,但是好像表意不是那么明朗,查询其他的页面发现这个词没有被翻,就留在这了。
  3. state 和 form action 都没翻,理由同上
  4. 有一些地方的翻译是按照自己的主观理解和使用情况翻的,不知道合不合理。
  5. “才可以使用 useFormState 的所有特性。” 这个地方会不会有些表达的不明白?

Copy link
Member

@Huxpro Huxpro left a comment

Choose a reason for hiding this comment

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

Let's collectively think of how to translate "action", "server action", "form action" in a standardized manner


</Canary>

<Intro>

`useFormState` is a Hook that allows you to update state based on the result of a form action.
`useFormState` 是一个可以让你根据某个 form action 的结果更新 State 的 Hook。
Copy link
Member

Choose a reason for hiding this comment

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

form action 要看看怎么翻译:

  1. "form action" 本身作为术语保留
  2. 整体翻译
  3. form 翻译,action 理解为 Server Action 所以作为术语大写(另外,experimental_taintUniqueValue 文档里的 server action 是翻译了,我觉得可以不翻)

另外可以参考 MDN 中文的 form action 怎么翻译的

Copy link
Contributor Author

Choose a reason for hiding this comment

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

在我的理解中 form action 表示的是 form 标签的 action 属性,或者也可以表达一个整体,所以我觉得如果要翻的话整体翻为表单动作或者表单操作会好一些

Copy link
Contributor Author

Choose a reason for hiding this comment

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

不只是 form 标签的 action 属性,button 标签中的 formAction 属性也是这个意思,指代表单提交时的动作,我觉得可以翻为表单动作,或者直接不翻

Copy link
Contributor Author

Choose a reason for hiding this comment

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

至于 server action ,我这个文件里也有server action相关的信息,和 form action 不同,我认为这里指代的其实是类似于调API这类的操作,说实话我一开始也没翻译这个,不过我看experimental_taintUniqueValue里翻了所以就跟着翻了

Copy link
Collaborator

@Yucohny Yucohny left a comment

Choose a reason for hiding this comment

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

@lony2003 烦请对照翻译规范自查格式~

src/content/reference/react-dom/hooks/useFormState.md Outdated Show resolved Hide resolved
src/content/reference/react-dom/hooks/useFormState.md Outdated Show resolved Hide resolved
src/content/reference/react-dom/hooks/useFormState.md Outdated Show resolved Hide resolved
src/content/reference/react-dom/hooks/useFormState.md Outdated Show resolved Hide resolved
@lony2003
Copy link
Contributor Author

@Yucohny 我已自查格式。烦请再次review。谢谢!

@Yucohny Yucohny added the Pending Review 已翻译,待校对阶段 label Oct 30, 2023
@Yucohny
Copy link
Collaborator

Yucohny commented Oct 31, 2023

Let's collectively think of how to translate "action", "server action", "form action" in a standardized manner

其实对应也还有 client action 这个说法,这个说法应该是与 server action 对应提出来的。直接翻译就是「服务器/端操作」、「客户端操作」,但是感觉很怪。此处直接保留 client action 与 server action 感觉勉强能说得过去,action 作为「操作」的泛指。
但是 form action 中的 action 则不同,含义比较明确,即「提交表单」,所以我认为 form action 是需要考虑一个更加确切的翻译的。

@Yucohny Yucohny requested a review from Huxpro October 31, 2023 09:04
@lony2003
Copy link
Contributor Author

但是 form action 中的 action 则不同,含义比较明确,即「提交表单」

我觉得这里的action更多的表示一个提交表单的动作或者说表示应该如何提交的这么一个方法。

根据MDN上 formaction 的描述

表示程序处理 button 提交信息的 URI。如果指定了,将重写 button 表单拥有者的action属性。

form action 指代的就是 form 的 action 属性或者 button 的 formaction 属性,所以这里翻译为「表单动作」或者不翻应该是比较好的选择。但我个人比较倾向于不翻译,毕竟 form action 学过 html 的人应该都会懂,但要是真翻译出来可能有的人就不是那么理解了。

当然 MDN 中的 form action 只是一个字符串,并没有支持一个函数,所以这里的定义也可能会不那么合理就是了。

@Huxpro
Copy link
Member

Huxpro commented Nov 6, 2023

@Yucohny @lony2003 感谢讨论,

  1. "Server Action" 可以被认定是一个 React 的专有名词,应该在英文官网中类似 Effect 一样全文首字母大写才对。我同意统一不翻译,我会给原文发一个 PR。

  2. form action 这里比较难评,算是重载了传统意义上 html 的 <form action> 和 ` 与 React 意义上的 Action 专有名词,我给原文发一个 issue 讨论一下。

@Huxpro
Copy link
Member

Huxpro commented Nov 7, 2023

  1. "Server Action" 可以被认定是一个 React 的专有名词,应该在英文官网中类似 Effect 一样全文首字母大写才对。我同意统一不翻译,我会给原文发一个 PR。
  2. form action 这里比较难评,算是重载了传统意义上 html 的 <form action> 和 ` 与 React 意义上的 Action 专有名词,我给原文发一个 issue 讨论一下。

Hi @Yucohny @lony2003,

1 is done at reactjs/react.dev#6417 and @lony2003 had made updates here accordingly.

Regarding 2, I realized from https://react.dev/reference/react-dom/components/form#props that the action prop of React's <form> can take not only functions e.g. Server Action, but as well as traditional URL-based HTML actions, so it's definitely not limited to React Action and shall be translated:

Candidates include:

  • 表单提交
  • 表单动作
  • 表单操作

I personally prefer translating "action" as 操作 or 动作 so it makes sense when it's used separately (e.g. "the action").

@Yucohny
Copy link
Collaborator

Yucohny commented Nov 8, 2023

  1. "Server Action" 可以被认定是一个 React 的专有名词,应该在英文官网中类似 Effect 一样全文首字母大写才对。我同意统一不翻译,我会给原文发一个 PR。
  2. form action 这里比较难评,算是重载了传统意义上 html 的 <form action> 和 ` 与 React 意义上的 Action 专有名词,我给原文发一个 issue 讨论一下。

Hi @Yucohny @lony2003,

1 is done at reactjs/react.dev#6417 and @lony2003 had made updates here accordingly.

Regarding 2, I realized from https://react.dev/reference/react-dom/components/form#props that the action prop of React's <form> can take not only functions e.g. Server Action, but as well as traditional URL-based HTML actions, so it's definitely not limited to React Action and shall be translated:

Candidates include:

  • 表单提交
  • 表单动作
  • 表单操作

I personally prefer translating "action" as 操作 or 动作 so it makes sense when it's used separately (e.g. "the action").

form action(s) 就翻译为「表单动作」吧。

@Yucohny
Copy link
Collaborator

Yucohny commented Nov 8, 2023

@lony2003 请自行处理一下最新的文件冲突。

@lony2003
Copy link
Contributor Author

lony2003 commented Nov 8, 2023

@Yucohny form action 已改为「表单动作」,冲突已处理。

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

Successfully merging this pull request may close these issues.

translate useFormState into Chinese
4 participants