[zh-Hans] translate API docs: utils and components (15) - #525
Conversation
|
hyesungoh
left a comment
There was a problem hiding this comment.
Thanks for the translation! One required fix before merging (the mergeRefs example), plus a few small typography nits.
| ```tsx | ||
| function Component(props) { | ||
| const ref = useRef(null); | ||
| const eight, setHeight] = useState(0); |
There was a problem hiding this comment.
Required: The English source is correct here (mergeRefs.md:45 has const [height, setHeight]). The [ and h were dropped during translation. Could you also remove the "reported typo" paragraph from the PR description?
| const eight, setHeight] = useState(0); | |
| const [height, setHeight] = useState(0); |
|
|
||
| 注意: | ||
|
|
||
| - 所有 Android 浏览器的 user agent 中都包含 “Android” 字符串。 |
There was a problem hiding this comment.
Nit: No spaces around full-width quotes.
| - 所有 Android 浏览器的 user agent 中都包含 “Android” 字符串。 | |
| - 所有 Android 浏览器的 user agent 中都包含“Android”字符串。 |
| - 在 iPadOS 13 之前,iPad 申报的平台为 “iPad”(或在 UA 中匹配 /iPad/)。 | ||
| - 从 iPadOS 13 开始,Apple 将平台字符串改为 “MacIntel”,让网站将 iPadOS 当作桌面级 Safari 对待。但这些设备仍然支持多点触控。 |
There was a problem hiding this comment.
Nit: Same here — no spaces around full-width quotes.
| - 在 iPadOS 13 之前,iPad 申报的平台为 “iPad”(或在 UA 中匹配 /iPad/)。 | |
| - 从 iPadOS 13 开始,Apple 将平台字符串改为 “MacIntel”,让网站将 iPadOS 当作桌面级 Safari 对待。但这些设备仍然支持多点触控。 | |
| - 在 iPadOS 13 之前,iPad 申报的平台为“iPad”(或在 UA 中匹配 /iPad/)。 | |
| - 从 iPadOS 13 开始,Apple 将平台字符串改为“MacIntel”,让网站将 iPadOS 当作桌面级 Safari 对待。但这些设备仍然支持多点触控。 |
| - top: 47-59px(刘海/灵动岛) | ||
| - bottom: 34px(主屏幕指示条) | ||
| - left/right: 0px |
There was a problem hiding this comment.
Nit: Full-width : to match lines 9–11.
| - top: 47-59px(刘海/灵动岛) | |
| - bottom: 34px(主屏幕指示条) | |
| - left/right: 0px | |
| - top:47-59px(刘海/灵动岛) | |
| - bottom:34px(主屏幕指示条) | |
| - left/right:0px |
| @@ -0,0 +1,55 @@ | |||
| # mergeRefs | |||
|
|
|||
| `mergeRefs` 接收多个 ref(RefObject 或 RefCallback),返回一个能更新所有传入 ref 的单一 ref。当你需要向单个元素同时传递多个 ref 时很有用。当回调 ref 返回清理函数(React 19)时,合并后的 ref 也会返回一个清理函数,并在卸载时执行所有清理操作。 | |||
There was a problem hiding this comment.
Nit: "on detach" → 在分离时. A ref also detaches when it's swapped for another element, not only on unmount.
| `mergeRefs` 接收多个 ref(RefObject 或 RefCallback),返回一个能更新所有传入 ref 的单一 ref。当你需要向单个元素同时传递多个 ref 时很有用。当回调 ref 返回清理函数(React 19)时,合并后的 ref 也会返回一个清理函数,并在卸载时执行所有清理操作。 | |
| `mergeRefs` 接收多个 ref(RefObject 或 RefCallback),返回一个能更新所有传入 ref 的单一 ref。当你需要向单个元素同时传递多个 ref 时很有用。当回调 ref 返回清理函数(React 19)时,合并后的 ref 也会返回一个清理函数,并在分离时执行所有清理操作。 |
- restore dropped [h in mergeRefs example to match English source - on detach -> 在分离时 (refs also detach on element swap) - remove spaces around full-width quotes (isAndroid/isIOS) - full-width colon in getSafeAreaInset typical values
|
Thanks @hyesungoh for the thorough review! All feedback applied in 45e3ebb:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #525 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 69 69
Lines 2280 2280
Branches 737 737
=========================================
Hits 2280 2280 🚀 New features to boost your workflow:
|
Translates all 15 remaining zh-Hans API reference pages, as claimed in my comment on the issue. Follows
agent-translation-reviewer.md(zh-Hans glossary and typography rules:Hookkept in English, full-width punctuation in prose, half-width spaces at CJK–Latin boundaries, 书面语 with 你) and theko/directory layout.utils (12):
buildContext,disableBodyScrollLock,enableBodyScrollLock,getKeyboardHeight,getSafeAreaInset,isAndroid,isIOS,isKeyboardVisible,isServer,mergeProps,mergeRefs,subscribeKeyboardHeightcomponents (3):
ImpressionArea,Separated,SwitchCaseConventions kept consistent with the already-translated hooks pages:
ref/props/React/TypeScript/SSR kept as-isCloses #501