返回 DeepSeek-Reasonix
i18n.go
根目录 / internal / i18n / i18n.go
1 // Package i18n holds the CLI's translatable strings and a small detection
2 // helper. Architecture: a single Messages struct of exported string fields
3 // (plain text or fmt format strings, suffix *Fmt flags the latter). Each
4 // language declares one Messages value in its own file. Call sites read
5 // i18n.M.SomeField; for parameterised messages they pass it to fmt.Sprintf.
6 //
7 // Adding a field requires updating every messages_*.go file — drift is caught
8 // at test time by TestCatalogsComplete via reflection, so a missing translation
9 // fails CI instead of surfacing as a blank line at runtime.
10 //
11 // Scope (v1): CLI surface only — welcome, init wizard, chat REPL banner, usage,
12 // user-facing CLI errors. System prompts, internal error wrappers, and agent
13 // runtime telemetry stay English so model behaviour and developer logs are
14 // language-stable.
15 package i18n
16
17 import (
18 "os"
19 "strings"
20 )
21
22 // Messages is the catalogue of translatable CLI strings. Plain fields are
23 // printed verbatim; *Fmt fields are fmt format strings the caller passes to
24 // fmt.Sprintf. Catalogue values do not include trailing newlines — call sites
25 // add framing whitespace, so the same field works wherever it appears.
26 type Messages struct {
27 // welcome / status screen
28 WelcomeTitleFmt string // first-run box title — %s = product name (styled)
29 NoConfigYet string // first-run cue under the welcome box
30
31 // `reasonix init` — points to the in-session /init skill + setup
32 InitHint string
33
34 // chat REPL
35 ChatTip string // tip line under the chat banner
36 TurnCancelled string // shown when Ctrl-C aborts the in-flight turn but the chat keeps running
37 InterruptedRecovery string // replay notice for a durable interrupted turn
38 FinalReadinessRecovery string // replay hint for a durable final-readiness pause
39 ReadinessContinuing string // host is automatically finishing known readiness gaps
40 RecoveryPaused string // controlled Auto retry pause; user can continue in the next message
41 CompletionUncertain string // completion validator could not confirm the result; work is kept
42 ReasoningReplayRepair string // provider rejected replayed thinking blocks; history repaired and retried once
43 ImageRequestRecovery string // current image cannot be included; request a fresh attachment
44 ImageReplayUnavailable string // earlier/tool image processing failed; text remains usable
45 ExtensionRequestRecovery string // extension produced an invalid model request
46 ExtensionBlockRecovery string // actionable hint following an explicit extension block
47 ContextLimitRecovery string // automatic context recovery exhausted
48 SessionSaveRecovery string // durability failure; preserve the live conversation
49 // Host guard/recovery notices (event.Notice texts the fronts render verbatim).
50 EmptyFinal string // empty_final: no visible answer; retrying
51 NoDeliverableOutput string // recovery exhausted without an answer
52 ExecutorHandoff string // executor_handoff: answered without using tools
53 ToolBudget string // tool_budget: tool-call round limit reached
54 TaskBudget string // tool_budget variant: task spend budget reached
55 LoopGuard string // loop_guard: no-progress tool loop
56 ProgressGuard string // progress_guard: repeated work without new evidence
57 OperationNeedsUser string // operation_needs_user: host stopped retrying one operation
58 SoftBudgetConverge string // loop_guard: converging a long read-only investigation
59 EvidenceNudge string // evidence_nudge: unverified mutations
60 ReasoningGovernor string // reasoning_governor engaged
61 UnappliedSteerFmt string // unapplied_steer — %s = the dropped guidance
62 DeprecatedContextRetention string // agent.keep / agent.recent_keep deprecation warning
63 FinishReasonLength string
64 FinishReasonContentFilter string
65 FinishReasonRepetition string
66 StreamInterruptedIdleTimeout string
67 StreamInterruptedPrematureEOF string
68 StreamInterruptedConnectionReset string
69 ToolOutputTruncatedFmt string // %d = elided bytes, %d = original bytes
70 IncompleteReadFinishBlocked string
71 ReadContinuationRequired string
72 IncompleteReadDetected string
73 ReadStrategyRequired string
74 ReadStrategyProgress string
75 ReadStrategyResolved string
76 ReadLocalSafetyPaged string
77 ReadCompleted string
78 ReadRestrictedStrategyFmt string // %d = estimated tokens, %d = token budget
79 ContextRecoveryAdjustBudget string
80 PromptTruncatedByServerNotice string
81 ContextRecoveryCompacted string
82 PlannerFallback string
83 PlannerSafetyFallback string
84 PlannerPlanAwaitingApproval string
85 PlannerPlanNotApproved string
86 PlannerPlanOnly string
87 CapabilityProxyFmt string // %s = display name, %s = resolved target
88 ReceiptVerified string // end-of-turn receipt, nothing unproven
89 ReceiptGapsHeader string // end-of-turn receipt, header above the unproven list
90 ReceiptRisksHeader string // end-of-turn receipt, header above declared risks
91 ReceiptMore string // end-of-turn receipt, "and N more" tail
92 // ReceiptGapKinds maps a completion gap kind to its short human phrase.
93 ReceiptGapKinds map[string]string
94 NoSessionToResume string // shown when --continue / --resume finds nothing
95 ResumeRequiresTTY string // shown when --resume runs piped instead of on a terminal
96 AmbiguousResumeHint string // under the candidates of a --resume query that matched several sessions
97 PickSessionLabel string // header on the --resume picker
98
99 // in-chat /resume command
100 ResumeBusy string // shown when /resume is used mid-turn
101 ResumeBadIndexFmt string // shown when /resume gets an out-of-range index (one %d)
102 ResumeAlreadyActive string // shown when /resume targets the current session
103 ResumedTitle string // banner title after a /resume switch
104
105 RenameUsage string // /rename with no args
106 RenameNoSession string // /rename with no active session
107 RenameDoneFmt string // /rename succeeded (one %s = new title)
108 ResumePickTitle string // header in the interactive resume picker
109 ResumePickHint string // keyboard hint in the interactive resume picker
110 ResumeRecoveryBadgeFmt string // recovery-copy badge — %s = short parent session id
111
112 // chat TUI status line / approval banner.
113 ChatThinking string // live reasoning marker label, e.g. "thinking…"
114 ChatThoughtForFmt string // collapsed reasoning summary, "%d" = elapsed s
115 ChatStatusThinkingFmt string // "%s thinking… (%ds · <cancel hint>)" — %s = spinner, %d = elapsed s
116 TurnPhaseWorking string // host turn_phase label: working
117 ReadStatusReadingFmt string // read status: reading a file
118 ReadStatusCoveredFmt string // read status: covered lines
119 ReadStatusDoneFmt string // read status: finished a window
120 ReadStatusPausedFmt string // read status: paused, needs attention
121 ReadStatusRecovery string // next step after a bounded read stops
122 TurnPhaseChecking string // host turn_phase label: checking
123 TurnPhaseVerifying string // host turn_phase label: verifying
124 TurnPhaseReviewing string // host turn_phase label: reviewing
125 CompletionSummaryBlocked string // concise non-verbose alert for a blocked turn
126 CompletionSummaryNeedsAttention string // concise non-verbose alert for verification/review gaps
127 ChatToolWorkingFmt string // "%s working · %ds" under a running tool — %s = spinner, %d = elapsed s
128 ChatSubagentPhaseQueued string // sub-agent progress phase label ("queued")
129 ChatSubagentPhaseRunning string // ("running")
130 ChatSubagentPhaseReasoning string // ("reasoning")
131 ChatSubagentPhaseResponding string // ("responding")
132 ChatSubagentPhaseTool string // ("using tools")
133 ChatSubagentPhaseRetrying string // ("retrying")
134 ChatSubagentPhaseCompleted string // ("completed")
135 ChatSubagentPhaseFailed string // ("failed")
136 ChatSubagentPhaseCancelled string // ("cancelled")
137 ChatSubagentProgressFmt string // live progress line — %s = phase label, %d = elapsed s, %d = idle s ("%s · %ds · %ds ago")
138 ChatSubagentProgressDoneFmt string // terminal summary — %s = phase label, %d = duration s ("%s · %ds")
139 ChatSubagentPreviewLabel string // verbose preview marker ("▎")
140 ChatStatusRetryingFmt string // "%s retrying (%d/%d)…" — %s = spinner, %d/%d = attempt/max
141 ChatStatusCancellingFmt string // "%s stopping… (%ds · Ctrl+C exits)" — %s = spinner, %d = elapsed s
142 ChatStatusIdle string // shortcuts hint when idle
143 ChatStatusCycleHint string // plan-toggle shortcut hint shown when no modal prompt owns the status row
144 ChatStatusCycleHintCompact string // readable shortcut hint used by the persistent footer
145 ChatTurnReceiptLabel string // compact per-turn usage receipt attached to the completed assistant response
146 RateBandPeak string
147 RateBandOffPeak string
148 RateBandMixed string
149 ChatStatusModelLabel string
150 ChatStatusEffortLabel string
151 ChatStatusPresetLabel string
152 ChatStatusCacheLabel string
153 ChatStatusContextLabel string
154 ChatStatusCompactLabel string
155 ChatStatusJobsLabel string
156 ChatStatusBalanceLabel string
157 ChatStatusCostLabel string
158 ChatStatusCacheNowFmt string // cache status tag, "%s" = latest-turn hit rate with percent sign
159 ChatStatusCacheAvgFmt string // cache status tag, "%s" = session-average hit rate with percent sign
160 ChatStatusPlanApproval string // shortcuts hint while a plan is pending
161 PlanApprovalPrompt string // one-line "plan above is ready" banner shown above the input
162 PlanApprovalChoices string // start / revise / exit-without-executing choice list
163 ChatStatusToolApproval string // shortcuts hint while a tool call awaits approval
164 ToolApprovalPromptFmt string // approval banner — tool, subject suffix, source/intent detail, choices
165 ToolApprovalChoices string // standard approval choice list
166 BashPrefixChoices string // approval choice list when a bash prefix can be granted
167 PlanModeReadOnlyCommandChoices string // approval choice list for plan-mode read-only command trust
168 FreshHumanApprovalChoices string // approval choice list for prompts that cannot be remembered
169 RecoveryApprovalChoices string // one-shot Auto Guard decision list
170 RecoveryPlanChangeChoices string // material Auto plan transition decision list
171 RecoveryPlanDecisionPrompt string // neutral title for a material Auto plan transition
172 RecoveryPlanBeforeFmt string // compact previous-plan line, one %s
173 RecoveryPlanAfterFmt string // compact proposed-plan line, one %s
174 RecoveryTaskGrantChoices string // Auto Guard list with a current-task semantic grant
175 SandboxEscapeApprovalChoices string // approval choice list for OS sandbox escape prompts
176 ApprovalNeededFmt string // notification text for a pending approval, tool only
177 ApprovalNeededWithSubjectFmt string // notification text for a pending approval with subject
178 ToolApprovalSourceFmt string // "Source: %s" / "来源: %s"
179 ToolApprovalBuiltIn string // built-in tool source label
180 ToolApprovalImageUse string // image-understanding detail for understand_image-style tools
181 ApprovalToolLabelBash string // user-facing label for bash approvals
182 ApprovalToolLabelEditFile string // user-facing label for edit_file approvals
183 ApprovalToolLabelWriteFile string // user-facing label for write_file approvals
184 ApprovalToolLabelMultiEdit string // user-facing label for multi_edit approvals
185 ApprovalToolLabelMoveFile string // user-facing label for move_file approvals
186 ApprovalToolLabelWebFetch string // user-facing label for web_fetch approvals
187 ApprovalToolLabelRunSkill string // user-facing label for run_skill approvals
188 ApprovalToolLabelRemember string // user-facing label for remember approvals
189 ApprovalToolLabelForget string // user-facing label for forget approvals
190 ApprovalToolLabelSandboxEscape string // user-facing label for OS sandbox escape approvals
191 ApprovalToolLabelPlanModeReadOnly string // user-facing label for plan-mode read-only command trust approvals
192 MemoryApprovalSaveUpdate string // subject prefix for remember approval
193 MemoryApprovalBodyLabel string // label before the body excerpt in remember approval
194 MemoryApprovalArchiveFmt string // subject for forget approval, %q = memory name
195 PlanModeBashTrustSubjectFmt string // subject for bash read-only prefix trust approval, prefix + command
196 PlanModeBashTrustReason string // reason for bash read-only prefix trust approval
197 PlanModeBashTrustDeclined string // model-facing denial after bash read-only prefix rejection
198 SandboxEscapeSubjectFallback string // fallback subject for a one-shot unconfined sandbox escape approval
199 SandboxEscapeSubjectPrefix string // subject prefix before the shell command for one-shot unconfined escape approval
200 SandboxEscapeWrapReason string // reason when no OS sandbox can wrap the command
201 SandboxEscapeRuntimeReason string // fallback reason when an OS sandbox cannot start the command
202 SandboxEscapeDeclined string // model-facing denial when the user declines a one-shot unconfined retry
203 ApprovalToolLabelConfigWrite string // user-facing label for Reasonix-managed config write approvals
204 ConfigWriteSubjectPrefix string // subject prefix before the config file path for managed config write approval
205 ConfigWriteReason string // reason shown for managed config write approval
206 ConfigWriteDeclined string // model-facing denial when the user declines a managed config write
207 ConfigWriteApprovalChoices string // approval choice list for managed config write prompts
208 WriteAccessApprovalChoices string // four-choice list for extending writable roots
209 WriteAccessHomeWarning string // high-risk warning when granting the whole home directory
210 WriteAccessMergedPermissionHint string // note that the same choice also grants ordinary tool permission
211 WriteAccessProjectHint string // note that project persist edits reasonix.toml
212 PermissionSavedFmt string // permission rule saved notice: path, rule
213 PermissionAlreadyAllowedFmt string // permission rule already covered notice: path, rule
214 PermissionSaveFailedFmt string // permission rule save failure notice: rule, error
215 PlanModeReadOnlyCommandTrustSavedFmt string // plan-mode bash read-only prefix saved notice: path, prefix
216 PlanModeReadOnlyCommandTrustAlreadyFmt string // plan-mode bash read-only prefix already covered notice: path, prefix
217 PlanModeReadOnlyCommandTrustFailedFmt string // plan-mode bash read-only prefix save failure notice: prefix, error
218 DiffFoldedFmt string // "… +%d more lines" footer when a writer diff is folded
219 DiffFoldEnabledFmt string // notice when /diff-fold enables folding, %d = line limit
220 DiffFoldDisabled string // notice when /diff-fold disables folding (shows all lines)
221
222 // `ask` tool question card.
223 AskTypeSomething string // the "type your own answer" option label
224 AskTypingHint string // shown on that row while entering free text
225 AskChatInstead string // the "don't pick, just chat" option label
226 ChatStatusQuestion string // shortcuts hint while a question card is open
227 StatusResumePicker string // status tag while the resume picker is open (e.g. "select session")
228 AskSubmitTitle string // submit-tab title in the ask tool question card
229 AskUnanswered string // placeholder for an unanswered ask question
230 AskSubmitHint string // submit-tab keyboard hint
231 ElicitURLHint string // url-mode elicitation keyboard hint
232 ElicitConfirmOnly string // schema-less form elicitation hint
233 ElicitUnanswered string // placeholder for an unanswered elicitation field
234 ElicitSubmit string // elicitation submit row label
235 ElicitSubmitHint string // elicitation keyboard hint
236
237 // output style listing (/output-style).
238 OutputStyleNone string // no styles available
239 ThemeHeader string // header above the /theme listing
240 ThemeHint string // how to select a theme
241 ThemeChangedFmt string // "/theme <name>" succeeded
242 ThemeUnknownFmt string // "/theme <name>" unknown
243 LanguageHeader string // header above the /language listing
244 LanguageHint string // how to select a language
245 LanguageChangedFmt string // "/language <tag>" succeeded, %s = saved tag, %s = resolved tag
246 CurrencyHeader string // header above the /currency listing
247 CurrencyHint string // how to select a pricing currency
248 CurrencyChangedFmt string // "/currency <mode>" succeeded, %s = saved mode, %s = resolved currency
249 RuntimeRefreshBusy string // runtime-affecting setting cannot change while work is active
250 RuntimeRefreshUnavailable string // current session cannot rebuild after a runtime-affecting setting change
251
252 // context compaction card (CompactionStarted / CompactionDone events).
253 CompactionWorking string // shown while the summarizer runs
254 CompactionTitle string // card header before "· N messages · <trigger>"
255 CompactionUnit string // the noun counted, e.g. "messages"
256 CompactionAuto string // trigger label: reached the window threshold
257 CompactionManual string // trigger label: user ran /compact
258 CompactionStopping string // cancellation has been requested
259 CompactionSaving string // a committed result is being persisted
260 CompactionNoHistory string // the selected history has nothing to fold
261 CompactionStopped string // cancelled before applying a projection
262 CompactionStoppedPartial string // cancelled after at least one applied batch
263 CompactionRecoveryRequired string // persistence/cancellation state needs recovery
264 CompactionInterrupted string // a previous non-terminal operation was interrupted
265 CompactionEstimatedTokens string // label for estimated before/after token counts
266
267 // extension structured-UI surfaces (ExtensionSurface / ExtensionStatus events).
268 ExtFormFieldsHint string // form card: field values are collected through the usual prompts
269 ExtRunActionFmt string // card action hint, one %s = the /<plugin>:<action> slash name
270
271 // chat TUI slash commands.
272 SlashCompactFailed string // "/compact" errored, prefixed before the underlying error
273 SlashNewDone string // "/new" succeeded
274 SlashNewFailed string // "/new" errored
275 SlashClearPrompt string // "/clear" destructive confirmation prompt
276 SlashClearDone string // "/clear" succeeded
277 SlashClearFailed string // "/clear" errored
278 SlashClsDone string // "/cls" succeeded
279 SlashTodoCleared string // "/todo" dismissed the pinned task list
280 SlashUnknown string // shown when the user types an unrecognised "/cmd"
281 SlashUnknownSentAsMessage string // suffix: the unrecognised "/cmd" line was sent as a regular message
282 SlashPromptEmpty string // an MCP prompt returned no text to send
283 SlashMCPNone string // /mcp when no MCP servers are connected
284 CtrlCQuitHint string // shown on first Ctrl+C while idle; second press exits
285 CompHintSlash string // key hint footer under the slash-command menu
286 CompHintFile string // key hint footer under the @ file/resource menu
287 MouseCopiedHint string // transient status-line hint after a mouse/Ctrl+C selection copy
288 ClipboardCopyOSC52Hint string // copy was sent through OSC 52 because the session is remote
289 ClipboardCopyFallbackHint string // native clipboard failed and copy fell back to OSC 52
290 ClipboardTextPasteRemoteHint string // mouse paste cannot read the user's local clipboard/PRIMARY selection over SSH
291 ClipboardTextPasteFailedFmt string // text clipboard read failed, one %v
292 ClipboardImagePastingHint string // shown while an image is being read from the system clipboard
293 ClipboardPasteEmptyNotice string
294 ClipboardImagePasteFailedFmt string // image clipboard read failed, one %v
295 MouseCaptureOnHint string // "/mouse" turned in-app mouse handling back on
296 MouseCaptureOffHint string // "/mouse" released mouse capture to the terminal
297 MouseCaptureTag string // persistent status-line marker while mouse capture is off
298
299 // shell execution (! prefix).
300 ShellExecEmpty string // bare "!" with no command
301 ShellExecFailedFmt string // "shell command failed: %v"
302 ShellExecTimeoutFmt string // "shell command timed out (> %s)"
303 ShellModeHint string // status line hint when input starts with !
304
305 // slash command + sub-command descriptions shown in the menu (CLI and desktop
306 // share these via i18n.M, so both frontends localize identically).
307 CmdNew string // /new
308 CmdClear string // /clear
309 CmdCls string // /cls
310 CmdCompact string // /compact
311 CmdContinueChecks string // /continue-checks
312 CmdContext string // /context
313 CmdRewind string // /rewind
314 CmdTree string // /tree
315 CmdBranch string // /branch
316 CmdSwitchBranch string // /switch
317 CmdResume string // /resume
318 CmdRename string // /rename
319 CmdModel string // /model
320 CmdStatus string // /status
321 CmdWorkMode string // /work-mode
322 CmdDocs string // /docs
323 CmdMemory string // /memory
324 CmdMigrate string // /migrate
325 CmdGoal string // /goal
326 CmdRemember string // /remember
327 CmdForget string // /forget
328 CmdMcp string // /mcp
329 CmdRemote string // /remote
330 CmdHooks string // /hooks
331 CmdPlugins string // /plugins
332 CmdPasteImage string // /paste-image
333 CmdOutputStyle string // /output-style
334 CmdTheme string // /theme
335 CmdLanguage string // /language
336 CmdCurrency string // /currency
337 CmdSkill string // /skills
338 CmdVerbose string // /verbose
339 CmdReloadCmd string // /reload-cmd
340 CmdReload string // /reload
341 CmdDiffFold string // /diff-fold
342 CmdSandbox string // /sandbox
343 CmdEffort string // /effort
344 CmdMouse string // /mouse
345 CmdReasonLang string // /reasoning-language
346 CmdHelp string // /help
347 CmdWeb string // /web
348 CmdTodo string // /todo
349 CmdQuit string // /quit (also accepts /exit as hidden alias)
350 CmdCopy string // /copy
351 CmdExport string // /export
352 SlashCopyDone string // "/copy" succeeded
353 SlashCopyEmpty string // no assistant response to copy
354 SlashCopyListHeader string // header shown before the numbered list
355 SlashExportDoneFmt string // "/export" succeeded, %s = file path
356 SlashExportEmpty string // no messages to export
357 ArgSkillShow string // /skills show
358 ArgSkillNew string // /skills new
359 ArgSkillPaths string // /skills paths
360 ArgMcpAdd string // /mcp add
361 ArgMcpRemove string // /mcp remove
362 ArgMcpConnected string // /mcp remove <server> tag
363 ArgHooksList string // /hooks list
364 ArgModelCurrent string // /model <ref> active tag
365 ArgEffortAuto string // /effort auto
366 ArgEffortLow string // /effort low
367 ArgEffortMedium string // /effort medium
368 ArgEffortHigh string // /effort high
369 ArgEffortXHigh string // /effort xhigh
370 ArgEffortMax string // /effort max
371 ArgPresetStandard string // /preset standard
372 ArgPresetDelivery string // /preset delivery
373 ArgThemeCurrent string // /theme <style> active tag
374 ArgLanguageAuto string // /language auto
375 ArgLanguageEn string // /language en
376 ArgLanguageZh string // /language zh
377
378 // management listing notices (the Submit path: desktop / HTTP frontends)
379 ListModelsHeaderFmt string // "models (active: %s)"
380 ListModelsHint string // how to switch
381 ListMemorySaved string // "saved memories"
382 ListMemoryArchived string // "archived memories"
383 ListMemoryNone string // no memory docs
384 ListSkillsHeaderFmt string // "skills (%d)"
385 ListSkillsNone string // no skills
386 ListHooksHeaderFmt string // "hooks (%d active)"
387 ListHooksNone string // no hooks
388 ListMcpHeader string // "mcp servers"
389 ListMcpNone string // no mcp servers
390
391 // in-chat memory/model/rewind notices.
392
393 MemoryEditHint string
394 ForgetUsage string
395 ForgetDoneFmt string
396 QuickRememberEmpty string
397 QuickRememberDoneFmt string
398 GoalEmpty string
399 GoalCurrentFmt string
400 GoalSetFmt string
401 GoalCleared string
402 GoalNotRunning string
403 GoalNotPaused string
404 GoalPaused string
405 GoalPausedReason string
406 GoalPausedFmt string // %s = stop cause
407 GoalRuntimeFmt string // turns, requests, tokens, work duration
408 GoalRuntimeLastReason string
409 ModelSwitchUnavailable string
410 ModelSwitchBusy string
411 ModelAlreadyOnFmt string
412 ModelSwitchingFmt string
413 ModelSwitchedFmt string
414 ModelListHeader string
415 RuntimeSwitchPending string
416 RuntimeReloadQueued string // /reload queued behind active work; the idle drain runs it
417 RuntimeReloaded string // /reload completed (no generation available)
418 RuntimeReloadedGenerationFmt string // /reload completed; %d is the runtime build generation
419 WorkModeUsage string
420 // WorkModeDeprecatedNotice is shown once when a legacy /work-mode or
421 // /profile command is used. Prefer /preset.
422 WorkModeDeprecatedNotice string
423 // QualityFloorApplied confirms a quality floor switch.
424 QualityFloorApplied string
425 RewindNone string
426 RewindCodeConversation string
427 RewindConversationOnly string
428 RewindCodeOnly string
429 RewindFork string
430 RewindSummarizeFrom string
431 RewindSummarizeUpto string
432 RewindPickTitle string
433 RewindPickHint string
434 RewindRestoreTitleFmt string
435 RewindApplyHint string
436 RewindCoverageTitle string
437 RewindCoverageWarningFmt string
438 RewindConfirmHint string
439 RewindUnavailableFmt string
440 RewindEmpty string
441
442 // skill picker overlay (/skills interactive panel in CLI TUI)
443 SkillPickerAvailableFmt string
444 SkillPickerMatchingFmt string // "%d matching · %d total" when searching
445 SkillPickerHint string
446 SkillPickerDetailHint string
447 SkillPickerSearchEmpty string
448 SkillPickerSearchPlaceholder string
449 SkillPickerSourceTitle string
450 SkillPickerSourceActiveFmt string
451 SkillPickerSourceHint string
452 SkillPickerDiagHidden string
453 SkillPickerDiagShown string
454 SkillPickerBuiltinSource string
455 SkillPickerRescanned string
456 SkillPickerNoDescription string
457 SkillPickerScopeProject string
458 SkillPickerScopeCustom string
459 SkillPickerScopeGlobal string
460 SkillPickerScopeBuiltin string
461 SkillPickerSubagent string
462 SkillPickerAvailableLabel string
463 SkillPickerDisabledLabel string
464 SkillPickerNoChanges string
465 SkillPickerSourceSkillsHint string
466 SkillPickerSourceSkillsEmpty string
467 SkillPickerActionToggle string
468 SkillPickerActionDelete string
469 SkillPickerDeleteTitleFmt string // "Delete skill %s?"
470 SkillPickerDeleteConfirm string
471 SkillPickerDeleteCancel string
472 SkillPickerDeleteHint string
473 SkillPickerDeletedFmt string // "deleted skill %s"
474 SkillPickerMoreAboveFmt string // "↑ %d more above"
475 SkillPickerMoreBelowFmt string // "↓ %d more below"
476 SkillPickerTokenFmt string // "~%d tok"
477 SkillPickerDetailMetaFmt string // "Scope: %s Run as: %s"
478 SkillPickerSkillsUnit string // "skills" (used as "%d skills")
479 SkillPickerLinesUnit string // "lines" (used as "+N more lines")
480 SkillPickerStatusLabel string // shown in the TUI status bar while picker is open
481 SkillPickerStatusOK string // "ok" path status label
482 SkillPickerStatusMissing string // "missing" path status label
483 SkillPickerStatusNotDir string // "not-directory" path status label
484 SkillPickerStatusUnreadable string // "unreadable" path status label
485
486 // init wizard
487 EnterAPIKeysHeader string // header before the per-env-var prompts
488 WroteFileFmt string // "Wrote %s" — used for reasonix.toml and .env both
489 SetupComplete string // success line at end of init
490 SetupCancelled string // shown when the user aborts the wizard
491 TryHintFmt string // "Try: %s" — %s = command to try (styled)
492 NextHint string // non-interactive post-write hint
493 ConfirmReconfigureFmt string // "%s already exists. Reconfigure and overwrite?"
494 NotOverwritingFmt string // non-interactive overwrite refusal
495 SetupManagerTitle string
496 SetupAddOpenAI string
497 SetupAddAnthropic string
498 SetupProviderExistsFmt string
499 SetupSaveExit string
500 SetupSaveExitDesc string
501 SetupCancel string
502 SetupCancelDesc string
503 SetupModelsUnit string
504 SetupKeySet string
505 SetupKeyMissing string
506 SetupDefaultBadge string
507 SetupProviderActionsFmt string
508 SetupEditProvider string
509 SetupUpdateKey string
510 SetupTestRefresh string
511 SetupSetDefault string
512 SetupRemoveProvider string
513 SetupBack string
514 SetupPromptModels string
515 SetupSharedKeyWarningFmt string
516 SetupKeyEnvTakenFmt string
517 SetupKeyEnvStoredFmt string
518 SetupKeyEnvSettingFmt string
519 SetupKeyEnvShellFmt string
520 SetupKeyEnvRetry string
521 SetupPromptAPIKeyFmt string
522 SetupSelectDefaultModel string
523 SetupConfirmRemoveFmt string
524 SetupSummaryTitle string
525 SetupSummaryAddedFmt string
526 SetupSummaryEditedFmt string
527 SetupSummaryRemovedFmt string
528 SetupSummaryDefaultFmt string
529 SetupSummaryKeysFmt string
530 SetupSummaryNoChanges string
531 SetupConfirmSave string
532 SetupConcurrentChangeFmt string
533
534 // model fetching
535 FetchingModelsFmt string // "Fetching models for %s..."
536 FetchModelsSuccessFmt string // "Found %d models for %s"
537 FetchModelsFailedFmt string // "Failed to fetch models for %s: %v"
538 FetchModelsUsingPresetsFmt string // "Live fetch unavailable for %s, using preset model list"
539 SelectModelsLabel string // "Select models to enable for %s"
540 CustomFetchEmpty string // "/models returned an empty list — falling back to manual entry"
541 AnthropicFetchEmpty string // "/models returned an empty list — Anthropic-compatible providers usually don't expose one, falling back to manual entry"
542 APIKeyAlreadySetFmt string // "reusing existing value for %s"
543 APIKeyResetPromptFmt string // "Re-enter %s?"
544 InvalidAPIKeyEnvFmt string // "%q is not a valid API Key variable name..."
545 RepairedAPIKeyEnvFmt string // "provider %s: replaced invalid api_key_env %q with %q"
546
547 // custom provider
548 CustomProviderDesc string // "Add third-party OpenAI compatible model"
549 CustomAddMethodLabel string // "Select add method"
550 CustomMethodManual string // "Enter model name manually"
551 CustomMethodURL string // "Fetch models from URL"
552 CustomPromptModel string // "Enter model name"
553 CustomPromptBaseURL string // "Enter Base URL"
554 CustomPromptKeyEnv string // "Enter API Key env var name"
555 CustomPromptAPIKey string // "Enter API Key"
556 CustomPromptWindow string // "Enter context window in tokens"
557 CustomAddedFmt string // "Added custom model: %s"
558
559 // Anthropic compatible provider
560 AnthropicProviderDesc string // "Add Anthropic API compatible model"
561 AnthropicAddMethodLabel string // "Select add method"
562 AnthropicMethodManual string // "Enter model name manually"
563 AnthropicMethodURL string // "Fetch models from URL"
564 AnthropicPromptModel string // "Enter model name"
565 AnthropicPromptBaseURL string // "Enter Base URL"
566 AnthropicPromptKeyEnv string // "Enter API Key env var name"
567 AnthropicPromptAPIKey string // "Enter API Key"
568 AnthropicAddedFmt string // "Added Anthropic compatible model: %s"
569 AnthropicFetchingModelsFmt string // "Fetching models for %s..."
570 AnthropicFetchModelsSuccessFmt string // "Found %d models for %s"
571 AnthropicFetchModelsFailedFmt string // "Failed to fetch models for %s: %v"
572 AnthropicSelectModelsLabel string // "Select models to enable for %s"
573
574 // remote SSH module
575 RemoteConnectingFmt string // "connecting to %s…"
576 RemoteConnectedFmt string // "connected to %s"
577 RemoteReconnectingFmt string // "reconnecting to %s (attempt %d)…"
578 RemoteDegradedFmt string // "connected to %s but some forwards are down"
579 RemoteDisconnected string // "disconnected"
580 RemoteServeReadyFmt string // "remote serve ready: %s"
581 RemoteHostKeyPromptFmt string // "host %s key (%s): %s"
582 RemotePassphrasePromptFmt string // "passphrase for %s:"
583 RemotePasswordPromptFmt string // "password for %s:"
584 RemoteBootstrapStepFmt string // "remote serve: %s %s"
585 RemoteNoHostsHint string // "no remote hosts configured; add one with `reasonix remote add`"
586
587 // top-level / runAgent
588 UnknownCommandFmt string // "unknown command %q"
589 UsageRunHint string // "usage: reasonix run [--model NAME] <task>"
590 ErrorPrefix string // "error:" — prefix for fatal-error output
591 ReconfigureOnUnknownModel string // shown when the configured model no longer resolves and setup is re-run
592 WriteConfigErr string // "write config:" — prefix for write failure
593 WriteEnvErr string // "write .env:" — prefix for env-write failure
594
595 // provider HTTP error explanations — actionable, reason + fix per status code
596 ProviderErrBadRequest string // 400
597 ProviderErrContextOverflowFmt string // 400/413/422 shared-window overflow with numbers
598 ProviderErrAuth string // 401 — no key configured / sent
599 ProviderErrAuthRejected string // 401 — a key was sent but the server rejected it
600 ProviderErrModelFormatMismatch string // provider rejected the model on the selected wire format
601 ProviderErrOpenCodeGoGrokRoute string // recovery hint for OpenCode Go Grok routing
602 ProviderErrQuotaExhaustedFmt string // provider name, actual HTTP status
603 ProviderErrReasonMissing string
604 ProviderErrStreamInterruptedFmt string
605 ProviderErrDisconnectedFmt string
606 ProviderErrNonStreamingFmt string
607 SearchSourcesNotProvided string
608 SearchModelUnavailable string
609 ProtocolRecoveryLabel string
610 ProviderErrInsufficientBalance string // 402
611 ProviderErrNotFound string // 404
612 ProviderErrUnprocessable string // 422
613 ProviderErrInputSensitive string // MiniMax 1026
614 ProviderErrOutputSensitive string // MiniMax 1027
615 ProviderErrRateLimited string // 429
616 ProviderErrServer string // 500
617 ProviderErrServerBusy string // 503
618 ProviderErrWaitExhaustedFmt string // total time waited before giving up
619
620 // selection menus
621 SelectOneHint string // "(↑/↓ · Enter · q to cancel)"
622 SelectManyHint string // "(↑/↓ · Space · Enter · q)"
623 SelectMoreAboveFmt string // "↑ %d more above"
624 SelectMoreBelowFmt string // "↓ %d more below"
625 SelectSearchHint string // "/ to search · Esc to cancel"
626
627 // /provider command
628 CmdProvider string // /provider
629 ProviderListHeader string // header for /provider list
630 ProviderAlreadyOnFmt string // already on provider
631 ProviderUnknownFmt string // unknown provider
632 ProviderPickLabel string // label for provider model picker
633 ProviderNoModelsFmt string // provider has no models
634
635 // `reasonix upgrade` / `reasonix update` — self-update
636 UpgradeChecking string // "Checking for updates…"
637 UpgradeChannelDeprecated string // legacy channel selection is ignored
638 UpgradeDevBuild string // dev builds cannot self-update
639 UpgradeFetchFailed string // "failed to check for updates: %v"
640 UpgradeInvalidVersion string // remote version not valid semver
641 UpgradeAlreadyLatest string // already on the latest version
642 UpgradeForcing string // "Reinstalling the same version…"
643 UpgradeAvailableFmt string // "Current: %s → Latest: %s"
644 UpgradeNoAssetFmt string // "no binary found for %s"
645 UpgradeDownloadingFmt string // "Downloading %s (%s)…"
646 UpgradeDownloadFailed string // "download failed: %v"
647 UpgradeVerifying string // "Verifying checksum…"
648 UpgradeChecksumFailed string // "could not fetch checksum file: %v"
649 UpgradeChecksumMismatchFmt string // SHA256 mismatch detail
650 UpgradeChecksumNotFoundFmt string // asset not listed in SHA256SUMS
651 UpgradeExtractFailed string // "failed to extract binary: %v"
652 UpgradeApplying string // "Replacing binary…"
653 UpgradeApplyFailed string // "failed to apply update: %v"
654 UpgradeSuccessFmt string // "Updated %s → %s"
655
656 // `reasonix report` — local CLI crash review and explicit upload
657 ReportNoPending string
658 ReportHeaderFmt string
659 ReportCapturedFmt string
660 ReportPreviewOnlyFmt string
661 ReportSendPrompt string
662 ReportKept string
663 ReportDeletedFmt string
664 ReportSentFmt string
665 ReportConfigFailedFmt string
666 ReportUploadFailedFmt string
667 ReportSentDeleteFailedFmt string
668 ReportUsageBody string
669
670 // First eligible interactive CLI telemetry consent.
671 CLITelemetryConsentNotice string
672 CLITelemetryConsentPrompt string
673 CLITelemetryConsentInvalid string
674 CLITelemetryConsentSaveFailedFmt string
675 CLITelemetryConsentCleanupFailedFmt string
676
677 // usage / help
678 UsageBody string // full multi-line help text
679 }
680
681 // ProviderStatusMessage returns an actionable explanation for a known provider
682 // HTTP status, or "" when the status has no specific guidance.
683 func (m Messages) ProviderStatusMessage(status int) string {
684 switch status {
685 case 400:
686 return m.ProviderErrBadRequest
687 case 401, 403:
688 return m.ProviderErrAuth
689 case 402:
690 return m.ProviderErrInsufficientBalance
691 case 404:
692 return m.ProviderErrNotFound
693 case 422:
694 return m.ProviderErrUnprocessable
695 case 429:
696 return m.ProviderErrRateLimited
697 case 500:
698 return m.ProviderErrServer
699 case 503:
700 return m.ProviderErrServerBusy
701 }
702 return ""
703 }
704
705 // M is the active catalogue. DetectLanguage replaces it; English is the
706 // default so any code path that runs before detection still has text.
707 var (
708 M = English
709 currentLanguage = "en"
710 )
711
712 // CurrentLanguage returns the language tag installed by the latest
713 // DetectLanguage call. It lets frontends reuse the resolved locale without
714 // re-reading the environment and accidentally ignoring an explicit override.
715 func CurrentLanguage() string {
716 return currentLanguage
717 }
718
719 // DetectLanguage selects a catalogue from override (e.g. cfg.Language) or the
720 // environment and installs it as M. Returns the resolved tag ("en", "zh") so
721 // callers can log or expose it.
722 //
723 // Priority: override > REASONIX_LANG > LC_ALL > LC_MESSAGES > LANG > "en".
724 func DetectLanguage(override string) string {
725 for _, c := range append([]string{override}, envCandidates()...) {
726 if tag := normalize(c); tag != "" {
727 return setLanguage(tag)
728 }
729 }
730 return setLanguage("en")
731 }
732
733 func envCandidates() []string {
734 keys := []string{"REASONIX_LANG", "LC_ALL", "LC_MESSAGES", "LANG"}
735 out := make([]string, len(keys))
736 for i, k := range keys {
737 out[i] = os.Getenv(k)
738 }
739 return out
740 }
741
742 func setLanguage(tag string) string {
743 switch tag {
744 case "zh-tw", "zh-TW":
745 M = ChineseTraditional
746 currentLanguage = "zh-TW"
747 case "zh":
748 M = Chinese
749 currentLanguage = "zh"
750 default:
751 M = English
752 currentLanguage = "en"
753 }
754 return currentLanguage
755 }
756
757 // normalize maps a locale string (e.g. "zh_CN.UTF-8", "zh-Hans-CN", "Chinese
758 // (China)") to a short tag this package knows about. Returns "" for empty or
759 // unrecognised input so DetectLanguage can fall through to the next candidate.
760 func normalize(s string) string {
761 s = strings.ToLower(strings.TrimSpace(s))
762 s = strings.ReplaceAll(s, "_", "-") // zh_TW.UTF-8 → zh-tw.utf-8 (POSIX locales use underscores)
763 if s == "" {
764 return ""
765 }
766 if strings.HasPrefix(s, "zh-tw") || strings.HasPrefix(s, "zh-hant") || strings.Contains(s, "chinese traditional") || strings.Contains(s, "繁體") {
767 return "zh-TW"
768 }
769 if strings.HasPrefix(s, "zh") || strings.Contains(s, "chinese") || strings.Contains(s, "中文") {
770 return "zh"
771 }
772 if strings.HasPrefix(s, "en") || strings.Contains(s, "english") {
773 return "en"
774 }
775 return ""
776 }
777
777 lines GO