Skip to content

Commit 4cc0e5b

Browse files
🌐 Update translations for zh-hant (update-outdated) (#15671)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent d144531 commit 4cc0e5b

10 files changed

Lines changed: 73 additions & 243 deletions

File tree

docs/zh-hant/docs/_llm-test.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,6 @@ works(foo="bar") # 這可以運作 🎉
124124

125125
//// tab | 測試
126126

127-
/// info | 資訊
128-
Some text
129-
///
130-
131127
/// note | 注意
132128
Some text
133129
///
@@ -136,10 +132,6 @@ Some text
136132
Some text
137133
///
138134

139-
/// check | 檢查
140-
Some text
141-
///
142-
143135
/// tip | 提示
144136
Some text
145137
///

docs/zh-hant/docs/alternatives.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Django REST Framework 由 Tom Christie 創建。他同時也是 Starlette 與 Uv
3636

3737
///
3838

39-
/// check | 啟發 **FastAPI**
39+
/// tip | 啟發 **FastAPI**
4040

4141
提供自動化的 API 文件網頁使用者介面。
4242

@@ -56,7 +56,7 @@ Flask 是一個「微框架」,它不包含資料庫整合,也沒有像 Djan
5656

5757
基於 Flask 的簡潔,它看起來很適合用來構建 API。接下來要找的,就是 Flask 世界裡的「Django REST Framework」。
5858

59-
/// check | 啟發 **FastAPI**
59+
/// tip | 啟發 **FastAPI**
6060

6161
成為一個微框架,讓所需的工具與元件能輕鬆搭配組合。
6262

@@ -98,7 +98,7 @@ def read_url():
9898

9999
看看 `requests.get(...)``@app.get(...)` 的相似之處。
100100

101-
/// check | 啟發 **FastAPI**
101+
/// tip | 啟發 **FastAPI**
102102

103103
* 擁有簡單直觀的 API。
104104
* 直接使用 HTTP 方法名稱(操作),以直接、直觀的方式表達。
@@ -118,7 +118,7 @@ def read_url():
118118

119119
因此,談到 2.0 版時常說「Swagger」,而 3+ 版則是「OpenAPI」。
120120

121-
/// check | 啟發 **FastAPI**
121+
/// tip | 啟發 **FastAPI**
122122

123123
採用並使用開放的 API 規格標準,而非自訂格式。
124124

@@ -147,7 +147,7 @@ API 需要的另一個重要功能是資料驗證,確保資料在特定條件
147147

148148
但它誕生於 Python 型別提示出現之前。因此,為了定義每個 <dfn title="資料應如何組成的定義">結構(schema)</dfn>,你需要使用 Marshmallow 提供的特定工具與類別。
149149

150-
/// check | 啟發 **FastAPI**
150+
/// tip | 啟發 **FastAPI**
151151

152152
用程式碼定義能自動提供資料型別與驗證的「schemas」。
153153

@@ -163,13 +163,13 @@ Webargs 是在多個框架(包含 Flask)之上提供該功能的工具。
163163

164164
它是一個很棒的工具,在有 **FastAPI** 之前我也經常使用。
165165

166-
/// info
166+
/// note
167167

168168
Webargs 由與 Marshmallow 相同的開發者創建。
169169

170170
///
171171

172-
/// check | 啟發 **FastAPI**
172+
/// tip | 啟發 **FastAPI**
173173

174174
自動驗證傳入請求資料。
175175

@@ -193,13 +193,13 @@ Marshmallow 與 Webargs 以外掛提供驗證、解析與序列化。
193193

194194
編輯器幫不上太多忙。而且如果我們修改了參數或 Marshmallow 的 schemas 卻忘了同步修改 YAML docstring,產生的結構就會過時。
195195

196-
/// info
196+
/// note
197197

198198
APISpec 由與 Marshmallow 相同的開發者創建。
199199

200200
///
201201

202-
/// check | 啟發 **FastAPI**
202+
/// tip | 啟發 **FastAPI**
203203

204204
支援 API 的開放標準 OpenAPI。
205205

@@ -225,13 +225,13 @@ APISpec 由與 Marshmallow 相同的開發者創建。
225225

226226
而這些全端產生器,也成為了 [**FastAPI** 專案產生器](project-generation.md) 的基礎。
227227

228-
/// info
228+
/// note
229229

230230
Flask-apispec 由與 Marshmallow 相同的開發者創建。
231231

232232
///
233233

234-
/// check | 啟發 **FastAPI**
234+
/// tip | 啟發 **FastAPI**
235235

236236
從定義序列化與驗證的相同程式碼,自動產生 OpenAPI 結構(schema)。
237237

@@ -251,7 +251,7 @@ Flask-apispec 由與 Marshmallow 相同的開發者創建。
251251

252252
它無法很好地處理巢狀模型。若請求的 JSON 主體中有內層欄位,且這些內層欄位又是巢狀 JSON 物件,就無法被妥善地文件化與驗證。
253253

254-
/// check | 啟發 **FastAPI**
254+
/// tip | 啟發 **FastAPI**
255255

256256
使用 Python 型別以獲得優秀的編輯器支援。
257257

@@ -271,7 +271,7 @@ Flask-apispec 由與 Marshmallow 相同的開發者創建。
271271

272272
///
273273

274-
/// check | 啟發 **FastAPI**
274+
/// tip | 啟發 **FastAPI**
275275

276276
想辦法達到瘋狂的效能。
277277

@@ -287,7 +287,7 @@ Falcon 是另一個高效能 Python 框架,設計上極簡,並作為其他
287287

288288
因此,資料驗證、序列化與文件必須以程式碼手動完成,無法自動化。或者需在 Falcon 之上實作另一層框架(如 Hug)。其他受 Falcon 設計啟發的框架也有同樣的區別:將 request 與 response 物件作為參數。
289289

290-
/// check | 啟發 **FastAPI**
290+
/// tip | 啟發 **FastAPI**
291291

292292
設法取得優秀的效能。
293293

@@ -313,7 +313,7 @@ Falcon 是另一個高效能 Python 框架,設計上極簡,並作為其他
313313

314314
路由需要在單一地方宣告,使用在其他地方宣告的函式(而不是用可以直接放在端點處理函式上方的裝飾器)。這更接近 Django 的作法,而不是 Flask(與 Starlette)的作法。它在程式碼中分離了其實相當緊密耦合的事物。
315315

316-
/// check | 啟發 **FastAPI**
316+
/// tip | 啟發 **FastAPI**
317317

318318
用模型屬性的「預設值」來定義資料型別的額外驗證。這提升了編輯器支援,而這在當時的 Pydantic 還不支援。
319319

@@ -335,13 +335,13 @@ Hug 是最早使用 Python 型別提示來宣告 API 參數型別的框架之一
335335

336336
由於它基於同步 Python 網頁框架的舊標準(WSGI),無法處理 WebSocket 與其他功能,儘管效能仍然很高。
337337

338-
/// info
338+
/// note
339339

340340
Hug 由 Timothy Crosley 創建,他同時也是 [`isort`](https://github.com/timothycrosley/isort) 的作者,一個自動排序 Python 匯入的好工具。
341341

342342
///
343343

344-
/// check | 啟發 **FastAPI** 的想法
344+
/// tip | 啟發 **FastAPI** 的想法
345345

346346
Hug 啟發了 APIStar 的部分設計,也是我覺得最有前景的工具之一,與 APIStar 並列。
347347

@@ -375,7 +375,7 @@ Hug 啟發 **FastAPI** 在函式中宣告 `response` 參數以設定標頭與 Co
375375

376376
現在的 APIStar 是一套用於驗證 OpenAPI 規格的工具,不是網頁框架。
377377

378-
/// info
378+
/// note
379379

380380
APIStar 由 Tom Christie 創建。他也創建了:
381381

@@ -385,7 +385,7 @@ APIStar 由 Tom Christie 創建。他也創建了:
385385

386386
///
387387

388-
/// check | 啟發 **FastAPI**
388+
/// tip | 啟發 **FastAPI**
389389

390390
存在。
391391

@@ -409,7 +409,7 @@ Pydantic 是基於 Python 型別提示,定義資料驗證、序列化與文件
409409

410410
它可與 Marshmallow 相提並論。儘管在效能測試中它比 Marshmallow 更快。而且因為它基於相同的 Python 型別提示,編輯器支援也很出色。
411411

412-
/// check | **FastAPI** 用於
412+
/// tip | **FastAPI** 用於
413413

414414
處理所有資料驗證、資料序列化與自動模型文件(基於 JSON Schema)。
415415

@@ -452,7 +452,7 @@ ASGI 是由 Django 核心團隊成員正在開發的新「標準」。它尚未
452452

453453
///
454454

455-
/// check | **FastAPI** 用於
455+
/// tip | **FastAPI** 用於
456456

457457
處理所有核心網頁部分,並在其上加上功能。
458458

@@ -470,7 +470,7 @@ Uvicorn 是基於 uvloop 與 httptools 的極速 ASGI 伺服器。
470470

471471
它是 Starlette 與 **FastAPI** 推薦使用的伺服器。
472472

473-
/// check | **FastAPI** 建議用作
473+
/// tip | **FastAPI** 建議用作
474474

475475
執行 **FastAPI** 應用的主要網頁伺服器。
476476

docs/zh-hant/docs/async.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def results():
139139

140140
<img src="/img/async/concurrent-burgers/concurrent-burgers-07.png" class="illustration">
141141

142-
/// info
142+
/// note | 注意
143143

144144
漂亮的插畫來自 [Ketrina Thompson](https://www.instagram.com/ketrinadrawsalot)。 🎨
145145

@@ -205,7 +205,7 @@ def results():
205205

206206
整個過程中沒有太多的談情說愛,因為大部分時間 🕙 都花在櫃檯前等待。😞
207207

208-
/// info
208+
/// note | 注意
209209

210210
漂亮的插畫來自 [Ketrina Thompson](https://www.instagram.com/ketrinadrawsalot)。 🎨
211211

docs/zh-hant/docs/fastapi-cli.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,21 @@ entrypoint = "backend.main:app"
9595
from backend.main import app
9696
```
9797

98-
### 帶路徑的 `fastapi dev` { #fastapi-dev-with-path }
98+
### 帶路徑或使用 `--entrypoint` 選項的 `fastapi dev` { #fastapi-dev-with-path-or-with-entrypoint-cli-option }
9999

100100
你也可以把檔案路徑傳給 `fastapi dev` 指令,它會推測要使用的 FastAPI app 物件:
101101

102102
```console
103103
$ fastapi dev main.py
104104
```
105105

106-
但這樣每次呼叫 `fastapi` 指令時都得記得傳入正確的路徑。
106+
或者,你也可以把 `--entrypoint` 選項傳給 `fastapi dev` 指令:
107+
108+
```console
109+
$ fastapi dev --entrypoint main:app
110+
```
111+
112+
但這樣每次呼叫 `fastapi` 指令時都得記得傳入正確的路徑或 entrypoint。
107113

108114
此外,其他工具可能找不到它,例如 [VS Code 擴充套件](editor-support.md)[FastAPI Cloud](https://fastapicloud.com),因此建議在 `pyproject.toml` 中使用 `entrypoint`
109115

docs/zh-hant/docs/features.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ second_user_data = {
6363
my_second_user: User = User(**second_user_data)
6464
```
6565

66-
/// info
66+
/// note
6767

6868
`**second_user_data` 意思是:
6969

@@ -97,7 +97,7 @@ my_second_user: User = User(**second_user_data)
9797

9898
### 簡潔 { #short }
9999

100-
FastAPI 為你提供了**預設值**,讓你不必在初期進行繁瑣的配置,一切都可以自動運作。如果你有更具體的需求,則可以進行調整和自定義
100+
FastAPI 為你提供了**預設值**,讓你不必在初期進行繁瑣的配置,一切都可以自動運作。如果你有更具體的需求,則可以進行調整和自定義
101101

102102
但預設情況下,一切都「直接可用」。
103103

0 commit comments

Comments
 (0)