Skip to content

Commit 7bd8ffa

Browse files
committed
Add agent guidelines and translation skills
1 parent 4bcd7a6 commit 7bd8ffa

File tree

4 files changed

+1029
-0
lines changed

4 files changed

+1029
-0
lines changed

AGENTS.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Repository Guidelines
2+
3+
## Project Structure & Module Organization
4+
This repo contains Traditional Chinese translations of the Python docs. The
5+
content is organized as `.po` files at the root and within topic folders such
6+
as `library/`, `tutorial/`, `reference/`, `c-api/`, and `using/`. Terminology
7+
references live in `glossary.po`, and overall workflow guidance is in
8+
`README.rst`. There is no application source code; most changes are to `.po`
9+
files and translation metadata.
10+
11+
## Build, Test, and Development Commands
12+
- `make all` builds the full docs with Sphinx and validates rST syntax. It may
13+
clone CPython into a sibling `../cpython` directory if missing.
14+
- `make lint` runs a quick rST syntax check without a full build.
15+
- `make build path/to/file.po` builds a single translation file (faster for
16+
spot-checking).
17+
- `pre-commit install` enables PO-format checks at commit time (recommended).
18+
19+
## Coding Style & Naming Conventions
20+
- Only edit `msgstr`; do not change `msgid`.
21+
- Keep PO lines <= 79 chars (Poedit or `powrap` can wrap).
22+
- Preserve rST roles, directives, and link targets exactly.
23+
- Follow the project glossary and translation rules (see `glossary.po` and the
24+
project wiki).
25+
- Branch names typically mirror the file path, e.g., `library/math`.
26+
27+
## Testing Guidelines
28+
There is no unit test suite. Validate changes by running `make lint` or
29+
`make all` and ensuring there are no warnings. If you build a specific file,
30+
confirm the generated HTML in `../cpython/Doc/build/html`.
31+
32+
## Commit & Pull Request Guidelines
33+
- Open an issue to claim a translation task before starting.
34+
- Base your branch on `upstream/3.13`.
35+
- Use clear commit messages; the repo example is
36+
`Working on path/to/file.po`.
37+
- In PRs, summarize the files translated, link the issue, and note any build
38+
checks you ran (e.g., `make lint`).
39+
40+
## Agent-Specific Instructions
41+
- Use the local skills when translating: `doc-translate/` for general rules
42+
and `rst-translate/` when strings include rST syntax.

doc-translate/SKILL.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
name: doc-translate
3+
description: Use when translating English content to Traditional Chinese in this repo (python-docs-zh-tw), especially for PO/reStructuredText content.
4+
metadata:
5+
short-description: Translate EN to zh-tw for docs
6+
---
7+
8+
# doc-translate
9+
10+
## Scope
11+
- Translate English documentation to Traditional Chinese for this repo.
12+
- Preserve reStructuredText/PO formatting and links exactly.
13+
14+
## Workflow
15+
1) Read the full source section before translating to preserve meaning and context.
16+
2) Translate with the rules below; keep PO syntax intact.
17+
3) Check line length (PO), spacing, and punctuation rules.
18+
4) Confirm glossary terms and high-frequency words are handled as specified.
19+
20+
## Translation Rules
21+
- Chinese sentences use fullwidth punctuation; English sentences keep halfwidth punctuation.
22+
- Example: 「」()、,。
23+
- Example: Python is supported by Python Software Foundation (PSF).
24+
- Mixed Chinese/English should include spaces between Chinese and English words; no extra space between English words and symbols.
25+
- Example: 使用 CPU 運算、使用「CPU」運算
26+
- Proper nouns should follow the glossary translation when available.
27+
- Proper nouns may remain untranslated (e.g., CPU, Unicode).
28+
- For uncommon or uncertain terms, add a parenthetical note or keep the original term; annotate only on first occurrence per page.
29+
- Example: 正規表示式 (regular expression)
30+
- Example: Network News Transfer Protocol、Portable Network Graphics(可攜式網路圖形)
31+
- PO lines should be <= 79 characters (Poedit handles this; `powrap` is optional).
32+
- High-frequency terms should stay in English (even if glossary includes a translation).
33+
- Example: int, float, str, bytes, list, tuple, dict, set, iterator, generator, iterable, pickle
34+
35+
## Parentheses
36+
- If parentheses contain Chinese, use fullwidth parentheses.
37+
- If parentheses contain only English, use halfwidth parentheses and keep English spacing.
38+
- Example: list(串列)是 Python 中很常見的資料型別。
39+
- Example: 在本情況使用 zip(*[iter(x)]*n) 是很常見的情況(Python 慣例)。
40+
- Example: 在超文件標示語言 (HTML) 中應注意跳脫符號。
41+
42+
## Related Skills
43+
- Use `rst-translate` when the string includes reStructuredText syntax.
44+
45+
## References
46+
- Local glossary: `glossary.po`
47+
- Terminology excerpt: `doc-translate/references/terminology.md`
48+
- Term list (wiki): https://github.com/python/python-docs-zh-tw/wiki/%E8%A1%93%E8%AA%9E%E5%88%97%E8%A1%A8
49+
- Official glossary: https://docs.python.org/zh-tw/3/glossary.html

0 commit comments

Comments
 (0)