From 9f06912755dc290a032b4089a04043c075ab5231 Mon Sep 17 00:00:00 2001 From: kite Date: Wed, 17 Jun 2026 10:56:35 +0800 Subject: [PATCH] fix: apply language directive even when config file is missing ApplyLanguage was only called when the config file existed, so without ~/.opencodereview/config.json no language instruction was injected and the LLM picked its own language. Now ApplyLanguage is called unconditionally, defaulting to English via resolveLang(""). Update all README translations to reflect the corrected default (English) and clarify that any language name is accepted. --- README.ja-JP.md | 2 +- README.ko-KR.md | 2 +- README.md | 2 +- README.ru-RU.md | 2 +- README.zh-CN.md | 2 +- cmd/opencodereview/llm_cmd.go | 4 +++- cmd/opencodereview/review_cmd.go | 4 +++- 7 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.ja-JP.md b/README.ja-JP.md index 722b9ad..6ee71d4 100644 --- a/README.ja-JP.md +++ b/README.ja-JP.md @@ -462,7 +462,7 @@ OCRは4層の優先度チェーンを使ってレビュールールを解決し | `llm.auth_header` | string | Anthropicのみ:`x-api-key` \| `authorization` | | `llm.model` | string | `claude-opus-4-6` | | `llm.use_anthropic` | boolean | `true` \| `false` | -| `language` | string | `English` \| `Chinese`(デフォルト:Chinese) | +| `language` | string | 任意の言語名、例:`English`、`Chinese`(デフォルト:`English`) | | `telemetry.enabled` | boolean | `true` \| `false` | | `telemetry.exporter` | string | `console` \| `otlp` | | `telemetry.otlp_endpoint` | string | OTLPコレクターのアドレス | diff --git a/README.ko-KR.md b/README.ko-KR.md index 01ddc65..8e0f76d 100644 --- a/README.ko-KR.md +++ b/README.ko-KR.md @@ -420,7 +420,7 @@ Config file: `~/.opencodereview/config.json` | `llm.auth_header` | string | Anthropic only: `x-api-key` \| `authorization` | | `llm.model` | string | `claude-opus-4-6` | | `llm.use_anthropic` | boolean | `true` \| `false` | -| `language` | string | `English` \| `Chinese` (default: Chinese) | +| `language` | string | 임의의 언어 이름, 예: `English`, `Chinese` (기본값: `English`) | | `telemetry.enabled` | boolean | `true` \| `false` | | `telemetry.exporter` | string | `console` \| `otlp` | | `telemetry.otlp_endpoint` | string | OTLP collector address | diff --git a/README.md b/README.md index 3e28c8c..5a614b2 100644 --- a/README.md +++ b/README.md @@ -464,7 +464,7 @@ Config file: `~/.opencodereview/config.json` | `llm.auth_header` | string | Anthropic only: `x-api-key` \| `authorization` | | `llm.model` | string | `claude-opus-4-6` | | `llm.use_anthropic` | boolean | `true` \| `false` | -| `language` | string | `English` \| `Chinese` (default: Chinese) | +| `language` | string | Any language name, e.g. `English`, `Chinese` (default: `English`) | | `telemetry.enabled` | boolean | `true` \| `false` | | `telemetry.exporter` | string | `console` \| `otlp` | | `telemetry.otlp_endpoint` | string | OTLP collector address | diff --git a/README.ru-RU.md b/README.ru-RU.md index 10fbf3c..1265618 100644 --- a/README.ru-RU.md +++ b/README.ru-RU.md @@ -464,7 +464,7 @@ OCR разрешает правила ревью по цепочке приор | `llm.auth_header` | string | Только для Anthropic: `x-api-key` \| `authorization` | | `llm.model` | string | `claude-opus-4-6` | | `llm.use_anthropic` | boolean | `true` \| `false` | -| `language` | string | `English` \| `Chinese` (по умолчанию: Chinese) | +| `language` | string | Любое название языка, например `English`, `Chinese` (по умолчанию: `English`) | | `telemetry.enabled` | boolean | `true` \| `false` | | `telemetry.exporter` | string | `console` \| `otlp` | | `telemetry.otlp_endpoint` | string | Адрес OTLP-коллектора | diff --git a/README.zh-CN.md b/README.zh-CN.md index 8dd434f..9025e95 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -452,7 +452,7 @@ OCR 通过四层优先级链解析评审规则。每层采用首次匹配原则 | `llm.auth_header` | string | 仅 Anthropic:`x-api-key` \| `authorization` | | `llm.model` | string | `claude-opus-4-6` | | `llm.use_anthropic` | boolean | `true` \| `false` | -| `language` | string | `English` \| `Chinese`(默认:Chinese) | +| `language` | string | 任意语言名称,例如 `English`、`Chinese`(默认:`English`) | | `telemetry.enabled` | boolean | `true` \| `false` | | `telemetry.exporter` | string | `console` \| `otlp` | | `telemetry.otlp_endpoint` | string | OTLP 采集器地址 | diff --git a/cmd/opencodereview/llm_cmd.go b/cmd/opencodereview/llm_cmd.go index 1cb19bf..84fdf83 100644 --- a/cmd/opencodereview/llm_cmd.go +++ b/cmd/opencodereview/llm_cmd.go @@ -48,9 +48,11 @@ func runLLMTest() error { if err != nil { return fmt.Errorf("load test task config: %w", err) } + var lang string if appCfg != nil { - task.ApplyLanguage(appCfg.Language) + lang = appCfg.Language } + task.ApplyLanguage(lang) timeout := 30 * time.Second if task.Timeout > 0 { diff --git a/cmd/opencodereview/review_cmd.go b/cmd/opencodereview/review_cmd.go index 970abbf..be68b32 100644 --- a/cmd/opencodereview/review_cmd.go +++ b/cmd/opencodereview/review_cmd.go @@ -84,9 +84,11 @@ func runReview(args []string) error { if err != nil { return fmt.Errorf("load app config: %w", err) } + var lang string if appCfg != nil { - tpl.ApplyLanguage(appCfg.Language) + lang = appCfg.Language } + tpl.ApplyLanguage(lang) ep, err := llm.ResolveEndpointWithModelOverride(cfgPath, opts.model) if err != nil {