Check zh translation prompt#15717
Conversation
Add a 'Writing style' section to the Chinese LLM translation prompt that addresses common AI-generated translation patterns: - Core rules: one sentence one idea, short sentences, spoken word order - 12 concrete anti-patterns with real examples from current zh docs - Reference style guides (Vue.js zh docs, 阮一峰, Go by Example zh) - Expanded glossary from 4 to 22 terms (dependency injection, middleware, validation, endpoint, decorator, etc.) The current zh translations are grammatically correct but read like AI output — overly formal, verbose, with English-influenced sentence structure. This prompt improvement targets the root cause: the LLM that generates the translations lacks style guidance.
'不是...就是...' means 'either...or...' (disjunction), not the intended contrast. Changed to '不是...只是...' which preserves the original 'not X, but merely Y' meaning while still being more natural than '并非...而只是...'. Addresses Copilot and Codex review feedback.
| - function: 函数 | ||
| - class: 类 | ||
| - type: 类型 | ||
| - annotation: 标注 |
…i-patterns Round 2 improvements based on PR fastapi#15717 analysis (18 violations found): - Fix Tier 1/Tier 2 contradiction: decorator, endpoint moved to Tier 3 - Add core rule 9: 其他 not 其它 - Add core rule 10: no repeated conjunctions 并...并 - Add anchor ID rule (never translate {#...}) - Add code block rule (no translation inside code/comments) - Add more anti-patterns: 另一个→另一套, 模型对象的→模型的 - Add redundant 你的 examples with specific fixes - Extend Tier 2 with tools (VS Code, PyCharm, Celery, etc.) - Clarify Body class vs body concept distinction - Add cross-document consistency rule
| FastAPI 不靠 `str | None` 来判断是否必填。它看默认值 `= None`。 | ||
|
|
||
| 但添加这些类型注解可以让你的编辑器提供更好的支持并检测错误。 | ||
| 但加上类型标注,编辑器能提供更好的支持并发现错误。 |
|
@lennney, do you need more time before others review the PR? |
| 可以同时声明路径参数和请求体。 | ||
|
|
||
| **FastAPI** 能识别与**路径参数**匹配的函数参数应该**从路径中获取**,而声明为 Pydantic 模型的函数参数应该**从请求体中获取**。 | ||
| FastAPI 会识别:和路径参数同名的函数参数来自路径。声明为 Pydantic 模型的函数参数来自请求体。 |
There was a problem hiding this comment.
FastAPI 会识别:和路径参数同名的函数参数来自路径,声明为 Pydantic 模型的函数参数来自请求体。
|
@YuriiMotov Thanks for the heads up! The prompt is now ready for review. I did 3 rounds of iteration based on your PR #15717 translations — analyzed each file against the prompt rules, found gaps, and refined the prompt. Here is what changed: New rules added:
Anti-pattern table expanded from 12 to 20 entries. The prompt went from 115 lines to 221 lines. You can regenerate the translations with the updated prompt — it should fix most of the issues found in the first round (small老弟, 依赖和基座, alt text, body vs 请求体, etc.). Let me know when you have regenerated and I will review again! |
|
Sorry for the back-and-forth — I should have had the prompt finalized before you re-generated the pages the first time. That is on me. The prompt is stable now. No more changes planned unless you find issues with the regenerated output. |
|
@YuriiMotov Got it, that makes sense. Meanwhile, I will regenerate the translations on my end to do a self-review first. WaketZheng also left some helpful suggestions (e.g. "annotation" → "注解" instead of "标注"), so I will incorporate those into the prompt before anything else. Sorry again for the extra rounds. I will make sure everything is solid this time. |
- Add terminology glossary (71+ terms) with NOT alternatives - Add anti-patterns table (16 rules for natural Chinese) - Add good translation examples (7 side-by-side comparisons) - Add post-translation review checklist - Add spacing rules for Chinese-English formatting - Categories: FastAPI core (23), Web (14), Python (24), Dev tools (10) - Keep-English list: frameworks, protocols, abbreviations, class names - Based on analysis of existing translations and PR fastapi#15717

This is a temporary PR just to check how LLM translates to Chinese with changes to LLM prompt from PR #15711.
To generate it I deleted the existing translations of those files (with existing translations LLM preserved existing wording and didn't update much).
Please, check if the changes to the prompt improve the translation