惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

MyScale Blog
MyScale Blog
人人都是产品经理
人人都是产品经理
云风的 BLOG
云风的 BLOG
小众软件
小众软件
F
Fortinet All Blogs
爱范儿
爱范儿
WordPress大学
WordPress大学
N
Netflix TechBlog - Medium
Recent Announcements
Recent Announcements
Google DeepMind News
Google DeepMind News
C
Check Point Blog
博客园 - 聂微东
D
Docker
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
aimingoo的专栏
aimingoo的专栏
Vercel News
Vercel News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
A
About on SuperTechFans
博客园 - 【当耐特】
Microsoft Azure Blog
Microsoft Azure Blog
B
Blog
宝玉的分享
宝玉的分享
Jina AI
Jina AI
H
Hackread – Cybersecurity News, Data Breaches, AI and More

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(docs): allow partial i18n doc batches · openclaw/open...
vincentkoc · 2026-04-30 · via Recent Commits to openclaw:main

@@ -27,28 +27,30 @@ type docResult struct {

2727

}

28282929

type runConfig struct {

30-

targetLang string

31-

sourceLang string

32-

docsRoot string

33-

tmPath string

34-

mode string

35-

thinking string

36-

overwrite bool

37-

maxFiles int

38-

parallel int

30+

targetLang string

31+

sourceLang string

32+

docsRoot string

33+

tmPath string

34+

mode string

35+

thinking string

36+

overwrite bool

37+

allowPartial bool

38+

maxFiles int

39+

parallel int

3940

}

40414142

func main() {

4243

var (

43-

targetLang = flag.String("lang", "zh-CN", "target language (e.g., zh-CN)")

44-

sourceLang = flag.String("src", "en", "source language")

45-

docsRoot = flag.String("docs", "docs", "docs root")

46-

tmPath = flag.String("tm", "", "translation memory path")

47-

mode = flag.String("mode", "segment", "translation mode (segment|doc)")

48-

thinking = flag.String("thinking", "high", "thinking level (low|medium|high|xhigh)")

49-

overwrite = flag.Bool("overwrite", false, "overwrite existing translations")

50-

maxFiles = flag.Int("max", 0, "max files to process (0 = all)")

51-

parallel = flag.Int("parallel", 1, "parallel workers for doc mode")

44+

targetLang = flag.String("lang", "zh-CN", "target language (e.g., zh-CN)")

45+

sourceLang = flag.String("src", "en", "source language")

46+

docsRoot = flag.String("docs", "docs", "docs root")

47+

tmPath = flag.String("tm", "", "translation memory path")

48+

mode = flag.String("mode", "segment", "translation mode (segment|doc)")

49+

thinking = flag.String("thinking", "high", "thinking level (low|medium|high|xhigh)")

50+

overwrite = flag.Bool("overwrite", false, "overwrite existing translations")

51+

allowPartial = flag.Bool("allow-partial", false, "write successful doc-mode outputs even when another file fails")

52+

maxFiles = flag.Int("max", 0, "max files to process (0 = all)")

53+

parallel = flag.Int("parallel", 1, "parallel workers for doc mode")

5254

)

5355

flag.Parse()

5456

files := flag.Args()

@@ -57,15 +59,16 @@ func main() {

5759

}

58605961

if err := runDocsI18N(context.Background(), runConfig{

60-

targetLang: *targetLang,

61-

sourceLang: *sourceLang,

62-

docsRoot: *docsRoot,

63-

tmPath: *tmPath,

64-

mode: *mode,

65-

thinking: *thinking,

66-

overwrite: *overwrite,

67-

maxFiles: *maxFiles,

68-

parallel: *parallel,

62+

targetLang: *targetLang,

63+

sourceLang: *sourceLang,

64+

docsRoot: *docsRoot,

65+

tmPath: *tmPath,

66+

mode: *mode,

67+

thinking: *thinking,

68+

overwrite: *overwrite,

69+

allowPartial: *allowPartial,

70+

maxFiles: *maxFiles,

71+

parallel: *parallel,

6972

}, files, func(srcLang, tgtLang string, glossary []GlossaryEntry, thinking string) (docsTranslator, error) {

7073

return NewCodexTranslator(srcLang, tgtLang, glossary, thinking)

7174

}); err != nil {

@@ -127,7 +130,7 @@ func runDocsI18N(ctx context.Context, cfg runConfig, files []string, newTranslat

127130

processed := 0

128131

skipped := 0

129132

localizedFiles := []string{}

130-

var runErr error

133+

var translationErr error

131134132135

log.Printf("docs-i18n: mode=%s total=%d pending=%d pre_skipped=%d overwrite=%t thinking=%s parallel=%d", cfg.mode, totalFiles, len(ordered), preSkipped, cfg.overwrite, cfg.thinking, parallel)

133136

switch cfg.mode {

@@ -138,7 +141,7 @@ func runDocsI18N(ctx context.Context, cfg runConfig, files []string, newTranslat

138141

skipped += skip

139142

localizedFiles = append(localizedFiles, outputs...)

140143

if err != nil {

141-

runErr = err

144+

translationErr = err

142145

}

143146

} else {

144147

translator, err := newTranslator(cfg.sourceLang, cfg.targetLang, glossary, cfg.thinking)

@@ -151,7 +154,7 @@ func runDocsI18N(ctx context.Context, cfg runConfig, files []string, newTranslat

151154

skipped += skip

152155

localizedFiles = append(localizedFiles, outputs...)

153156

if err != nil {

154-

runErr = err

157+

translationErr = err

155158

}

156159

}

157160

case "segment":

@@ -167,21 +170,25 @@ func runDocsI18N(ctx context.Context, cfg runConfig, files []string, newTranslat

167170

processed += proc

168171

localizedFiles = append(localizedFiles, outputs...)

169172

if err != nil {

170-

runErr = err

173+

translationErr = err

171174

}

172175

default:

173176

return fmt.Errorf("unknown mode: %s", cfg.mode)

174177

}

175178176-

if err := tm.Save(); err != nil && runErr == nil {

177-

runErr = err

179+

if err := tm.Save(); err != nil {

180+

return err

178181

}

179-

if err := postprocessLocalizedDocs(resolvedDocsRoot, cfg.targetLang, localizedFiles); err != nil && runErr == nil {

180-

runErr = err

182+

if err := postprocessLocalizedDocs(resolvedDocsRoot, cfg.targetLang, localizedFiles); err != nil {

183+

return err

181184

}

182185

elapsed := time.Since(start).Round(time.Millisecond)

183186

log.Printf("docs-i18n: completed processed=%d skipped=%d elapsed=%s", processed, skipped, elapsed)

184-

return runErr

187+

if translationErr != nil && cfg.allowPartial && cfg.mode == "doc" && processed > 0 {

188+

log.Printf("docs-i18n: allowing partial doc output after translation error: %v", translationErr)

189+

return nil

190+

}

191+

return translationErr

185192

}

186193187194

func runDocSequential(ctx context.Context, ordered []string, translator docsTranslator, docsRoot, srcLang, tgtLang string, overwrite bool) (int, int, []string, error) {