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.
This commit is contained in:
kite 2026-06-17 10:56:35 +08:00
parent c673c9475a
commit 9f06912755
7 changed files with 11 additions and 7 deletions

View file

@ -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コレクターのアドレス |

View file

@ -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 |

View file

@ -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 |

View file

@ -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-коллектора |

View file

@ -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 采集器地址 |

View file

@ -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 {

View file

@ -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 {