fix review-comments.dj quoted text, add Google Docs workflow to skill

- review-comments.dj: use exact, case-matched, unique quoted snippets
  (10+ words each) instead of short unsearchable fragments
- translation-review-comment skill: add Mode B workflow for Google Docs
  targets — read doc, output review-comments.dj, user inserts manually
- document the Drive API anchor limitation in skill pitfalls
This commit is contained in:
iacore
2026-06-21 10:25:38 +08:00
parent 71eccff31c
commit 2294e2664d
2 changed files with 91 additions and 32 deletions
@@ -405,6 +405,10 @@ This matters for three reasons:
## Workflow ## Workflow
Two output modes depending on target format:
### Mode A: .dj file review (use `patch`)
``` ```
1. Read source.dj + target.dj (full files) 1. Read source.dj + target.dj (full files)
2. Apply R1R13 in order, scanning the English line by line 2. Apply R1R13 in order, scanning the English line by line
@@ -413,6 +417,62 @@ This matters for three reasons:
5. Final pass: read the full English aloud — does it flow? 5. Final pass: read the full English aloud — does it flow?
``` ```
### Mode B: Google Docs review (output to review-comments.dj)
Use when the translation manuscript is a Google Doc and you must add comments
without editing the original text. The agent reads the document, produces a
comment file, and the user manually inserts comments into the Google Doc.
**Why manual insertion is required**: The Google Drive API `comments.create`
with an `anchor` field is silently ignored by Google Docs editor apps. The
kix anchor format used by the Google Docs UI is an undocumented internal
format that has never been reverse-engineered. Line-based anchors
(`{"region": {"kind": "drive#commentRegion", "line": N, "rev": "head"}}`)
also do not display as anchored in the Google Docs UI. This is a known
limitation since 2016 with no resolution. The only reliable way to add
anchored comments is through the browser UI (select text → Insert → Comment).
**Workflow**:
```
1. Load google-workspace skill (ensure OAuth is set up)
2. Read the Google Doc body via Docs API: documents.get
3. Read existing comments via Drive API: comments.list (paginate fully)
4. Identify the translator from the document title (e.g., "maple 初翻")
5. Review per R1R14, scanning the English paragraphs
6. For each issue, extract the EXACT quoted text from the document:
- Use the full document body to find the precise, case-exact string
- Each quoted snippet must be UNIQUE — long enough to find with Ctrl+F
(at minimum 10+ words or a complete short sentence)
- Test: can you find exactly one match when searching the document?
7. Write review-comments.dj to the article directory:
$MPI_PROJECT_ROOT/translate-files/<article>/review-comments.dj
8. Format each entry:
Quoted text: `<exact text from document>`
<comment content>
9. Tell the user: "Comments written to <path>. For each, select the quoted
text in the Google Doc → Insert → Comment → paste the content."
```
**Quoted text rules** (critical — the user must be able to find the text):
- Must match the document text EXACTLY: same case, same punctuation,
same whitespace (including non-breaking spaces like `\xa0`)
- Must be UNIQUE within the document — verify by searching the full body
- Must be long enough to disambiguate: prefer a full short sentence or a
10+ word phrase over single words like "Consequently"
- Capitalize as it appears in the source. If the source has
"Consequently, while countless...", quote that, not "consequently"
**Example output format**:
```
## 10. Conversational Tone (R6)
Quoted text: `even discarded. Consequently, while countless companies emerged, they collapsed just as quickly.`
整体语气适合对话场景。个别词可以更口语化:'Consequently' → 'So'...
```
## Pitfalls ## Pitfalls
- Don't apply this skill before `translation-review` — terminology must be correct first. - Don't apply this skill before `translation-review` — terminology must be correct first.
@@ -423,3 +483,11 @@ This matters for three reasons:
- The "we" subject is generally preferred but not absolute. If a passage describes - The "we" subject is generally preferred but not absolute. If a passage describes
a general principle without a specific agent, passive/impersonal may be correct. a general principle without a specific agent, passive/impersonal may be correct.
- Positive feedback (R14) is not optional fluff — it guides what to preserve. - Positive feedback (R14) is not optional fluff — it guides what to preserve.
- **Google Docs anchor limitation**: The Drive API cannot create anchored comments
on Google Docs. Use Mode B (output to review-comments.dj) for Google Doc targets.
The user manually inserts comments in the browser UI. See the journey log at
`docs/google-docs-comment-journey.dj` for full details.
- **Quoted text must be exact and unique**: when writing review-comments.dj, each
quoted snippet must match the document text case-exactly and be long enough to
find unambiguously with Ctrl+F. Short words like "consequently" are unacceptable
— quote the full sentence or a 10+ word phrase.
@@ -2,52 +2,48 @@
# Translator: maple # Translator: maple
# Document: https://docs.google.com/document/d/1NmJKNavB4IBg56ZRBdS5ux9ObRVlHPnSxVmjjXCyITs/edit # Document: https://docs.google.com/document/d/1NmJKNavB4IBg56ZRBdS5ux9ObRVlHPnSxVmjjXCyITs/edit
# #
# Google Drive API cannot create anchored comments on Google Docs. # NOTE: Google Drive API cannot create anchored comments on Google Docs.
# The `anchor` field is silently ignored by Google Docs editor apps # The anchor field is silently ignored by Google Docs editor apps.
# (confirmed in official docs and by community since 2016). # These comments must be added manually in the Google Docs UI:
# These comments must be added manually by opening the document and # Select the quoted text → Insert → Comment → paste the comment content.
# inserting each comment at the quoted text position.
--- ---
## 1. Overall Praise (R14: 随喜) ## 1. Overall Praise (R14: 随喜)
Quoted text: `佛法与企业管理` Quoted text: `佛法与企业管理`
(anchored to the document title)
随喜 maple 师兄翻译整体很好,准确流畅,尤其是把中文讲法风格自然地转成了英文对话语气。像 'Dao (the Way)' 这样的文化加注处理得很恰当。以下是一些优化建议,主要集中在语言简洁性和口语化方面。 随喜 maple 师兄翻译整体很好,准确流畅,尤其是把中文讲法风格自然地转成了英文对话语气。像 'Dao (the Way)' 这样的文化加注处理得很恰当。以下是一些优化建议,主要集中在语言简洁性和口语化方面。
--- ---
## 2. Terminology: Chan (R9) ## 2. Terminology: Chan not Zen (R9)
Quoted text: `Create a Chan(Zen) Atmosphere` Quoted text: `Create a Chan(Zen) Atmosphere; Optimize Your Environment`
术语统一:禅→Chan(不用Zen),禅宗→Chan school。标题和正文的多处 'Chan(Zen)' 和 'Zen-like' 建议统一为 'Chan' 和 'Chan-like'。参考:坐看云起等已出版的书都统一用 Chan。 术语统一:禅→Chan(不用Zen),禅宗→Chan school。标题和正文的 'Chan(Zen)' 建议统一为 'Chan'。后面出现的 'Zen-like atmosphere' 也改为 'Chan-like atmosphere'。参考:坐看云起等已出版的书都统一用 Chan。
Also applies to: `Zen-like atmosphere` (later in document)
--- ---
## 3. Stray Digit ## 3. Stray Digit
Quoted text: `1This held back` Quoted text: `seen as valuable. 1This held back the development of science`
有个小笔误:'1This held back' → 删去数字 '1',改为 'This held back'。 有个小笔误:'1This' → 删去数字 '1',改为 'This held back...'。
--- ---
## 4. Double Text Artifact ## 4. Double Text Artifact
Quoted text: `In Buddhism, In Buddhism, the monastic community` Quoted text: `In Buddhism, In Buddhism, the monastic community is built`
有处文本重复:删去一个 'In Buddhism,'。 有处文本重复:删去一个 'In Buddhism,'(注意两个之间有特殊空格)
--- ---
## 5. Typo: kingdom → kingdoms ## 5. Typo: kingdom → kingdoms
Quoted text: `kingdom may be won` Quoted text: `'kingdom may be won, but one's nature is hard to change.'`
笔误:'kingdom may be won' → 'kingdoms may be won' 或 'a kingdom may be won'。漏了复数或冠词。 笔误:'kingdom may be won' → 'kingdoms may be won' 或 'a kingdom may be won'。漏了复数或冠词。
@@ -55,53 +51,48 @@ Quoted text: `kingdom may be won`
## 6. Simplify Vocabulary (R3) ## 6. Simplify Vocabulary (R3)
Quoted text: `squandering` Quoted text: `we are just squandering it, gaining only momentary pleasure`
'squandering' 有些书面化,口语场景可用 'wasting' 或直接 'spending'。 'squandering' 有些书面化,口语场景可用 'wasting' 或直接 'spending'。
同类:'insignificant' → 'tiny'/'small''perpetuating' → 'creating more'。
Also: 'insignificant' → 'tiny'/'small'; 'perpetuating' → 'creating more'。
--- ---
## 7. Trim -ly Adverbs (R7) ## 7. Trim -ly Adverbs (R7)
Quoted text: `completely new` Quoted text: `find the look and feel completely new. These were just old`
英文现代风格可减少 -ly 副词。比如: 英文现代风格可减少 -ly 副词。'completely new' → 'fresh'。同类:'faithfully recorded' → 'recorded''truly admirable' → 'admirable'。不是每个都要删,能省则省。
- 'completely new' → 'fresh'
- 'faithfully recorded' → 'recorded'
- 'truly admirable' → 'admirable'
能省则省。
--- ---
## 8. Noun → Verb (R2) ## 8. Noun → Verb (R2)
Quoted text: `the power of environment to attract, gain recognition, and create 'stickiness'` Quoted text: `This is the power of environment to attract, gain recognition, and create 'stickiness'`
有几处名词偏多,可以试着转成动词。比如: 名词偏多,可以转成动词。比如:
'an environment that attracts, earns recognition, and keeps people coming back' 'an environment that attracts, earns recognition, and keeps people coming back'
--- ---
## 9. Split Long Sentences (R4) ## 9. Split Long Sentences (R4/R12)
Quoted text: `How do we make the entrepreneur program better? How can we help everyone benefit from the teachings and bring Buddhist wisdom into their management? We've thought about these questions before, but not` Quoted text: `How do we make the entrepreneur program better? How can we help everyone benefit from the teachings and bring Buddhist wisdom into their management? We've thought about these questions before, but not`
有些句子比较长,可以考虑拆分为 2 句。TOC 后面第一段 CN 含两个问句,EN 合并成一个句子偏长,读起来有点赶。 TOC 后面第一段 CN 含两个问句,EN 合并成一个长,读起来有点赶。可以考虑拆分,让读者有喘息的空间。
--- ---
## 10. Conversational Tone (R6) ## 10. Conversational Tone (R6)
Quoted text: `consequently` Quoted text: `even discarded. Consequently, while countless companies emerged, they collapsed just as quickly.`
整体语气适合对话场景。个别词可以更口语化:'consequently' → 'so''therefore' → 'so'。这个讲座是对企业家班的开示,口语感越强越好。 整体语气适合对话场景。个别词可以更口语化:'Consequently' → 'So' 或 'As a result'。同样 'Therefore' → 'So'。这个讲座是对企业家班的开示,口语感越强越好。
--- ---
## 11. Keep Active Voice (R1) ## 11. Keep Active Voice (R1)
Quoted text: `one's nature is hard to change` Quoted text: `As the saying goes, 'kingdom may be won, but one's nature is hard to change.'`
整体上已经大量用了 'we' 做主语,读者参与感很强。'one's nature' 在谚语语境下没问题。继续保持 'we' 为主就好。 整体上已经大量用了 'we' 做主语,读者参与感很强。'one's nature' 在谚语语境下没问题。继续保持 'we' 为主就好。