Skip to content

Commit ecc9b95

Browse files
committed
feat: update translation
1 parent 309c279 commit ecc9b95

File tree

965 files changed

+132805
-141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

965 files changed

+132805
-141
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: "Vercel Build"
2+
description: "Build project artifacts using Vercel CLI for deployment."
3+
inputs:
4+
environment:
5+
description: "Vercel environment (production or preview)"
6+
required: true
7+
prodFlag:
8+
description: "Set to --prod for production deploys, empty for preview"
9+
required: false
10+
default: ""
11+
vercel_project_id:
12+
required: true
13+
vercel_org_id:
14+
required: true
15+
vercel_token:
16+
required: true
17+
runs:
18+
using: "composite"
19+
steps:
20+
- name: Pull Vercel Environment Information
21+
run: npx vercel pull --yes --environment=${{ inputs.environment }} --token=${{ inputs.vercel_token }}
22+
env:
23+
VERCEL_PROJECT_ID: ${{ inputs.vercel_project_id }}
24+
VERCEL_ORG_ID: ${{ inputs.vercel_org_id }}
25+
shell: bash
26+
- name: Echo Vercel Environment File
27+
run: |
28+
ls -l .vercel/.env*
29+
for f in .vercel/.env*; do
30+
echo "\n----- $f -----"
31+
cat "$f"
32+
done
33+
shell: bash
34+
- name: Build Project Artifacts
35+
run: npx vercel build ${{ inputs.prodFlag }} --token=${{ inputs.vercel_token }}
36+
env:
37+
VERCEL_PROJECT_ID: ${{ inputs.vercel_project_id }}
38+
VERCEL_ORG_ID: ${{ inputs.vercel_org_id }}
39+
shell: bash

.github/actions/vercel-deploy/action.yml

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,14 @@ outputs:
2424
runs:
2525
using: "composite"
2626
steps:
27-
- name: Pull Vercel Environment Information
28-
run: npx vercel pull --yes --environment=${{ inputs.environment }} --token=${{ inputs.vercel_token }}
29-
env:
30-
VERCEL_PROJECT_ID: ${{ inputs.vercel_project_id }}
31-
VERCEL_ORG_ID: ${{ inputs.vercel_org_id }}
32-
shell: bash
33-
- name: Echo Vercel Environment File
34-
run: |
35-
ls -l .vercel/.env*
36-
for f in .vercel/.env*; do
37-
echo "\n----- $f -----"
38-
cat "$f"
39-
done
40-
shell: bash
41-
- name: Build Project Artifacts
42-
run: npx vercel build ${{ inputs.prodFlag }} --token=${{ inputs.vercel_token }}
43-
env:
44-
VERCEL_PROJECT_ID: ${{ inputs.vercel_project_id }}
45-
VERCEL_ORG_ID: ${{ inputs.vercel_org_id }}
46-
shell: bash
27+
- name: Build with Vercel
28+
uses: ./.github/actions/vercel-build
29+
with:
30+
environment: ${{ inputs.environment }}
31+
prodFlag: ${{ inputs.prodFlag }}
32+
vercel_project_id: ${{ inputs.vercel_project_id }}
33+
vercel_org_id: ${{ inputs.vercel_org_id }}
34+
vercel_token: ${{ inputs.vercel_token }}
4735
- name: Deploy Project Artifacts
4836
id: vercel_deploy
4937
run: |

.github/workflows/prerelease.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
name: Prerelease
22

33
on:
4-
workflow_dispatch:
54
pull_request:
65
types:
76
- opened
87
- labeled
98
- synchronize
9+
branches-ignore:
10+
- docs/update-translations
11+
- docs/sync-nextjs-documentation
1012

1113
permissions:
1214
pull-requests: write
1315
issues: write
1416

1517
jobs:
1618
deploy:
19+
if: |
20+
github.event_name == 'pull_request' &&
21+
contains(github.event.pull_request.labels.*.name, 'prerelease')
1722
runs-on: ubuntu-latest
1823
strategy:
1924
matrix:

.github/workflows/update-docs-ci.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,34 @@ on:
77
- docs/sync-nextjs-documentation
88

99
jobs:
10-
translate:
10+
deploy-and-update-index:
1111
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
include:
15+
- locale: en
16+
secret_project_id: VERCEL_PROJECT_EN_ID
17+
orama_private_api_key: ORAMA_PRIVATE_API_KEY_EN
18+
- locale: zh-hans
19+
secret_project_id: VERCEL_PROJECT_ZH_HANS_ID
20+
orama_private_api_key: ORAMA_PRIVATE_API_KEY_ZH_HANS
21+
- locale: zh-hant
22+
secret_project_id: VERCEL_PROJECT_ZH_HANT_ID
23+
orama_private_api_key: ORAMA_PRIVATE_API_KEY_ZH_HANT
24+
name: Deploy ${{ matrix.locale }}
1225
steps:
13-
# Checkout the repository first to access local actions
1426
- name: Checkout code
1527
uses: actions/checkout@v3
1628
with:
1729
fetch-depth: 1
1830
- name: Setup Tools
19-
# After pnpm install, apps/docs will execute postinstall: fumadocs-mdx
20-
# Which will generated MDX types (check if the docs frontmatter is correct)
2131
uses: ./.github/actions/setup
32+
- name: Build (${{ matrix.locale }})
33+
id: deploy
34+
uses: ./.github/actions/vercel-build
35+
with:
36+
environment: production
37+
prodFlag: --prod
38+
vercel_project_id: ${{ secrets[matrix.secret_project_id] }}
39+
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
40+
vercel_token: ${{ secrets.VERCEL_TOKEN }}

apps/docs/content/zh-hans/docs/01-app/01-getting-started/06-css.mdx

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
source-updated-at: 2025-05-19T22:31:51.000Z
3-
translation-updated-at: 2025-05-19T23:06:25.929Z
2+
source-updated-at: 2025-05-25T15:16:02.000Z
3+
translation-updated-at: 2025-05-25T20:26:25.233Z
44
title: 如何在应用中使用 CSS
55
nav_title: CSS
66
description: 了解在应用中添加 CSS 的不同方式,包括 CSS 模块 (CSS Modules)、全局 CSS (Global CSS)、Tailwind CSS 等。
77
related:
8-
title: 下一步
9-
description: 进一步了解在应用中使用 CSS 的其他方式
8+
title: 后续步骤
9+
description: 进一步了解在应用中使用 CSS 的其他替代方案
1010
links:
1111
- app/guides/tailwind-css
1212
- app/guides/sass
@@ -24,13 +24,13 @@ Next.js 提供了多种在应用中使用 CSS 的方式,包括:
2424

2525
## CSS 模块 (CSS Modules)
2626

27-
CSS 模块 (CSS Modules) 通过生成唯一的类名来实现 CSS 的局部作用域。这允许你在不同文件中使用相同的类名而无需担心命名冲突
27+
CSS 模块通过生成唯一的类名来实现 CSS 的局部作用域,这样您可以在不同文件中使用相同的类名而无需担心命名冲突
2828

2929
<AppOnly>
3030

31-
要开始使用 CSS 模块 (CSS Modules),创建一个扩展名为 `.module.css` 的文件,并将其导入到 `app` 目录下的任意组件中
31+
要开始使用 CSS 模块,请创建一个扩展名为 `.module.css` 的新文件,并将其导入到 `app` 目录中的任意组件
3232

33-
```css filename="app/blog/styles.module.css"
33+
```css filename="app/blog/blog.module.css"
3434
.blog {
3535
padding: 24px;
3636
}
@@ -56,7 +56,7 @@ export default function Layout() {
5656

5757
<PagesOnly>
5858

59-
要开始使用 CSS 模块 (CSS Modules),创建一个扩展名为 `.module.css` 的文件,并将其导入到 `pages` 目录下的任意组件中
59+
要开始使用 CSS 模块,请创建一个扩展名为 `.module.css` 的新文件,并将其导入到 `pages` 目录中的任意组件
6060

6161
```css filename="/styles/blog.module.css"
6262
.blog {
@@ -84,11 +84,11 @@ export default function Page() {
8484

8585
## 全局 CSS (Global CSS)
8686

87-
你可以使用全局 CSS (Global CSS) 在整个应用中应用样式
87+
您可以使用全局 CSS 来为整个应用应用样式
8888

8989
<AppOnly>
9090

91-
创建一个 `app/global.css` 文件,并在根布局中导入它,以将样式应用到应用中的**每个路由**
91+
创建一个 `app/global.css` 文件并将其导入根布局 (root layout),这样样式将应用到应用中的**每个路由**
9292

9393
```css filename="app/global.css"
9494
body {
@@ -99,7 +99,7 @@ body {
9999
```
100100

101101
```tsx filename="app/layout.tsx" switcher
102-
// 这些样式会应用到应用中的每个路由
102+
// 这些样式将应用到应用中的每个路由
103103
import './global.css'
104104

105105
export default function RootLayout({
@@ -116,7 +116,7 @@ export default function RootLayout({
116116
```
117117

118118
```jsx filename="app/layout.js" switcher
119-
// 这些样式会应用到应用中的每个路由
119+
// 这些样式将应用到应用中的每个路由
120120
import './global.css'
121121

122122
export default function RootLayout({ children }) {
@@ -128,13 +128,13 @@ export default function RootLayout({ children }) {
128128
}
129129
```
130130

131-
> **须知:** 全局样式可以导入到 `app` 目录下的任何布局、页面或组件中。但由于 Next.js 使用 React 内置的样式表支持来与 Suspense 集成,目前这不会在路由切换时移除样式表,可能导致冲突。我们建议将全局样式用于**真正**全局的 CSS,而使用 [CSS 模块 (CSS Modules)](#css-modules) 来限定 CSS 作用域
131+
> **须知:** 全局样式可以导入到 `app` 目录中的任何布局、页面或组件。但由于 Next.js 使用 React 内置的样式表支持来与 Suspense 集成,目前在不同路由之间导航时不会移除样式表,这可能导致冲突。我们建议将全局样式用于**真正**全局的 CSS,而对于局部作用域的 CSS 使用 [CSS 模块 (CSS Modules)](#css-modules)
132132
133133
</AppOnly>
134134

135135
<PagesOnly>
136136

137-
`pages/_app.js` 文件中导入样式表,以将样式应用到应用中的**每个路由**
137+
将样式表导入 `pages/_app.js` 文件,这样样式将应用到应用中的**每个路由**
138138

139139
```tsx filename="pages/_app.js"
140140
import '@/styles/global.css'
@@ -144,11 +144,11 @@ export default function MyApp({ Component, pageProps }) {
144144
}
145145
```
146146

147-
由于样式表的全局性质,为避免冲突,你应该在 [`pages/_app.js`](/docs/pages/building-your-application/routing/custom-app) 中导入它们。
147+
由于样式表的全局性质,为避免冲突,您应该在 [`pages/_app.js`](/docs/pages/building-your-application/routing/custom-app) 中导入它们。
148148

149149
</PagesOnly>
150150

151-
## 外部样式表 (External stylesheets)
151+
## 外部样式表 (External Stylesheets)
152152

153153
<AppOnly>
154154

@@ -188,13 +188,13 @@ export default function RootLayout({ children }) {
188188

189189
<PagesOnly>
190190

191-
Next.js 允许你从 JavaScript 文件中导入 CSS 文件。这是因为 Next.js 扩展了 [`import`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/import) 的概念,使其不仅限于 JavaScript。
191+
Next.js 允许您从 JavaScript 文件导入 CSS 文件。这是可能的,因为 Next.js 扩展了 [`import`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/import) 的概念,使其不仅限于 JavaScript。
192192

193193
### `node_modules` 导入样式
194194

195195
自 Next.js **9.5.4** 起,允许从 `node_modules` 导入 CSS 文件到应用中的任何位置。
196196

197-
对于全局样式表,如 `bootstrap``nprogress`你应该在 `pages/_app.js` 中导入文件。例如:
197+
对于全局样式表,如 `bootstrap``nprogress`您应该在 `pages/_app.js` 中导入文件。例如:
198198

199199
```jsx filename="pages/_app.js"
200200
import 'bootstrap/dist/css/bootstrap.css'
@@ -204,7 +204,7 @@ export default function MyApp({ Component, pageProps }) {
204204
}
205205
```
206206

207-
对于第三方组件所需的 CSS,你可以在组件中导入。例如:
207+
对于第三方组件所需的 CSS,您可以在组件中导入。例如:
208208

209209
```jsx filename="components/example-dialog.js"
210210
import { useState } from 'react'
@@ -219,13 +219,13 @@ function ExampleDialog(props) {
219219

220220
return (
221221
<div>
222-
<button onClick={open}>Open Dialog</button>
222+
<button onClick={open}>打开对话框</button>
223223
<Dialog isOpen={showDialog} onDismiss={close}>
224224
<button className="close-button" onClick={close}>
225-
<VisuallyHidden>Close</VisuallyHidden>
225+
<VisuallyHidden>关闭</VisuallyHidden>
226226
<span aria-hidden>×</span>
227227
</button>
228-
<p>Hello there. I am a dialog</p>
228+
<p>你好,我是一个对话框</p>
229229
</Dialog>
230230
</div>
231231
)
@@ -236,7 +236,7 @@ function ExampleDialog(props) {
236236

237237
## 排序与合并 (Ordering and Merging)
238238

239-
Next.js 在生产构建时会通过自动分块(合并)样式表来优化 CSS。**CSS 的顺序**取决于**你在代码中导入样式的顺序**
239+
Next.js 在生产构建时会通过自动分块(合并)样式表来优化 CSS。**CSS 的顺序**取决于**您在代码中导入样式的顺序**
240240

241241
例如,`base-button.module.css` 会排在 `page.module.css` 之前,因为 `<BaseButton>``page.module.css` 之前导入:
242242

@@ -280,15 +280,15 @@ export function BaseButton() {
280280

281281
- 尽量将 CSS 导入限制在单个 JavaScript 或 TypeScript 入口文件中
282282
- 在应用的根目录中导入全局样式和 Tailwind 样式表
283-
- 对于嵌套组件,使用 CSS 模块 (CSS Modules) 而非全局样式
284-
- 为 CSS 模块使用一致的命名约定,例如使用 `<name>.module.css` 而非 `<name>.tsx`
283+
- 对于嵌套组件,使用 CSS 模块而非全局样式
284+
- 为 CSS 模块使用一致的命名约定。例如,使用 `<name>.module.css` 而非 `<name>.tsx`
285285
- 将共享样式提取到共享组件中以避免重复导入
286286
- 关闭自动排序导入的 linter 或格式化工具,如 ESLint 的 [`sort-imports`](https://eslint.org/docs/latest/rules/sort-imports)
287-
- 你可以在 `next.config.js` 中使用 [`cssChunking`](/docs/app/api-reference/config/next-config-js/cssChunking) 选项来控制 CSS 的分块方式
287+
- 您可以在 `next.config.js` 中使用 [`cssChunking`](/docs/app/api-reference/config/next-config-js/cssChunking) 选项来控制 CSS 的分块方式
288288

289289
## 开发与生产环境 (Development vs Production)
290290

291291
- 在开发环境 (`next dev`) 中,CSS 更新会通过 [快速刷新 (Fast Refresh)](/docs/architecture/fast-refresh) 即时应用
292292
- 在生产环境 (`next build`) 中,所有 CSS 文件会自动合并为**多个经过压缩和代码拆分**`.css` 文件,确保为路由加载最少数量的 CSS
293-
- 在生产环境中,即使禁用 JavaScript,CSS 仍会加载,但在开发环境中需要 JavaScript 以实现快速刷新 (Fast Refresh)
293+
- 在生产环境中,即使禁用 JavaScript,CSS 仍会加载,但在开发环境中需要 JavaScript 来实现快速刷新
294294
- CSS 顺序在开发环境中可能表现不同,请务必检查构建 (`next build`) 以验证最终的 CSS 顺序

0 commit comments

Comments
 (0)