docs(zh-Hans): translate 15 API reference pages (utils + components) - #523
theluckystrike wants to merge 1 commit into
Conversation
Closes the zh-Hans portion of toss#501. Layout follows ko/ pages; terminology per .claude/agents/agent-translation-reviewer zh-Hans style guide (full-width punctuation, half-width spacing around Latin/inline-code). Verified: code fences, <Interface> tag counts, and name/type attributes match source pages for all 15.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #523 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 69 69
Lines 2280 2280
Branches 737 737
=========================================
Hits 2280 2280 🚀 New features to boost your workflow:
|
|
|
||
| `ImpressionArea` 是一个组件,用于测量特定 DOM 元素在屏幕上的可见时间,并在元素进入或离开视口时执行回调。该组件使用 `useImpressionRef` 钩子来跟踪元素的可见性。 | ||
|
|
||
| ## Interface |
There was a problem hiding this comment.
Required: Heading left in English. The other zh-Hans pages use 接口 / 参数 / 返回值 / 示例.
| ## Interface | |
| ## 接口 |
| ): JSX.Element; | ||
| ``` | ||
|
|
||
| ### Parameters |
There was a problem hiding this comment.
Required: Heading left in English. The other zh-Hans pages use 接口 / 参数 / 返回值 / 示例.
| ### Parameters | |
| ### 参数 |
| description="用于样式设置的其他类名。" | ||
| /> | ||
|
|
||
| ### Return Value |
There was a problem hiding this comment.
Required: Heading left in English. The other zh-Hans pages use 接口 / 参数 / 返回值 / 示例.
| ### Return Value | |
| ### 返回值 |
| description="一个跟踪其子元素可见性的 React 组件。" | ||
| /> | ||
|
|
||
| ## Example |
There was a problem hiding this comment.
Required: Heading left in English. The other zh-Hans pages use 接口 / 参数 / 返回值 / 示例.
| ## Example | |
| ## 示例 |
| - bottom:34px(主屏幕指示条) | ||
| - left/right:0px | ||
|
|
||
| ## Interface |
There was a problem hiding this comment.
Required: Heading left in English. The other zh-Hans pages use 接口 / 参数 / 返回值 / 示例.
| ## Interface | |
| ## 接口 |
| <Interface | ||
| name="" | ||
| type="boolean" | ||
| description="如果设备运行在 iOS 或 iPadOS 上则返回 <code>true</code>,否则返回 <code>false</code>。在服务器端渲染环境中返回 <code>false</code>。" |
There was a problem hiding this comment.
Required: Glossary and the existing hook pages use 服务端渲染.
| description="如果设备运行在 iOS 或 iPadOS 上则返回 <code>true</code>,否则返回 <code>false</code>。在服务器端渲染环境中返回 <code>false</code>。" | |
| description="如果设备运行在 iOS 或 iPadOS 上则返回 <code>true</code>,否则返回 <code>false</code>。在服务端渲染环境中返回 <code>false</code>。" |
| @@ -0,0 +1,32 @@ | |||
| # isServer | |||
|
|
|||
| `isServer` 是一个用于检查代码是否在服务器上运行的工具函数。在 `window` 未定义的 SSR(服务器端渲染)环境中,它返回 `true`;在客户端环境中,它返回 `false`。 | |||
There was a problem hiding this comment.
Required: Glossary and the existing hook pages use 服务端渲染.
| `isServer` 是一个用于检查代码是否在服务器上运行的工具函数。在 `window` 未定义的 SSR(服务器端渲染)环境中,它返回 `true`;在客户端环境中,它返回 `false`。 | |
| `isServer` 是一个用于检查代码是否在服务器上运行的工具函数。在 `window` 未定义的 SSR(服务端渲染)环境中,它返回 `true`;在客户端环境中,它返回 `false`。 |
| @@ -0,0 +1,31 @@ | |||
| # getKeyboardHeight | |||
|
|
|||
| `getKeyboardHeight` 是一个工具函数,返回当前屏幕上显示的键盘高度(以像素为单位)。该函数使用 Visual Viewport API 来计算键盘高度。假定运行环境支持 Visual Viewport 的现代环境(Safari / WKWebView 14+,Chrome / Android WebView 80+)。键盘高度的计算方式如下:`window.innerHeight - visualViewport.height - visualViewport.offsetTop` —— 需要减去 `offsetTop` 是为了在键盘出现时正确处理 iOS 的行为。 | |||
There was a problem hiding this comment.
Required: The reason for subtracting offsetTop is missing. The source says "where the visual viewport may shift vertically when the keyboard appears".
| `getKeyboardHeight` 是一个工具函数,返回当前屏幕上显示的键盘高度(以像素为单位)。该函数使用 Visual Viewport API 来计算键盘高度。假定运行环境支持 Visual Viewport 的现代环境(Safari / WKWebView 14+,Chrome / Android WebView 80+)。键盘高度的计算方式如下:`window.innerHeight - visualViewport.height - visualViewport.offsetTop` —— 需要减去 `offsetTop` 是为了在键盘出现时正确处理 iOS 的行为。 | |
| `getKeyboardHeight` 是一个工具函数,返回当前屏幕上显示的键盘高度(以像素为单位)。该函数使用 Visual Viewport API 来计算键盘高度。假定运行环境支持 Visual Viewport 的现代环境(Safari / WKWebView 14+,Chrome / Android WebView 80+)。键盘高度的计算方式如下:`window.innerHeight - visualViewport.height - visualViewport.offsetTop` —— 需要减去 `offsetTop` 是为了正确处理 iOS 上键盘出现时 visual viewport 可能垂直偏移的情况。 |
|
|
||
| **注意事项** | ||
|
|
||
| - 所有 Android 浏览器的用户代理中都包含 'Android' 标记。 |
There was a problem hiding this comment.
Nit: Use full-width quotes in prose: “Android” / “iPad” / “MacIntel” (also isIOS.md L5–6).
| - 所有 Android 浏览器的用户代理中都包含 'Android' 标记。 | |
| - 所有 Android 浏览器的用户代理中都包含“Android”标记。 |
| @@ -0,0 +1,36 @@ | |||
| # isKeyboardVisible | |||
|
|
|||
| `isKeyboardVisible` 是用于检查当前屏幕键盘是否显示的工具函数。该函数内部使用 `getKeyboardHeight()`,当键盘高度大于 0 时返回 `true`。 | |||
There was a problem hiding this comment.
Nit: The existing hook pages use 此函数 rather than 该函数. Same in getKeyboardHeight.md (L3, L13), getSafeAreaInset.md (L5, L27) and isKeyboardVisible.md L13.
Closes the zh-Hans portion of #501 (per the roadmap in #497 — claiming the sub-issue as agreed in the issue thread).
What
15 API reference pages translated to Simplified Chinese — all 12
utilsand all 3componentspages that were missing azh-Hans/locale folder:utils: buildContext, disableBodyScrollLock, enableBodyScrollLock, getKeyboardHeight, getSafeAreaInset, isAndroid, isIOS, isKeyboardVisible, isServer, mergeProps, mergeRefs, subscribeKeyboardHeight
components: ImpressionArea, Separated, SwitchCase
Method
ko/(the reference layout per the contributing guide).claude/agents/agent-translation-reviewerzh-Hans rules: full-width punctuation (,。:;、()?!), half-width space between Chinese and adjacent Latin/digit/inline-code, identifiers untranslated.mdsources untouched (JSDoc-generated)Verification
Automated structural QA on all 15 files vs their source pages: code-fence counts,
<Interface>tag counts, andname=/type=attributes all match; no Korean remnants; CJK confirmed present.