Skip to main content

cc_switch_lib/cli/
i18n.rs

1use crate::settings::{get_settings, update_settings};
2use std::sync::OnceLock;
3use std::sync::RwLock;
4
5#[cfg(test)]
6use std::cell::RefCell;
7
8/// Supported languages
9#[derive(Debug, Clone, Copy, PartialEq, Eq)]
10pub enum Language {
11    English,
12    Chinese,
13}
14
15impl Language {
16    pub fn code(&self) -> &'static str {
17        match self {
18            Language::English => "en",
19            Language::Chinese => "zh",
20        }
21    }
22
23    pub fn display_name(&self) -> &'static str {
24        match self {
25            Language::English => "English",
26            Language::Chinese => "中文",
27        }
28    }
29
30    pub fn from_code(code: &str) -> Self {
31        match code.to_lowercase().as_str() {
32            "zh" | "zh-cn" | "zh-tw" | "chinese" => Language::Chinese,
33            _ => Language::English,
34        }
35    }
36}
37
38impl std::fmt::Display for Language {
39    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
40        write!(f, "{}", self.display_name())
41    }
42}
43
44/// Global language state
45fn language_store() -> &'static RwLock<Language> {
46    static STORE: OnceLock<RwLock<Language>> = OnceLock::new();
47    STORE.get_or_init(|| {
48        let lang = if cfg!(test) {
49            // Keep unit tests deterministic and avoid reading real user settings.
50            Language::English
51        } else {
52            let settings = get_settings();
53            settings
54                .language
55                .as_deref()
56                .map(Language::from_code)
57                .unwrap_or(Language::English)
58        };
59        RwLock::new(lang)
60    })
61}
62
63#[cfg(test)]
64thread_local! {
65    static TEST_LANGUAGE_OVERRIDE: RefCell<Option<Language>> = const { RefCell::new(None) };
66}
67
68#[cfg(test)]
69pub(crate) struct TestLanguageGuard(Option<Language>);
70
71#[cfg(test)]
72impl Drop for TestLanguageGuard {
73    fn drop(&mut self) {
74        TEST_LANGUAGE_OVERRIDE.with(|slot| {
75            *slot.borrow_mut() = self.0;
76        });
77    }
78}
79
80#[cfg(test)]
81pub(crate) fn use_test_language(lang: Language) -> TestLanguageGuard {
82    let previous = TEST_LANGUAGE_OVERRIDE.with(|slot| slot.replace(Some(lang)));
83    TestLanguageGuard(previous)
84}
85
86/// Get current language
87pub fn current_language() -> Language {
88    #[cfg(test)]
89    if let Some(lang) = TEST_LANGUAGE_OVERRIDE.with(|slot| *slot.borrow()) {
90        return lang;
91    }
92
93    *language_store().read().expect("Failed to read language")
94}
95
96/// Set current language and persist
97pub fn set_language(lang: Language) -> Result<(), crate::error::AppError> {
98    // Update runtime state
99    {
100        let mut guard = language_store().write().expect("Failed to write language");
101        *guard = lang;
102    }
103
104    // Persist to settings
105    let mut settings = get_settings();
106    settings.language = Some(lang.code().to_string());
107    update_settings(settings)
108}
109
110/// Check if current language is Chinese
111pub fn is_chinese() -> bool {
112    current_language() == Language::Chinese
113}
114
115// ============================================================================
116// Localized Text Macros and Functions
117// ============================================================================
118
119/// Get localized text based on current language
120#[macro_export]
121macro_rules! t {
122    ($en:expr, $zh:expr) => {
123        if $crate::cli::i18n::is_chinese() {
124            $zh
125        } else {
126            $en
127        }
128    };
129}
130
131// Re-export for convenience
132pub use t;
133
134// ============================================================================
135// Common UI Texts
136// ============================================================================
137
138pub mod texts {
139    use super::is_chinese;
140
141    // ============================================
142    // ENTITY TYPE CONSTANTS (实体类型常量)
143    // ============================================
144
145    pub fn entity_provider() -> &'static str {
146        if is_chinese() {
147            "供应商"
148        } else {
149            "provider"
150        }
151    }
152
153    pub fn entity_server() -> &'static str {
154        if is_chinese() {
155            "服务器"
156        } else {
157            "server"
158        }
159    }
160
161    pub fn entity_prompt() -> &'static str {
162        if is_chinese() {
163            "提示词"
164        } else {
165            "prompt"
166        }
167    }
168
169    // ============================================
170    // GENERIC ENTITY OPERATIONS (通用实体操作)
171    // ============================================
172
173    pub fn entity_added_success(entity_type: &str, name: &str) -> String {
174        if is_chinese() {
175            format!("✓ 成功添加{} '{}'", entity_type, name)
176        } else {
177            format!("✓ Successfully added {} '{}'", entity_type, name)
178        }
179    }
180
181    pub fn entity_updated_success(entity_type: &str, name: &str) -> String {
182        if is_chinese() {
183            format!("✓ 成功更新{} '{}'", entity_type, name)
184        } else {
185            format!("✓ Successfully updated {} '{}'", entity_type, name)
186        }
187    }
188
189    pub fn entity_deleted_success(entity_type: &str, name: &str) -> String {
190        if is_chinese() {
191            format!("✓ 成功删除{} '{}'", entity_type, name)
192        } else {
193            format!("✓ Successfully deleted {} '{}'", entity_type, name)
194        }
195    }
196
197    pub fn entity_not_found(entity_type: &str, id: &str) -> String {
198        if is_chinese() {
199            format!("{}不存在: {}", entity_type, id)
200        } else {
201            format!("{} not found: {}", entity_type, id)
202        }
203    }
204
205    pub fn confirm_create_entity(entity_type: &str) -> String {
206        if is_chinese() {
207            format!("\n确认创建此{}?", entity_type)
208        } else {
209            format!("\nConfirm create this {}?", entity_type)
210        }
211    }
212
213    pub fn confirm_update_entity(entity_type: &str) -> String {
214        if is_chinese() {
215            format!("\n确认更新此{}?", entity_type)
216        } else {
217            format!("\nConfirm update this {}?", entity_type)
218        }
219    }
220
221    pub fn confirm_delete_entity(entity_type: &str, name: &str) -> String {
222        if is_chinese() {
223            format!("\n确认删除{} '{}'?", entity_type, name)
224        } else {
225            format!("\nConfirm delete {} '{}'?", entity_type, name)
226        }
227    }
228
229    pub fn select_to_delete_entity(entity_type: &str) -> String {
230        if is_chinese() {
231            format!("选择要删除的{}:", entity_type)
232        } else {
233            format!("Select {} to delete:", entity_type)
234        }
235    }
236
237    pub fn no_entities_to_delete(entity_type: &str) -> String {
238        if is_chinese() {
239            format!("没有可删除的{}", entity_type)
240        } else {
241            format!("No {} available for deletion", entity_type)
242        }
243    }
244
245    // ============================================
246    // COMMON UI ELEMENTS (通用界面元素)
247    // ============================================
248
249    // Welcome & Headers
250    pub fn welcome_title() -> &'static str {
251        if is_chinese() {
252            "    🎯 CC-Switch 交互模式"
253        } else {
254            "    🎯 CC-Switch Interactive Mode"
255        }
256    }
257
258    pub fn application() -> &'static str {
259        if is_chinese() {
260            "应用程序"
261        } else {
262            "Application"
263        }
264    }
265
266    pub fn goodbye() -> &'static str {
267        if is_chinese() {
268            "👋 再见!"
269        } else {
270            "👋 Goodbye!"
271        }
272    }
273
274    // Main Menu
275    pub fn main_menu_prompt(app: &str) -> String {
276        if is_chinese() {
277            format!("请选择操作 (当前: {})", app)
278        } else {
279            format!("What would you like to do? (Current: {})", app)
280        }
281    }
282
283    pub fn interactive_requires_tty() -> &'static str {
284        if is_chinese() {
285            "交互模式需要在 TTY 终端中运行(请不要通过管道/重定向调用)。"
286        } else {
287            "Interactive mode requires a TTY (do not run with pipes/redirection)."
288        }
289    }
290
291    pub fn interactive_legacy_tui_removed() -> &'static str {
292        if is_chinese() {
293            "旧版 legacy TUI 已移除,请直接使用当前默认的交互 TUI。"
294        } else {
295            "The legacy TUI has been removed. Please use the default interactive TUI instead."
296        }
297    }
298
299    // Ratatui TUI (new interactive UI)
300    pub fn tui_app_title() -> &'static str {
301        "cc-switch-tui"
302    }
303
304    pub fn tui_tabs_title() -> &'static str {
305        if is_chinese() {
306            "App"
307        } else {
308            "App"
309        }
310    }
311
312    pub fn tui_hint_app_switch() -> &'static str {
313        if is_chinese() {
314            "切换 App:"
315        } else {
316            "Switch App:"
317        }
318    }
319
320    pub fn tui_filter_icon() -> &'static str {
321        "🔎 "
322    }
323
324    pub fn tui_marker_active() -> &'static str {
325        "✓"
326    }
327
328    pub fn tui_marker_inactive() -> &'static str {
329        " "
330    }
331
332    pub fn tui_highlight_symbol() -> &'static str {
333        "➤ "
334    }
335
336    pub fn tui_toast_prefix_info() -> &'static str {
337        " ℹ "
338    }
339
340    pub fn tui_toast_prefix_success() -> &'static str {
341        " ✓ "
342    }
343
344    pub fn tui_toast_prefix_warning() -> &'static str {
345        " ! "
346    }
347
348    pub fn tui_toast_prefix_error() -> &'static str {
349        " ✗ "
350    }
351
352    pub fn tui_toast_invalid_json(details: &str) -> String {
353        if is_chinese() {
354            format!("JSON 无效:{details}")
355        } else {
356            format!("Invalid JSON: {details}")
357        }
358    }
359
360    pub fn tui_toast_json_must_be_object() -> &'static str {
361        if is_chinese() {
362            "JSON 必须是对象(例如:{\"env\":{...}})"
363        } else {
364            "JSON must be an object (e.g. {\"env\":{...}})"
365        }
366    }
367
368    pub fn tui_error_invalid_config_structure(e: &str) -> String {
369        if is_chinese() {
370            format!("配置结构无效:{e}")
371        } else {
372            format!("Invalid config structure: {e}")
373        }
374    }
375
376    pub fn tui_rule(width: usize) -> String {
377        if is_chinese() {
378            "─".repeat(width)
379        } else {
380            "─".repeat(width)
381        }
382    }
383
384    pub fn tui_rule_heavy(width: usize) -> String {
385        if is_chinese() {
386            "═".repeat(width)
387        } else {
388            "═".repeat(width)
389        }
390    }
391
392    pub fn tui_icon_app() -> &'static str {
393        "📱"
394    }
395
396    pub fn tui_default_config_filename() -> &'static str {
397        "config.json"
398    }
399
400    pub fn tui_default_config_export_path() -> &'static str {
401        "./config-export.sql"
402    }
403
404    pub fn tui_default_common_snippet() -> &'static str {
405        "{}\n"
406    }
407
408    pub fn tui_default_common_snippet_for_app(app: &str) -> &'static str {
409        match app {
410            "codex" => "",
411            _ => "{}\n",
412        }
413    }
414
415    pub fn tui_latency_ms(ms: u128) -> String {
416        if is_chinese() {
417            format!("{ms} ms")
418        } else {
419            format!("{ms} ms")
420        }
421    }
422    pub fn tui_nav_title() -> &'static str {
423        if is_chinese() {
424            "菜单"
425        } else {
426            "Menu"
427        }
428    }
429
430    pub fn tui_filter_title() -> &'static str {
431        if is_chinese() {
432            "过滤"
433        } else {
434            "Filter"
435        }
436    }
437
438    pub fn tui_footer_global() -> &'static str {
439        if is_chinese() {
440            "[ ] 切换应用  ←→ 切换菜单/内容  ↑↓ 移动  Enter 详情  s 切换  / 过滤  Esc 返回  ? 帮助"
441        } else {
442            "[ ] switch app  ←→ focus menu/content  ↑↓ move  Enter details  s switch  / filter  Esc back  ? help"
443        }
444    }
445
446    pub fn tui_footer_group_nav() -> &'static str {
447        if is_chinese() {
448            "导航"
449        } else {
450            "NAV"
451        }
452    }
453
454    pub fn tui_footer_group_actions() -> &'static str {
455        if is_chinese() {
456            "功能"
457        } else {
458            "ACT"
459        }
460    }
461
462    pub fn tui_footer_nav_keys() -> &'static str {
463        if is_chinese() {
464            "←→ 菜单/内容  ↑↓ 移动"
465        } else {
466            "←→ menu/content  ↑↓ move"
467        }
468    }
469
470    pub fn tui_footer_action_keys() -> &'static str {
471        if is_chinese() {
472            "[ ] 切换应用  Enter 详情  s 切换  / 过滤  Esc 返回  ? 帮助"
473        } else {
474            "[ ] switch app  Enter details  s switch  / filter  Esc back  ? help"
475        }
476    }
477
478    pub fn tui_footer_action_keys_main() -> &'static str {
479        if is_chinese() {
480            "[ ] 切换应用  / 过滤  Esc 返回  ? 帮助"
481        } else {
482            "[ ] switch app  / filter  Esc back  ? help"
483        }
484    }
485
486    pub fn tui_footer_action_keys_providers() -> &'static str {
487        if is_chinese() {
488            "[ ] 切换应用  Enter 详情  Space 切换  a 新增  e 编辑  d 删除  t 测试  r 刷新  o 临时启动  f 管理故障转移  x 设为默认  / 过滤  Esc 返回  ? 帮助"
489        } else {
490            "[ ] switch app  Enter details  Space switch  a add  e edit  d delete  t test  r refresh  o launch temp  f manage failover  x set default  / filter  Esc back  ? help"
491        }
492    }
493
494    pub fn tui_footer_action_keys_provider_detail() -> &'static str {
495        if is_chinese() {
496            "[ ] 切换应用  Space 切换  e 编辑  t 测试  r 刷新  o 临时启动  f 管理故障转移  x 设为默认  / 过滤  Esc 返回  ? 帮助"
497        } else {
498            "[ ] switch app  Space switch  e edit  t test  r refresh  o launch temp  f manage failover  x set default  / filter  Esc back  ? help"
499        }
500    }
501
502    pub fn tui_footer_action_keys_mcp() -> &'static str {
503        if is_chinese() {
504            "[ ] 切换应用  x 启用/禁用  m 应用  a 添加  e 编辑  i 导入  d 删除  / 过滤  Esc 返回  ? 帮助"
505        } else {
506            "[ ] switch app  x toggle  m apps  a add  e edit  i import  d delete  / filter  Esc back  ? help"
507        }
508    }
509
510    pub fn tui_footer_action_keys_prompts() -> &'static str {
511        if is_chinese() {
512            "[ ] 切换应用  c 新建  r 刷新  Enter 查看  a 激活  x 取消激活  n 重命名  e 编辑  d 删除  / 过滤  Esc 返回  ? 帮助"
513        } else {
514            "[ ] switch app  c create  r refresh  Enter view  a activate  x deactivate  n rename  e edit  d delete  / filter  Esc back  ? help"
515        }
516    }
517
518    pub fn tui_footer_action_keys_config() -> &'static str {
519        if is_chinese() {
520            "[ ] 切换应用  Enter 打开  e 编辑片段  / 过滤  Esc 返回  ? 帮助"
521        } else {
522            "[ ] switch app  Enter open  e edit snippet  / filter  Esc back  ? help"
523        }
524    }
525
526    pub fn tui_footer_action_keys_common_snippet_view() -> &'static str {
527        if is_chinese() {
528            "a 应用  c 清空  e 编辑  ↑↓ 滚动  Esc 返回"
529        } else {
530            "a apply  c clear  e edit  ↑↓ scroll  Esc back"
531        }
532    }
533
534    pub fn tui_footer_action_keys_settings() -> &'static str {
535        if is_chinese() {
536            "[ ] 切换应用  Enter 应用  / 过滤  Esc 返回  ? 帮助"
537        } else {
538            "[ ] switch app  Enter apply  / filter  Esc back  ? help"
539        }
540    }
541
542    pub fn tui_footer_action_keys_global() -> &'static str {
543        if is_chinese() {
544            "[ ] 切换应用  / 过滤  Esc 返回  ? 帮助"
545        } else {
546            "[ ] switch app  / filter  Esc back  ? help"
547        }
548    }
549
550    pub fn tui_footer_filter_mode() -> &'static str {
551        if is_chinese() {
552            "输入关键字过滤,Enter 应用,Esc 清空并退出"
553        } else {
554            "Type to filter, Enter apply, Esc clear & exit"
555        }
556    }
557
558    pub fn tui_help_title() -> &'static str {
559        if is_chinese() {
560            "帮助"
561        } else {
562            "Help"
563        }
564    }
565
566    pub fn tui_help_text() -> &'static str {
567        if is_chinese() {
568            "[ ]  切换应用\n←→  切换菜单/内容焦点\n↑↓  移动\n/   过滤\nEsc  返回\n?   显示/关闭帮助\n\n文本输入:Ctrl+A/E 行首/行尾,Ctrl+U/K 删除行片段,Ctrl+W 删除前词,Alt+B/F 按词移动\n\n页面快捷键(在页面内容区顶部显示):\n- 供应商:Enter 详情,Space 切换,a 新增,e 编辑,d 删除,t 测试,r 刷新,o 临时启动,f 管理故障转移,x 设为默认\n- 供应商详情:Space 切换,e 编辑,t 测试,r 刷新,o 临时启动,f 管理故障转移,x 设为默认\n- MCP:x 启用/禁用(当前应用),m 选择应用,a 添加,e 编辑,i 导入已有,d 删除\n- 提示词:c 新建,r 刷新,Enter 查看,a 激活,x 取消激活(当前),n 重命名,e 编辑,d 删除\n- 技能:Enter 详情,x 启用/禁用(当前应用),m 选择应用,d 卸载,i 导入已有\n- 配置:Enter 打开/执行,e 编辑片段\n- 设置:Enter 应用"
569        } else {
570            "[ ]  switch app\n←→  focus menu/content\n↑↓  move\n/   filter\nEsc  back\n?   toggle help\n\nText input: Ctrl+A/E move line, Ctrl+U/K delete line parts, Ctrl+W delete word, Alt+B/F move word\n\nPage keys (shown at the top of each page):\n- Providers: Enter details, Space switch, a add, e edit, d delete, t test, r refresh, o launch temp, f manage failover, x set default\n- Provider Detail: Space switch, e edit, t test, r refresh, o launch temp, f manage failover, x set default\n- MCP: x toggle current, m select apps, a add, e edit, i import existing, d delete\n- Prompts: c create, r refresh, Enter view, a activate, x deactivate active, n rename, e edit, d delete\n- Skills: Enter details, x toggle current, m select apps, d uninstall, i import existing\n- Config: Enter open/run, e edit snippet\n- Settings: Enter apply"
571        }
572    }
573
574    pub fn tui_confirm_title() -> &'static str {
575        if is_chinese() {
576            "确认"
577        } else {
578            "Confirm"
579        }
580    }
581
582    pub fn tui_confirm_exit_title() -> &'static str {
583        if is_chinese() {
584            "退出"
585        } else {
586            "Exit"
587        }
588    }
589
590    pub fn tui_confirm_exit_message() -> &'static str {
591        if is_chinese() {
592            "确定退出 cc-switch?"
593        } else {
594            "Exit cc-switch?"
595        }
596    }
597
598    pub fn tui_confirm_yes_hint() -> &'static str {
599        if is_chinese() {
600            "y/Enter = 是"
601        } else {
602            "y/Enter = Yes"
603        }
604    }
605
606    pub fn tui_confirm_no_hint() -> &'static str {
607        if is_chinese() {
608            "n/Esc   = 否"
609        } else {
610            "n/Esc   = No"
611        }
612    }
613
614    pub fn tui_input_title() -> &'static str {
615        if is_chinese() {
616            "输入"
617        } else {
618            "Input"
619        }
620    }
621
622    pub fn tui_editor_text_field_title() -> &'static str {
623        if is_chinese() {
624            "文本"
625        } else {
626            "Text"
627        }
628    }
629
630    pub fn tui_editor_json_field_title() -> &'static str {
631        "JSON"
632    }
633
634    pub fn tui_editor_hint_view() -> &'static str {
635        if is_chinese() {
636            "Enter 编辑  ↑↓ 滚动  Ctrl+S 保存  Esc 返回"
637        } else {
638            "Enter edit  ↑↓ scroll  Ctrl+S save  Esc back"
639        }
640    }
641
642    pub fn tui_editor_hint_edit() -> &'static str {
643        if is_chinese() {
644            "编辑中:Esc 退出编辑  Ctrl+S 保存"
645        } else {
646            "Editing: Esc stop editing  Ctrl+S save"
647        }
648    }
649
650    pub fn tui_editor_discard_title() -> &'static str {
651        if is_chinese() {
652            "放弃修改"
653        } else {
654            "Discard Changes"
655        }
656    }
657
658    pub fn tui_editor_discard_message() -> &'static str {
659        if is_chinese() {
660            "有未保存的修改,确定放弃?"
661        } else {
662            "You have unsaved changes. Discard them?"
663        }
664    }
665
666    pub fn tui_editor_save_before_close_title() -> &'static str {
667        if is_chinese() {
668            "当前未保存"
669        } else {
670            "Unsaved Changes"
671        }
672    }
673
674    pub fn tui_editor_save_before_close_message() -> &'static str {
675        if is_chinese() {
676            "当前有未保存的修改。"
677        } else {
678            "You have unsaved changes."
679        }
680    }
681
682    pub fn tui_speedtest_title() -> &'static str {
683        if is_chinese() {
684            "测速"
685        } else {
686            "Speedtest"
687        }
688    }
689
690    pub fn tui_stream_check_title() -> &'static str {
691        if is_chinese() {
692            "健康检查"
693        } else {
694            "Stream Check"
695        }
696    }
697
698    pub fn tui_provider_test_menu_title() -> &'static str {
699        if is_chinese() {
700            "测试"
701        } else {
702            "Test"
703        }
704    }
705
706    pub fn tui_main_hint() -> &'static str {
707        if is_chinese() {
708            "使用左侧菜单(↑↓ + Enter)。←→ 在菜单与内容间切换焦点。"
709        } else {
710            "Use the left menu (↑↓ + Enter). ←→ switches focus between menu and content."
711        }
712    }
713
714    pub fn tui_header_proxy_status(enabled: bool) -> String {
715        if is_chinese() {
716            format!("代理: {}", if enabled { "开" } else { "关" })
717        } else {
718            format!("Proxy: {}", if enabled { "On" } else { "Off" })
719        }
720    }
721
722    pub fn tui_header_config_error() -> &'static str {
723        if is_chinese() {
724            "配置错误"
725        } else {
726            "Config Error"
727        }
728    }
729
730    pub fn tui_home_section_connection() -> &'static str {
731        if is_chinese() {
732            "连接信息"
733        } else {
734            "Connection Details"
735        }
736    }
737
738    pub fn tui_home_section_proxy() -> &'static str {
739        if is_chinese() {
740            "代理仪表盘"
741        } else {
742            "Proxy Dashboard"
743        }
744    }
745
746    pub fn tui_home_section_context() -> &'static str {
747        if is_chinese() {
748            "Session Context"
749        } else {
750            "Session Context"
751        }
752    }
753
754    pub fn tui_home_section_local_env_check() -> &'static str {
755        if is_chinese() {
756            "本地环境检查"
757        } else {
758            "Local environment check"
759        }
760    }
761
762    pub fn tui_home_section_webdav() -> &'static str {
763        if is_chinese() {
764            "WebDAV 同步"
765        } else {
766            "WebDAV Sync"
767        }
768    }
769
770    pub fn tui_label_webdav_status() -> &'static str {
771        if is_chinese() {
772            "状态"
773        } else {
774            "Status"
775        }
776    }
777
778    pub fn tui_label_webdav_last_sync() -> &'static str {
779        if is_chinese() {
780            "最近同步"
781        } else {
782            "Last sync"
783        }
784    }
785
786    pub fn tui_webdav_status_not_configured() -> &'static str {
787        if is_chinese() {
788            "未配置"
789        } else {
790            "Not configured"
791        }
792    }
793
794    pub fn tui_webdav_status_configured() -> &'static str {
795        if is_chinese() {
796            "已配置"
797        } else {
798            "Configured"
799        }
800    }
801
802    pub fn tui_webdav_status_never_synced() -> &'static str {
803        if is_chinese() {
804            "从未同步"
805        } else {
806            "Never synced"
807        }
808    }
809
810    pub fn tui_webdav_status_ok() -> &'static str {
811        if is_chinese() {
812            "正常"
813        } else {
814            "OK"
815        }
816    }
817
818    pub fn tui_webdav_status_error() -> &'static str {
819        if is_chinese() {
820            "失败"
821        } else {
822            "Error"
823        }
824    }
825
826    pub fn tui_webdav_status_error_with_detail(detail: &str) -> String {
827        if is_chinese() {
828            format!("失败({detail})")
829        } else {
830            format!("Error ({detail})")
831        }
832    }
833
834    pub fn tui_local_env_not_installed() -> &'static str {
835        if is_chinese() {
836            "未安装或不可执行"
837        } else {
838            "not installed or not executable"
839        }
840    }
841
842    pub fn tui_home_status_online() -> &'static str {
843        if is_chinese() {
844            "在线"
845        } else {
846            "Online"
847        }
848    }
849
850    pub fn tui_home_status_offline() -> &'static str {
851        if is_chinese() {
852            "离线"
853        } else {
854            "Offline"
855        }
856    }
857
858    pub fn tui_proxy_dashboard_status_running() -> &'static str {
859        if is_chinese() {
860            "已启用"
861        } else {
862            "ACTIVE"
863        }
864    }
865
866    pub fn tui_proxy_dashboard_status_stopped() -> &'static str {
867        if is_chinese() {
868            "本地"
869        } else {
870            "LOCAL"
871        }
872    }
873
874    pub fn tui_proxy_dashboard_status_local_only() -> &'static str {
875        if is_chinese() {
876            "仅本地"
877        } else {
878            "LOCAL ONLY"
879        }
880    }
881
882    pub fn tui_proxy_dashboard_status_unsupported() -> &'static str {
883        if is_chinese() {
884            "不支持"
885        } else {
886            "UNSUPPORTED"
887        }
888    }
889
890    pub fn tui_proxy_dashboard_manual_routing_copy(app: &str) -> String {
891        if is_chinese() {
892            format!("手动路由:{app} 的流量会通过 cc-switch。")
893        } else {
894            format!("Manual routing only: traffic goes through cc-switch for {app}.")
895        }
896    }
897
898    pub fn tui_proxy_dashboard_failover_copy() -> &'static str {
899        if is_chinese() {
900            "仅做手动路由,不会自动切换供应商。"
901        } else {
902            "automatic failover stays off; provider changes stay manual."
903        }
904    }
905
906    pub fn tui_proxy_dashboard_cta_start(app: &str) -> String {
907        if is_chinese() {
908            format!("按 P 启动托管代理,并让 {app} 走 cc-switch。")
909        } else {
910            format!("Press P to start the managed proxy and route {app} through cc-switch.")
911        }
912    }
913
914    pub fn tui_proxy_dashboard_cta_stop(app: &str) -> String {
915        if is_chinese() {
916            format!("按 P 恢复 {app} 的 live 配置,并停止托管代理。")
917        } else {
918            format!("Press P to restore {app} to its live config and stop the managed proxy.")
919        }
920    }
921
922    pub fn tui_proxy_loading_title_start() -> &'static str {
923        if is_chinese() {
924            "启动代理中"
925        } else {
926            "Starting proxy"
927        }
928    }
929
930    pub fn tui_proxy_loading_title_stop() -> &'static str {
931        if is_chinese() {
932            "停止代理中"
933        } else {
934            "Stopping proxy"
935        }
936    }
937
938    pub fn tui_proxy_dashboard_running_elsewhere() -> &'static str {
939        if is_chinese() {
940            "代理已在运行。请先停止当前路由,再从这里启动。"
941        } else {
942            "Proxy is already running. Stop the current route before starting it here."
943        }
944    }
945
946    pub fn tui_proxy_dashboard_current_app_on(app: &str) -> String {
947        if is_chinese() {
948            format!("{app} 已接入代理")
949        } else {
950            format!("{app} active")
951        }
952    }
953
954    pub fn tui_proxy_dashboard_current_app_off(app: &str) -> String {
955        if is_chinese() {
956            format!("{app} 本地直连")
957        } else {
958            format!("{app} local")
959        }
960    }
961
962    pub fn tui_proxy_dashboard_unsupported_app(app: &str) -> String {
963        if is_chinese() {
964            format!("{app} 仅本地")
965        } else {
966            format!("{app} local only")
967        }
968    }
969
970    pub fn tui_proxy_dashboard_shared_runtime_ready() -> &'static str {
971        if is_chinese() {
972            "共享 runtime 就绪"
973        } else {
974            "Shared runtime ready"
975        }
976    }
977
978    pub fn tui_proxy_dashboard_no_route_for_app(app: &str) -> String {
979        if is_chinese() {
980            format!("{app} 暂无路由")
981        } else {
982            format!("No route for {app} yet")
983        }
984    }
985
986    pub fn tui_proxy_dashboard_takeover_active() -> &'static str {
987        if is_chinese() {
988            "已接管"
989        } else {
990            "active"
991        }
992    }
993
994    pub fn tui_proxy_dashboard_takeover_inactive() -> &'static str {
995        if is_chinese() {
996            "未接管"
997        } else {
998            "inactive"
999        }
1000    }
1001
1002    pub fn tui_proxy_dashboard_takeover_unsupported() -> &'static str {
1003        if is_chinese() {
1004            "不支持"
1005        } else {
1006            "not supported"
1007        }
1008    }
1009
1010    pub fn tui_proxy_dashboard_uptime_stopped() -> &'static str {
1011        if is_chinese() {
1012            "未运行"
1013        } else {
1014            "--"
1015        }
1016    }
1017
1018    pub fn tui_proxy_dashboard_requests_idle() -> &'static str {
1019        if is_chinese() {
1020            "暂无流量"
1021        } else {
1022            "No traffic yet"
1023        }
1024    }
1025
1026    pub fn tui_proxy_dashboard_tokens_idle() -> &'static str {
1027        if is_chinese() {
1028            "暂无 token 流量"
1029        } else {
1030            "No token traffic yet"
1031        }
1032    }
1033
1034    pub fn tui_proxy_dashboard_target_waiting() -> &'static str {
1035        if is_chinese() {
1036            "等待首个请求"
1037        } else {
1038            "Waiting for first request"
1039        }
1040    }
1041
1042    pub fn tui_proxy_dashboard_request_summary(total: u64, success_rate: f32) -> String {
1043        if is_chinese() {
1044            format!("{total} 总计 / {success_rate:.1}% 成功")
1045        } else {
1046            format!("{total} total / {success_rate:.1}% success")
1047        }
1048    }
1049
1050    pub fn tui_proxy_dashboard_token_summary(output: &str, input: &str) -> String {
1051        if is_chinese() {
1052            format!("{output} 下行 / {input} 上行")
1053        } else {
1054            format!("{output} out / {input} in")
1055        }
1056    }
1057
1058    pub fn tui_label_current_app_takeover() -> &'static str {
1059        if is_chinese() {
1060            "当前应用接管"
1061        } else {
1062            "Current app takeover"
1063        }
1064    }
1065
1066    pub fn tui_label_current_app_route() -> &'static str {
1067        if is_chinese() {
1068            "当前应用路由"
1069        } else {
1070            "Current app route"
1071        }
1072    }
1073
1074    pub fn tui_label_current() -> &'static str {
1075        if is_chinese() {
1076            "当前"
1077        } else {
1078            "Current"
1079        }
1080    }
1081
1082    pub fn tui_provider_none() -> &'static str {
1083        if is_chinese() {
1084            "无"
1085        } else {
1086            "None"
1087        }
1088    }
1089
1090    pub fn tui_label_latest_proxy_route() -> &'static str {
1091        if is_chinese() {
1092            "最近代理路由"
1093        } else {
1094            "Latest proxy route"
1095        }
1096    }
1097
1098    pub fn tui_label_shared_runtime() -> &'static str {
1099        if is_chinese() {
1100            "共享 runtime"
1101        } else {
1102            "Shared runtime"
1103        }
1104    }
1105
1106    pub fn tui_label_listen() -> &'static str {
1107        if is_chinese() {
1108            "监听"
1109        } else {
1110            "Listen"
1111        }
1112    }
1113
1114    pub fn tui_label_uptime() -> &'static str {
1115        if is_chinese() {
1116            "运行时长"
1117        } else {
1118            "Uptime"
1119        }
1120    }
1121
1122    pub fn tui_label_requests() -> &'static str {
1123        if is_chinese() {
1124            "请求"
1125        } else {
1126            "Requests"
1127        }
1128    }
1129
1130    pub fn tui_label_traffic() -> &'static str {
1131        if is_chinese() {
1132            "流量"
1133        } else {
1134            "Traffic"
1135        }
1136    }
1137
1138    pub fn tui_label_proxy_requests() -> &'static str {
1139        if is_chinese() {
1140            "代理总请求"
1141        } else {
1142            "Proxy requests"
1143        }
1144    }
1145
1146    pub fn tui_label_active_target() -> &'static str {
1147        if is_chinese() {
1148            "当前路由目标"
1149        } else {
1150            "Active target"
1151        }
1152    }
1153
1154    pub fn tui_label_last_error() -> &'static str {
1155        if is_chinese() {
1156            "最近错误"
1157        } else {
1158            "Last error"
1159        }
1160    }
1161
1162    pub fn tui_label_last_proxy_error() -> &'static str {
1163        if is_chinese() {
1164            "最近一次代理错误"
1165        } else {
1166            "Last proxy error"
1167        }
1168    }
1169
1170    pub fn tui_label_mcp_servers_active() -> &'static str {
1171        if is_chinese() {
1172            "已启用"
1173        } else {
1174            "Active"
1175        }
1176    }
1177
1178    pub fn tui_na() -> &'static str {
1179        "N/A"
1180    }
1181
1182    pub fn tui_loading() -> &'static str {
1183        if is_chinese() {
1184            "处理中…"
1185        } else {
1186            "Working…"
1187        }
1188    }
1189
1190    pub fn tui_header_quota() -> &'static str {
1191        if is_chinese() {
1192            "额度"
1193        } else {
1194            "Quota"
1195        }
1196    }
1197
1198    pub fn tui_label_quota() -> &'static str {
1199        if is_chinese() {
1200            "额度"
1201        } else {
1202            "Quota"
1203        }
1204    }
1205
1206    pub fn tui_quota_loading() -> &'static str {
1207        if is_chinese() {
1208            "查询中…"
1209        } else {
1210            "checking…"
1211        }
1212    }
1213
1214    pub fn tui_quota_not_available() -> &'static str {
1215        if is_chinese() {
1216            "不可用"
1217        } else {
1218            "not available"
1219        }
1220    }
1221
1222    pub fn tui_quota_parse_error() -> &'static str {
1223        if is_chinese() {
1224            "凭据解析失败"
1225        } else {
1226            "credential parse failed"
1227        }
1228    }
1229
1230    pub fn tui_quota_expired() -> &'static str {
1231        if is_chinese() {
1232            "登录过期"
1233        } else {
1234            "login expired"
1235        }
1236    }
1237
1238    pub fn tui_quota_query_failed() -> &'static str {
1239        if is_chinese() {
1240            "查询失败"
1241        } else {
1242            "query failed"
1243        }
1244    }
1245
1246    pub fn tui_quota_not_queried() -> &'static str {
1247        if is_chinese() {
1248            "未查询"
1249        } else {
1250            "not queried"
1251        }
1252    }
1253
1254    pub fn tui_quota_refresh_hint() -> &'static str {
1255        if is_chinese() {
1256            "按 r 刷新"
1257        } else {
1258            "press r to refresh"
1259        }
1260    }
1261
1262    pub fn tui_quota_ok() -> &'static str {
1263        if is_chinese() {
1264            "已获取"
1265        } else {
1266            "ok"
1267        }
1268    }
1269
1270    pub fn tui_quota_last_checked() -> &'static str {
1271        if is_chinese() {
1272            "更新于"
1273        } else {
1274            "checked"
1275        }
1276    }
1277
1278    pub fn tui_quota_resets_in(time: &str) -> String {
1279        if is_chinese() {
1280            format!("{time} 后重置")
1281        } else {
1282            format!("resets in {time}")
1283        }
1284    }
1285
1286    pub fn tui_quota_just_now() -> &'static str {
1287        if is_chinese() {
1288            "刚刚"
1289        } else {
1290            "just now"
1291        }
1292    }
1293
1294    pub fn tui_quota_minutes_ago(count: i64) -> String {
1295        if is_chinese() {
1296            format!("{count} 分钟前")
1297        } else if count == 1 {
1298            "1 minute ago".to_string()
1299        } else {
1300            format!("{count} minutes ago")
1301        }
1302    }
1303
1304    pub fn tui_quota_hours_ago(count: i64) -> String {
1305        if is_chinese() {
1306            format!("{count} 小时前")
1307        } else if count == 1 {
1308            "1 hour ago".to_string()
1309        } else {
1310            format!("{count} hours ago")
1311        }
1312    }
1313
1314    pub fn tui_quota_days_ago(count: i64) -> String {
1315        if is_chinese() {
1316            format!("{count} 天前")
1317        } else if count == 1 {
1318            "1 day ago".to_string()
1319        } else {
1320            format!("{count} days ago")
1321        }
1322    }
1323
1324    pub fn tui_quota_extra_usage() -> &'static str {
1325        if is_chinese() {
1326            "额外用量"
1327        } else {
1328            "Extra usage"
1329        }
1330    }
1331
1332    pub fn tui_quota_tier_five_hour() -> &'static str {
1333        if is_chinese() {
1334            "5小时"
1335        } else {
1336            "5h"
1337        }
1338    }
1339
1340    pub fn tui_quota_tier_seven_day() -> &'static str {
1341        if is_chinese() {
1342            "7天"
1343        } else {
1344            "7d"
1345        }
1346    }
1347
1348    pub fn tui_quota_tier_seven_day_opus() -> &'static str {
1349        if is_chinese() {
1350            "7天 Opus"
1351        } else {
1352            "7d Opus"
1353        }
1354    }
1355
1356    pub fn tui_quota_tier_seven_day_sonnet() -> &'static str {
1357        if is_chinese() {
1358            "7天 Sonnet"
1359        } else {
1360            "7d Sonnet"
1361        }
1362    }
1363
1364    pub fn tui_quota_tier_weekly_limit() -> &'static str {
1365        if is_chinese() {
1366            "周额度"
1367        } else {
1368            "weekly"
1369        }
1370    }
1371
1372    pub fn tui_quota_tier_premium() -> &'static str {
1373        "premium"
1374    }
1375
1376    pub fn tui_quota_tier_gemini_pro() -> &'static str {
1377        "Gemini Pro"
1378    }
1379
1380    pub fn tui_quota_tier_gemini_flash() -> &'static str {
1381        "Gemini Flash"
1382    }
1383
1384    pub fn tui_quota_tier_gemini_flash_lite() -> &'static str {
1385        "Gemini Flash Lite"
1386    }
1387
1388    pub fn tui_header_id() -> &'static str {
1389        "ID"
1390    }
1391
1392    pub fn tui_header_api_url() -> &'static str {
1393        "API URL"
1394    }
1395
1396    pub fn tui_header_directory() -> &'static str {
1397        if is_chinese() {
1398            "目录"
1399        } else {
1400            "Directory"
1401        }
1402    }
1403
1404    pub fn tui_header_repo() -> &'static str {
1405        if is_chinese() {
1406            "仓库"
1407        } else {
1408            "Repo"
1409        }
1410    }
1411
1412    pub fn tui_header_branch() -> &'static str {
1413        if is_chinese() {
1414            "分支"
1415        } else {
1416            "Branch"
1417        }
1418    }
1419
1420    pub fn tui_header_path() -> &'static str {
1421        if is_chinese() {
1422            "路径"
1423        } else {
1424            "Path"
1425        }
1426    }
1427
1428    pub fn tui_header_found_in() -> &'static str {
1429        if is_chinese() {
1430            "发现于"
1431        } else {
1432            "Found In"
1433        }
1434    }
1435
1436    pub fn tui_header_field() -> &'static str {
1437        if is_chinese() {
1438            "字段"
1439        } else {
1440            "Field"
1441        }
1442    }
1443
1444    pub fn tui_header_value() -> &'static str {
1445        if is_chinese() {
1446            "值"
1447        } else {
1448            "Value"
1449        }
1450    }
1451
1452    pub fn tui_header_claude_short() -> &'static str {
1453        "C"
1454    }
1455
1456    pub fn tui_header_codex_short() -> &'static str {
1457        "X"
1458    }
1459
1460    pub fn tui_header_gemini_short() -> &'static str {
1461        "G"
1462    }
1463
1464    pub fn tui_header_opencode_short() -> &'static str {
1465        "O"
1466    }
1467
1468    pub fn tui_label_id() -> &'static str {
1469        "ID"
1470    }
1471
1472    pub fn tui_label_api_url() -> &'static str {
1473        "API URL"
1474    }
1475
1476    pub fn tui_label_directory() -> &'static str {
1477        if is_chinese() {
1478            "目录"
1479        } else {
1480            "Directory"
1481        }
1482    }
1483
1484    pub fn tui_label_enabled_for() -> &'static str {
1485        if is_chinese() {
1486            "已启用"
1487        } else {
1488            "Enabled"
1489        }
1490    }
1491
1492    pub fn tui_label_repo() -> &'static str {
1493        if is_chinese() {
1494            "仓库"
1495        } else {
1496            "Repo"
1497        }
1498    }
1499
1500    pub fn tui_label_readme() -> &'static str {
1501        if is_chinese() {
1502            "README"
1503        } else {
1504            "README"
1505        }
1506    }
1507
1508    pub fn tui_label_base_url() -> &'static str {
1509        if is_chinese() {
1510            "API 请求地址"
1511        } else {
1512            "Base URL"
1513        }
1514    }
1515
1516    pub fn tui_label_api_key() -> &'static str {
1517        if is_chinese() {
1518            "API Key"
1519        } else {
1520            "API Key"
1521        }
1522    }
1523
1524    pub fn tui_label_claude_api_format() -> &'static str {
1525        if is_chinese() {
1526            "API 格式"
1527        } else {
1528            "API Format"
1529        }
1530    }
1531
1532    pub fn tui_claude_api_format_value(api_format: &str) -> &'static str {
1533        match api_format {
1534            "openai_chat" => {
1535                if is_chinese() {
1536                    "OpenAI Chat Completions (需开启代理)"
1537                } else {
1538                    "OpenAI Chat Completions (Requires proxy)"
1539                }
1540            }
1541            "openai_responses" => {
1542                if is_chinese() {
1543                    "OpenAI Responses API (需开启代理)"
1544                } else {
1545                    "OpenAI Responses API (Requires proxy)"
1546                }
1547            }
1548            _ => {
1549                if is_chinese() {
1550                    "Anthropic Messages (原生)"
1551                } else {
1552                    "Anthropic Messages (Native)"
1553                }
1554            }
1555        }
1556    }
1557
1558    pub fn tui_claude_api_format_requires_proxy_title() -> &'static str {
1559        if is_chinese() {
1560            "需开启代理"
1561        } else {
1562            "Proxy Required"
1563        }
1564    }
1565
1566    pub fn tui_claude_api_format_requires_proxy_message(api_format: &str) -> String {
1567        let label = tui_claude_api_format_value(api_format);
1568        if is_chinese() {
1569            format!("已切换为 {label}。\n该格式需开启本地代理使用。\n请在主页按 P 打开本地代理。")
1570        } else {
1571            format!("Switched to {label}.\nThis format requires the local proxy.\nPress P on the home page to open local proxy.")
1572        }
1573    }
1574
1575    pub fn tui_claude_api_format_popup_title() -> &'static str {
1576        if is_chinese() {
1577            "API 格式"
1578        } else {
1579            "API Format"
1580        }
1581    }
1582
1583    pub fn tui_label_claude_model_config() -> &'static str {
1584        if is_chinese() {
1585            "Claude 模型配置"
1586        } else {
1587            "Claude Model Config"
1588        }
1589    }
1590
1591    pub fn tui_label_claude_hide_attribution() -> &'static str {
1592        if is_chinese() {
1593            "隐藏 AI 署名"
1594        } else {
1595            "Hide AI Attribution"
1596        }
1597    }
1598
1599    pub fn tui_label_provider_package() -> &'static str {
1600        if is_chinese() {
1601            "Provider / npm 包"
1602        } else {
1603            "Provider / npm"
1604        }
1605    }
1606
1607    pub fn tui_label_openclaw_api() -> &'static str {
1608        if is_chinese() {
1609            "API 协议"
1610        } else {
1611            "API Mode"
1612        }
1613    }
1614
1615    pub fn tui_label_openclaw_user_agent() -> &'static str {
1616        if is_chinese() {
1617            "发送 User-Agent"
1618        } else {
1619            "Send User-Agent"
1620        }
1621    }
1622
1623    pub fn tui_label_openclaw_models() -> &'static str {
1624        if is_chinese() {
1625            "模型列表"
1626        } else {
1627            "Models"
1628        }
1629    }
1630
1631    pub fn tui_label_openclaw_status() -> &'static str {
1632        if is_chinese() {
1633            "状态"
1634        } else {
1635            "Status"
1636        }
1637    }
1638
1639    pub fn tui_opencode_config_status_label() -> &'static str {
1640        if is_chinese() {
1641            "OpenCode 配置"
1642        } else {
1643            "OpenCode Config"
1644        }
1645    }
1646
1647    pub fn tui_label_provider_config_status() -> &'static str {
1648        if is_chinese() {
1649            "配置状态"
1650        } else {
1651            "Config Status"
1652        }
1653    }
1654
1655    pub fn tui_provider_config_count(in_config: usize, total: usize) -> String {
1656        if is_chinese() {
1657            format!("{in_config}/{total} 已添加")
1658        } else {
1659            format!("{in_config}/{total} in config")
1660        }
1661    }
1662
1663    pub fn tui_provider_status_in_config() -> &'static str {
1664        if is_chinese() {
1665            "已添加到配置"
1666        } else {
1667            "in config"
1668        }
1669    }
1670
1671    pub fn tui_provider_status_saved_only() -> &'static str {
1672        if is_chinese() {
1673            "仅已保存"
1674        } else {
1675            "saved only"
1676        }
1677    }
1678
1679    pub fn tui_provider_status_untracked() -> &'static str {
1680        if is_chinese() {
1681            "未跟踪"
1682        } else {
1683            "untracked"
1684        }
1685    }
1686
1687    pub fn tui_label_openclaw_model() -> &'static str {
1688        if is_chinese() {
1689            "模型"
1690        } else {
1691            "Model"
1692        }
1693    }
1694
1695    pub fn tui_openclaw_status_default() -> &'static str {
1696        if is_chinese() {
1697            "默认"
1698        } else {
1699            "default"
1700        }
1701    }
1702
1703    pub fn tui_openclaw_status_in_config_and_saved() -> &'static str {
1704        if is_chinese() {
1705            "配置中 + 已保存"
1706        } else {
1707            "in config + saved"
1708        }
1709    }
1710
1711    pub fn tui_openclaw_status_live_only() -> &'static str {
1712        if is_chinese() {
1713            "仅当前配置"
1714        } else {
1715            "live only"
1716        }
1717    }
1718
1719    pub fn tui_openclaw_status_saved_only() -> &'static str {
1720        if is_chinese() {
1721            "仅已保存"
1722        } else {
1723            "saved only"
1724        }
1725    }
1726
1727    pub fn tui_openclaw_status_untracked() -> &'static str {
1728        if is_chinese() {
1729            "未跟踪"
1730        } else {
1731            "untracked"
1732        }
1733    }
1734
1735    pub fn tui_openclaw_models_summary(total: usize) -> String {
1736        if is_chinese() {
1737            if total == 0 {
1738                "未配置模型".to_string()
1739            } else {
1740                format!(
1741                    "{total} 个模型(1 主模型 + {} 回退)",
1742                    total.saturating_sub(1)
1743                )
1744            }
1745        } else if total == 0 {
1746            "No models configured".to_string()
1747        } else {
1748            format!(
1749                "{total} models (1 primary + {} fallbacks)",
1750                total.saturating_sub(1)
1751            )
1752        }
1753    }
1754
1755    pub fn tui_openclaw_models_open_hint() -> &'static str {
1756        if is_chinese() {
1757            "按 Enter 编辑 OpenClaw 模型列表"
1758        } else {
1759            "Press Enter to edit OpenClaw models"
1760        }
1761    }
1762
1763    pub fn tui_openclaw_models_editor_title() -> &'static str {
1764        if is_chinese() {
1765            "OpenClaw 模型列表"
1766        } else {
1767            "OpenClaw Models"
1768        }
1769    }
1770
1771    pub fn tui_toast_json_must_be_array() -> &'static str {
1772        if is_chinese() {
1773            "JSON 必须是数组"
1774        } else {
1775            "JSON must be an array"
1776        }
1777    }
1778
1779    pub fn tui_label_opencode_model_id() -> &'static str {
1780        if is_chinese() {
1781            "主模型 ID"
1782        } else {
1783            "Main Model ID"
1784        }
1785    }
1786
1787    pub fn tui_label_opencode_model_name() -> &'static str {
1788        if is_chinese() {
1789            "主模型名称"
1790        } else {
1791            "Main Model Name"
1792        }
1793    }
1794
1795    pub fn tui_label_context_limit() -> &'static str {
1796        if is_chinese() {
1797            "上下文限制"
1798        } else {
1799            "Context Limit"
1800        }
1801    }
1802
1803    pub fn tui_label_output_limit() -> &'static str {
1804        if is_chinese() {
1805            "输出限制"
1806        } else {
1807            "Output Limit"
1808        }
1809    }
1810
1811    pub fn tui_label_command() -> &'static str {
1812        if is_chinese() {
1813            "命令"
1814        } else {
1815            "Command"
1816        }
1817    }
1818
1819    pub fn tui_label_mcp_type() -> &'static str {
1820        if is_chinese() {
1821            "连接类型"
1822        } else {
1823            "Transport"
1824        }
1825    }
1826
1827    pub fn tui_label_url() -> &'static str {
1828        "URL"
1829    }
1830
1831    pub fn tui_label_args() -> &'static str {
1832        if is_chinese() {
1833            "参数"
1834        } else {
1835            "Args"
1836        }
1837    }
1838
1839    pub fn tui_label_env() -> &'static str {
1840        if is_chinese() {
1841            "环境变量"
1842        } else {
1843            "Env"
1844        }
1845    }
1846
1847    pub fn tui_mcp_env_entry_count(count: usize) -> String {
1848        if is_chinese() {
1849            format!("{count} 项")
1850        } else if count == 1 {
1851            "1 entry".to_string()
1852        } else {
1853            format!("{count} entries")
1854        }
1855    }
1856
1857    pub fn tui_mcp_env_editor_hint() -> &'static str {
1858        if is_chinese() {
1859            "按 Enter 管理环境变量"
1860        } else {
1861            "Press Enter to manage env entries"
1862        }
1863    }
1864
1865    pub fn tui_mcp_type_editor_hint() -> &'static str {
1866        if is_chinese() {
1867            "按 Enter 选择连接类型"
1868        } else {
1869            "Press Enter to choose transport"
1870        }
1871    }
1872
1873    pub fn tui_mcp_env_key_label() -> &'static str {
1874        if is_chinese() {
1875            "键"
1876        } else {
1877            "Key"
1878        }
1879    }
1880
1881    pub fn tui_mcp_env_value_label() -> &'static str {
1882        if is_chinese() {
1883            "值"
1884        } else {
1885            "Value"
1886        }
1887    }
1888
1889    pub fn tui_label_app_claude() -> &'static str {
1890        if is_chinese() {
1891            "应用: Claude"
1892        } else {
1893            "App: Claude"
1894        }
1895    }
1896
1897    pub fn tui_label_app_codex() -> &'static str {
1898        if is_chinese() {
1899            "应用: Codex"
1900        } else {
1901            "App: Codex"
1902        }
1903    }
1904
1905    pub fn tui_label_app_gemini() -> &'static str {
1906        if is_chinese() {
1907            "应用: Gemini"
1908        } else {
1909            "App: Gemini"
1910        }
1911    }
1912
1913    pub fn tui_label_app_opencode() -> &'static str {
1914        if is_chinese() {
1915            "应用: OpenCode"
1916        } else {
1917            "App: OpenCode"
1918        }
1919    }
1920
1921    pub fn tui_label_app_openclaw() -> &'static str {
1922        if is_chinese() {
1923            "应用: OpenClaw"
1924        } else {
1925            "App: OpenClaw"
1926        }
1927    }
1928
1929    pub fn tui_label_app_hermes() -> &'static str {
1930        if is_chinese() {
1931            "应用: Hermes"
1932        } else {
1933            "App: Hermes"
1934        }
1935    }
1936
1937    pub fn tui_form_templates_title() -> &'static str {
1938        if is_chinese() {
1939            "模板"
1940        } else {
1941            "Templates"
1942        }
1943    }
1944
1945    pub fn tui_form_common_config_button() -> &'static str {
1946        if is_chinese() {
1947            "通用配置"
1948        } else {
1949            "Common Config"
1950        }
1951    }
1952
1953    pub fn tui_form_attach_common_config() -> &'static str {
1954        if is_chinese() {
1955            "添加通用配置"
1956        } else {
1957            "Attach Common Config"
1958        }
1959    }
1960
1961    pub fn tui_form_fields_title() -> &'static str {
1962        if is_chinese() {
1963            "字段"
1964        } else {
1965            "Fields"
1966        }
1967    }
1968
1969    pub fn tui_form_json_title() -> &'static str {
1970        "JSON"
1971    }
1972
1973    pub fn tui_codex_auth_json_title() -> &'static str {
1974        if is_chinese() {
1975            "auth.json (JSON) *"
1976        } else {
1977            "auth.json (JSON) *"
1978        }
1979    }
1980
1981    pub fn tui_codex_config_toml_title() -> &'static str {
1982        if is_chinese() {
1983            "config.toml (TOML)"
1984        } else {
1985            "config.toml (TOML)"
1986        }
1987    }
1988
1989    pub fn tui_form_input_title() -> &'static str {
1990        if is_chinese() {
1991            "输入"
1992        } else {
1993            "Input"
1994        }
1995    }
1996
1997    pub fn tui_form_editing_title() -> &'static str {
1998        if is_chinese() {
1999            "编辑中"
2000        } else {
2001            "Editing"
2002        }
2003    }
2004
2005    pub fn tui_claude_model_config_popup_title() -> &'static str {
2006        if is_chinese() {
2007            "Claude 模型配置"
2008        } else {
2009            "Claude Model Configuration"
2010        }
2011    }
2012
2013    pub fn tui_claude_model_main_label() -> &'static str {
2014        if is_chinese() {
2015            "主模型"
2016        } else {
2017            "Main Model"
2018        }
2019    }
2020
2021    pub fn tui_claude_reasoning_model_label() -> &'static str {
2022        if is_chinese() {
2023            "推理模型 (Thinking)"
2024        } else {
2025            "Reasoning Model (Thinking)"
2026        }
2027    }
2028
2029    pub fn tui_claude_default_haiku_model_label() -> &'static str {
2030        if is_chinese() {
2031            "默认 Haiku 模型"
2032        } else {
2033            "Default Haiku Model"
2034        }
2035    }
2036
2037    pub fn tui_claude_default_sonnet_model_label() -> &'static str {
2038        if is_chinese() {
2039            "默认 Sonnet 模型"
2040        } else {
2041            "Default Sonnet Model"
2042        }
2043    }
2044
2045    pub fn tui_claude_default_opus_model_label() -> &'static str {
2046        if is_chinese() {
2047            "默认 Opus 模型"
2048        } else {
2049            "Default Opus Model"
2050        }
2051    }
2052
2053    pub fn tui_claude_model_config_summary(configured_count: usize) -> String {
2054        if is_chinese() {
2055            format!("已配置 {configured_count}/5")
2056        } else {
2057            format!("Configured {configured_count}/5")
2058        }
2059    }
2060
2061    pub fn tui_claude_model_config_open_hint() -> &'static str {
2062        if is_chinese() {
2063            "按 Enter 配置 Claude 模型"
2064        } else {
2065            "Press Enter to configure Claude models"
2066        }
2067    }
2068
2069    pub fn tui_hint_press() -> &'static str {
2070        if is_chinese() {
2071            "按 "
2072        } else {
2073            "Press "
2074        }
2075    }
2076
2077    pub fn tui_hint_auto_fetch_models_from_api() -> &'static str {
2078        if is_chinese() {
2079            " 从 API 自动获取模型。"
2080        } else {
2081            " to auto-fetch models from API."
2082        }
2083    }
2084
2085    pub fn tui_model_fetch_popup_title(fetching: bool) -> String {
2086        if is_chinese() {
2087            if fetching {
2088                "选择模型 (获取中...)".to_string()
2089            } else {
2090                "选择模型".to_string()
2091            }
2092        } else {
2093            if fetching {
2094                "Select Model (Fetching...)".to_string()
2095            } else {
2096                "Select Model".to_string()
2097            }
2098        }
2099    }
2100
2101    pub fn tui_model_fetch_search_placeholder() -> &'static str {
2102        if is_chinese() {
2103            "输入过滤 或 直接回车使用输入值..."
2104        } else {
2105            "Type to filter, or press Enter to use input..."
2106        }
2107    }
2108
2109    pub fn tui_model_fetch_search_title() -> &'static str {
2110        if is_chinese() {
2111            "模型搜索"
2112        } else {
2113            "Model Search"
2114        }
2115    }
2116
2117    pub fn tui_model_fetch_no_models() -> &'static str {
2118        if is_chinese() {
2119            "没有获取到模型 (可直接输入并在此回车)"
2120        } else {
2121            "No models found (type custom and press Enter)"
2122        }
2123    }
2124
2125    pub fn tui_model_fetch_no_matches() -> &'static str {
2126        if is_chinese() {
2127            "没有匹配结果 (可直接输入并在此回车)"
2128        } else {
2129            "No matching models (press Enter to use input)"
2130        }
2131    }
2132
2133    pub fn tui_model_fetch_error_hint(err: &str) -> String {
2134        if is_chinese() {
2135            format!("获取失败: {}", err)
2136        } else {
2137            format!("Fetch failed: {}", err)
2138        }
2139    }
2140
2141    pub fn tui_provider_not_found() -> &'static str {
2142        if is_chinese() {
2143            "未找到该供应商。"
2144        } else {
2145            "Provider not found."
2146        }
2147    }
2148
2149    pub fn tui_provider_title() -> &'static str {
2150        if is_chinese() {
2151            "供应商"
2152        } else {
2153            "Provider"
2154        }
2155    }
2156
2157    pub fn tui_provider_detail_title() -> &'static str {
2158        if is_chinese() {
2159            "供应商详情"
2160        } else {
2161            "Provider Detail"
2162        }
2163    }
2164
2165    pub fn tui_provider_add_title() -> &'static str {
2166        if is_chinese() {
2167            "新增供应商"
2168        } else {
2169            "Add Provider"
2170        }
2171    }
2172
2173    pub fn tui_provider_empty_title() -> &'static str {
2174        if is_chinese() {
2175            "还没有添加任何供应商"
2176        } else {
2177            "No providers have been added yet"
2178        }
2179    }
2180
2181    pub fn tui_provider_empty_subtitle() -> &'static str {
2182        if is_chinese() {
2183            "如果你已有配置,请点击\"导入当前配置\",所有数据将安全保存在 default 供应商中"
2184        } else {
2185            "If you already have a config, use \"Import Current Config\". Everything will be safely stored in the default provider."
2186        }
2187    }
2188
2189    pub fn tui_provider_empty_subtitle_codex() -> &'static str {
2190        if is_chinese() {
2191            "如果你已有 Codex 配置,请点击\"导入当前配置\",程序会读取当前 config.toml 里的所有可识别供应商并合并到 TUI 中"
2192        } else {
2193            "If you already have a Codex config, use \"Import Current Config\". CC-Switch will read every recognizable provider from the current config.toml and merge them into the TUI."
2194        }
2195    }
2196
2197    pub fn tui_key_import_current_config() -> &'static str {
2198        if is_chinese() {
2199            "导入当前配置"
2200        } else {
2201            "import current config"
2202        }
2203    }
2204
2205    pub fn tui_key_add_provider() -> &'static str {
2206        if is_chinese() {
2207            "添加供应商"
2208        } else {
2209            "add provider"
2210        }
2211    }
2212
2213    pub fn tui_codex_official_no_api_key_tip() -> &'static str {
2214        if is_chinese() {
2215            "官方无需填写 API Key,直接保存即可。"
2216        } else {
2217            "Official provider doesn't require an API key. Just save."
2218        }
2219    }
2220
2221    pub fn tui_toast_codex_official_auth_json_disabled() -> &'static str {
2222        if is_chinese() {
2223            "官方模式下不支持编辑 auth.json(切换时会移除)。"
2224        } else {
2225            "auth.json editing is disabled for the official provider (it will be removed on switch)."
2226        }
2227    }
2228
2229    pub fn tui_provider_edit_title(name: &str) -> String {
2230        if is_chinese() {
2231            format!("编辑供应商: {name}")
2232        } else {
2233            format!("Edit Provider: {name}")
2234        }
2235    }
2236
2237    pub fn tui_provider_detail_keys() -> &'static str {
2238        if is_chinese() {
2239            "按键:Space=切换  e=编辑  t=测试"
2240        } else {
2241            "Keys: Space=switch  e=edit  t=test"
2242        }
2243    }
2244
2245    pub fn tui_key_switch() -> &'static str {
2246        if is_chinese() {
2247            "切换"
2248        } else {
2249            "switch"
2250        }
2251    }
2252
2253    pub fn tui_key_add_remove() -> &'static str {
2254        if is_chinese() {
2255            "添加/移除"
2256        } else {
2257            "add/remove"
2258        }
2259    }
2260
2261    pub fn tui_key_set_default() -> &'static str {
2262        if is_chinese() {
2263            "设为默认"
2264        } else {
2265            "set default"
2266        }
2267    }
2268
2269    pub fn tui_key_edit() -> &'static str {
2270        if is_chinese() {
2271            "编辑"
2272        } else {
2273            "edit"
2274        }
2275    }
2276
2277    pub fn tui_key_speedtest() -> &'static str {
2278        if is_chinese() {
2279            "测速"
2280        } else {
2281            "speedtest"
2282        }
2283    }
2284
2285    pub fn tui_key_test() -> &'static str {
2286        if is_chinese() {
2287            "测试"
2288        } else {
2289            "test"
2290        }
2291    }
2292
2293    pub fn tui_key_stream_check() -> &'static str {
2294        if is_chinese() {
2295            "健康检查"
2296        } else {
2297            "stream check"
2298        }
2299    }
2300
2301    pub fn tui_key_launch_temp() -> &'static str {
2302        if is_chinese() {
2303            "临时启动"
2304        } else {
2305            "launch temp"
2306        }
2307    }
2308
2309    pub fn tui_stream_check_status_operational() -> &'static str {
2310        if is_chinese() {
2311            "正常"
2312        } else {
2313            "operational"
2314        }
2315    }
2316
2317    pub fn tui_stream_check_status_degraded() -> &'static str {
2318        if is_chinese() {
2319            "降级"
2320        } else {
2321            "degraded"
2322        }
2323    }
2324
2325    pub fn tui_stream_check_status_failed() -> &'static str {
2326        if is_chinese() {
2327            "失败"
2328        } else {
2329            "failed"
2330        }
2331    }
2332
2333    pub fn tui_key_details() -> &'static str {
2334        if is_chinese() {
2335            "详情"
2336        } else {
2337            "details"
2338        }
2339    }
2340
2341    pub fn tui_key_view() -> &'static str {
2342        if is_chinese() {
2343            "查看"
2344        } else {
2345            "view"
2346        }
2347    }
2348
2349    pub fn tui_key_add() -> &'static str {
2350        if is_chinese() {
2351            "新增"
2352        } else {
2353            "add"
2354        }
2355    }
2356
2357    pub fn tui_key_delete() -> &'static str {
2358        if is_chinese() {
2359            "删除"
2360        } else {
2361            "delete"
2362        }
2363    }
2364
2365    pub fn tui_key_import() -> &'static str {
2366        if is_chinese() {
2367            "导入"
2368        } else {
2369            "import"
2370        }
2371    }
2372
2373    pub fn tui_key_failover() -> &'static str {
2374        if is_chinese() {
2375            "管理故障转移"
2376        } else {
2377            "manage failover"
2378        }
2379    }
2380
2381    pub fn tui_key_install() -> &'static str {
2382        if is_chinese() {
2383            "安装"
2384        } else {
2385            "install"
2386        }
2387    }
2388
2389    pub fn tui_key_uninstall() -> &'static str {
2390        if is_chinese() {
2391            "卸载"
2392        } else {
2393            "uninstall"
2394        }
2395    }
2396
2397    pub fn tui_key_discover() -> &'static str {
2398        if is_chinese() {
2399            "发现"
2400        } else {
2401            "discover"
2402        }
2403    }
2404
2405    pub fn tui_key_unmanaged() -> &'static str {
2406        if is_chinese() {
2407            "已有"
2408        } else {
2409            "existing"
2410        }
2411    }
2412
2413    pub fn tui_key_repos() -> &'static str {
2414        if is_chinese() {
2415            "仓库"
2416        } else {
2417            "repos"
2418        }
2419    }
2420
2421    pub fn tui_key_sync() -> &'static str {
2422        if is_chinese() {
2423            "同步"
2424        } else {
2425            "sync"
2426        }
2427    }
2428
2429    pub fn tui_key_sync_method() -> &'static str {
2430        if is_chinese() {
2431            "同步方式"
2432        } else {
2433            "sync method"
2434        }
2435    }
2436
2437    pub fn tui_key_search() -> &'static str {
2438        if is_chinese() {
2439            "搜索"
2440        } else {
2441            "search"
2442        }
2443    }
2444
2445    pub fn tui_key_refresh() -> &'static str {
2446        if is_chinese() {
2447            "刷新"
2448        } else {
2449            "refresh"
2450        }
2451    }
2452
2453    pub fn tui_key_start_proxy() -> &'static str {
2454        if is_chinese() {
2455            "启动代理"
2456        } else {
2457            "start proxy"
2458        }
2459    }
2460
2461    pub fn tui_key_stop_proxy() -> &'static str {
2462        if is_chinese() {
2463            "停止代理"
2464        } else {
2465            "stop proxy"
2466        }
2467    }
2468
2469    pub fn tui_key_proxy_on() -> &'static str {
2470        if is_chinese() {
2471            "代理开"
2472        } else {
2473            "proxy on"
2474        }
2475    }
2476
2477    pub fn tui_key_proxy_off() -> &'static str {
2478        if is_chinese() {
2479            "代理关"
2480        } else {
2481            "proxy off"
2482        }
2483    }
2484
2485    pub fn tui_key_focus() -> &'static str {
2486        if is_chinese() {
2487            "切换窗口"
2488        } else {
2489            "next pane"
2490        }
2491    }
2492
2493    pub fn tui_key_toggle() -> &'static str {
2494        if is_chinese() {
2495            "启用/禁用"
2496        } else {
2497            "toggle"
2498        }
2499    }
2500
2501    pub fn tui_key_apps() -> &'static str {
2502        if is_chinese() {
2503            "应用"
2504        } else {
2505            "apps"
2506        }
2507    }
2508
2509    pub fn tui_key_activate() -> &'static str {
2510        if is_chinese() {
2511            "激活"
2512        } else {
2513            "activate"
2514        }
2515    }
2516
2517    pub fn tui_key_deactivate() -> &'static str {
2518        if is_chinese() {
2519            "取消激活"
2520        } else {
2521            "deactivate"
2522        }
2523    }
2524
2525    pub fn tui_key_open() -> &'static str {
2526        if is_chinese() {
2527            "打开"
2528        } else {
2529            "open"
2530        }
2531    }
2532
2533    pub fn tui_key_open_directory() -> &'static str {
2534        if is_chinese() {
2535            "打开目录"
2536        } else {
2537            "open dir"
2538        }
2539    }
2540
2541    pub fn tui_key_create() -> &'static str {
2542        if is_chinese() {
2543            "新建"
2544        } else {
2545            "create"
2546        }
2547    }
2548
2549    pub fn tui_key_rename() -> &'static str {
2550        if is_chinese() {
2551            "重命名"
2552        } else {
2553            "rename"
2554        }
2555    }
2556
2557    pub fn tui_key_apply() -> &'static str {
2558        if is_chinese() {
2559            "应用"
2560        } else {
2561            "apply"
2562        }
2563    }
2564
2565    pub fn tui_key_edit_snippet() -> &'static str {
2566        if is_chinese() {
2567            "编辑片段"
2568        } else {
2569            "edit snippet"
2570        }
2571    }
2572
2573    pub fn tui_key_close() -> &'static str {
2574        if is_chinese() {
2575            "关闭"
2576        } else {
2577            "close"
2578        }
2579    }
2580
2581    pub fn tui_key_exit() -> &'static str {
2582        if is_chinese() {
2583            "退出"
2584        } else {
2585            "exit"
2586        }
2587    }
2588
2589    pub fn tui_key_cancel() -> &'static str {
2590        if is_chinese() {
2591            "取消"
2592        } else {
2593            "cancel"
2594        }
2595    }
2596
2597    pub fn tui_key_submit() -> &'static str {
2598        if is_chinese() {
2599            "提交"
2600        } else {
2601            "submit"
2602        }
2603    }
2604
2605    pub fn tui_key_yes() -> &'static str {
2606        if is_chinese() {
2607            "确认"
2608        } else {
2609            "confirm"
2610        }
2611    }
2612
2613    pub fn tui_key_no() -> &'static str {
2614        if is_chinese() {
2615            "返回"
2616        } else {
2617            "back"
2618        }
2619    }
2620
2621    pub fn tui_key_scroll() -> &'static str {
2622        if is_chinese() {
2623            "滚动"
2624        } else {
2625            "scroll"
2626        }
2627    }
2628
2629    pub fn tui_key_restore() -> &'static str {
2630        if is_chinese() {
2631            "恢复"
2632        } else {
2633            "restore"
2634        }
2635    }
2636
2637    pub fn tui_key_takeover() -> &'static str {
2638        if is_chinese() {
2639            "接管"
2640        } else {
2641            "take over"
2642        }
2643    }
2644
2645    pub fn tui_key_save() -> &'static str {
2646        if is_chinese() {
2647            "保存"
2648        } else {
2649            "save"
2650        }
2651    }
2652
2653    pub fn tui_key_external_editor() -> &'static str {
2654        if is_chinese() {
2655            "外部编辑器"
2656        } else {
2657            "external editor"
2658        }
2659    }
2660
2661    pub fn tui_key_save_and_exit() -> &'static str {
2662        if is_chinese() {
2663            "保存并退出"
2664        } else {
2665            "save & exit"
2666        }
2667    }
2668
2669    pub fn tui_key_exit_without_save() -> &'static str {
2670        if is_chinese() {
2671            "不保存退出"
2672        } else {
2673            "exit w/o save"
2674        }
2675    }
2676
2677    pub fn tui_key_edit_mode() -> &'static str {
2678        if is_chinese() {
2679            "编辑"
2680        } else {
2681            "edit"
2682        }
2683    }
2684
2685    pub fn tui_key_clear() -> &'static str {
2686        if is_chinese() {
2687            "清除"
2688        } else {
2689            "clear"
2690        }
2691    }
2692
2693    pub fn tui_key_move() -> &'static str {
2694        if is_chinese() {
2695            "移动"
2696        } else {
2697            "move"
2698        }
2699    }
2700
2701    pub fn tui_key_exit_edit() -> &'static str {
2702        if is_chinese() {
2703            "退出编辑"
2704        } else {
2705            "exit edit"
2706        }
2707    }
2708
2709    pub fn tui_key_select() -> &'static str {
2710        if is_chinese() {
2711            "选择"
2712        } else {
2713            "select"
2714        }
2715    }
2716
2717    pub fn tui_key_edges() -> &'static str {
2718        if is_chinese() {
2719            "首尾"
2720        } else {
2721            "top/end"
2722        }
2723    }
2724
2725    pub fn tui_key_fetch_model() -> &'static str {
2726        if is_chinese() {
2727            "获取模型"
2728        } else {
2729            "fetch model"
2730        }
2731    }
2732
2733    pub fn tui_key_deactivate_active() -> &'static str {
2734        if is_chinese() {
2735            "取消激活(当前)"
2736        } else {
2737            "deactivate active"
2738        }
2739    }
2740
2741    pub fn tui_provider_list_keys() -> &'static str {
2742        if is_chinese() {
2743            "按键:a=新增  e=编辑  Enter=详情  s=切换  /=搜索"
2744        } else {
2745            "Keys: a=add  e=edit  Enter=details  s=switch  /=filter"
2746        }
2747    }
2748
2749    pub fn tui_home_ascii_logo() -> &'static str {
2750        // Same ASCII art across languages.
2751        r#"                                  _  _         _
2752   ___  ___        ___ __      __(_)| |_  ___ | |__
2753  / __|/ __|_____ / __|\ \ /\ / /| || __|/ __|| '_ \
2754 | (__| (__|_____|\__ \ \ V  V / | || |_| (__ | | | |
2755  \___|\___|      |___/  \_/\_/  |_| \__|\___||_| |_|
2756                                                      "#
2757    }
2758
2759    pub fn tui_common_snippet_keys() -> &'static str {
2760        if is_chinese() {
2761            "按键:e=编辑  c=清除  a=应用  Esc=返回"
2762        } else {
2763            "Keys: e=edit  c=clear  a=apply  Esc=back"
2764        }
2765    }
2766
2767    pub fn tui_view_config_app(app: &str) -> String {
2768        if is_chinese() {
2769            format!("应用: {}", app)
2770        } else {
2771            format!("App: {}", app)
2772        }
2773    }
2774
2775    pub fn tui_view_config_provider(provider: &str) -> String {
2776        if is_chinese() {
2777            format!("供应商: {}", provider)
2778        } else {
2779            format!("Provider: {}", provider)
2780        }
2781    }
2782
2783    pub fn tui_view_config_api_url(url: &str) -> String {
2784        if is_chinese() {
2785            format!("API URL:  {}", url)
2786        } else {
2787            format!("API URL:  {}", url)
2788        }
2789    }
2790
2791    pub fn tui_view_config_mcp_servers(enabled: usize, total: usize) -> String {
2792        if is_chinese() {
2793            format!("MCP 服务器: {} 启用 / {} 总数", enabled, total)
2794        } else {
2795            format!("MCP servers: {} enabled / {} total", enabled, total)
2796        }
2797    }
2798
2799    pub fn tui_view_config_prompts(active: &str) -> String {
2800        if is_chinese() {
2801            format!("提示词: {}", active)
2802        } else {
2803            format!("Prompts: {}", active)
2804        }
2805    }
2806
2807    pub fn tui_view_config_config_file(path: &str) -> String {
2808        if is_chinese() {
2809            format!("配置文件: {}", path)
2810        } else {
2811            format!("Config file: {}", path)
2812        }
2813    }
2814
2815    pub fn tui_settings_header_language() -> &'static str {
2816        if is_chinese() {
2817            "语言"
2818        } else {
2819            "Language"
2820        }
2821    }
2822
2823    pub fn tui_settings_header_setting() -> &'static str {
2824        if is_chinese() {
2825            "设置项"
2826        } else {
2827            "Setting"
2828        }
2829    }
2830
2831    pub fn tui_settings_header_value() -> &'static str {
2832        if is_chinese() {
2833            "值"
2834        } else {
2835            "Value"
2836        }
2837    }
2838
2839    pub fn tui_settings_title() -> &'static str {
2840        if is_chinese() {
2841            "设置"
2842        } else {
2843            "Settings"
2844        }
2845    }
2846
2847    pub fn tui_settings_visible_apps_label() -> &'static str {
2848        if is_chinese() {
2849            "可见应用"
2850        } else {
2851            "Visible Apps"
2852        }
2853    }
2854
2855    pub fn tui_settings_visible_apps_title() -> &'static str {
2856        if is_chinese() {
2857            "选择可见应用"
2858        } else {
2859            "Choose Visible Apps"
2860        }
2861    }
2862
2863    pub fn tui_settings_proxy_title() -> &'static str {
2864        if is_chinese() {
2865            "本地代理"
2866        } else {
2867            "Local Proxy"
2868        }
2869    }
2870
2871    pub fn tui_settings_proxy_listen_address_label() -> &'static str {
2872        if is_chinese() {
2873            "监听地址"
2874        } else {
2875            "Listen Address"
2876        }
2877    }
2878
2879    pub fn tui_settings_proxy_listen_port_label() -> &'static str {
2880        if is_chinese() {
2881            "监听端口"
2882        } else {
2883            "Listen Port"
2884        }
2885    }
2886
2887    pub fn tui_settings_proxy_listen_address_prompt() -> &'static str {
2888        if is_chinese() {
2889            "输入监听地址(如 127.0.0.1 / localhost / 0.0.0.0)"
2890        } else {
2891            "Enter listen address (for example 127.0.0.1 / localhost / 0.0.0.0)"
2892        }
2893    }
2894
2895    pub fn tui_settings_proxy_listen_port_prompt() -> &'static str {
2896        if is_chinese() {
2897            "输入监听端口(1024-65535)"
2898        } else {
2899            "Enter listen port (1024-65535)"
2900        }
2901    }
2902
2903    pub fn tui_settings_openclaw_config_dir_label() -> &'static str {
2904        if is_chinese() {
2905            "OpenClaw 配置目录"
2906        } else {
2907            "OpenClaw Config Directory"
2908        }
2909    }
2910
2911    pub fn tui_settings_openclaw_config_dir_prompt() -> &'static str {
2912        if is_chinese() {
2913            "输入 OpenClaw 配置目录;留空恢复默认 ~/.openclaw"
2914        } else {
2915            "Enter the OpenClaw config directory; leave empty to use ~/.openclaw"
2916        }
2917    }
2918
2919    pub fn tui_settings_openclaw_config_dir_default_value() -> &'static str {
2920        "Default (~/.openclaw)"
2921    }
2922
2923    pub fn tui_settings_proxy_restart_hint() -> &'static str {
2924        if is_chinese() {
2925            "修改监听地址或端口后,需先停止并重新开启本地代理才能生效"
2926        } else {
2927            "Changes to listen address or port require stopping and restarting the local proxy"
2928        }
2929    }
2930
2931    pub fn tui_settings_proxy_stop_before_edit_hint() -> &'static str {
2932        if is_chinese() {
2933            "请先停止本地代理,再修改监听地址或端口"
2934        } else {
2935            "Stop the local proxy before editing listen address or port"
2936        }
2937    }
2938
2939    pub fn tui_toast_proxy_listen_address_invalid() -> &'static str {
2940        if is_chinese() {
2941            "地址无效,请输入有效的 IPv4 地址、localhost 或 0.0.0.0"
2942        } else {
2943            "Invalid address. Enter a valid IPv4 address, localhost, or 0.0.0.0"
2944        }
2945    }
2946
2947    pub fn tui_toast_proxy_listen_port_invalid() -> &'static str {
2948        if is_chinese() {
2949            "端口无效,请输入 1024-65535 之间的数字"
2950        } else {
2951            "Invalid port. Enter a number between 1024 and 65535"
2952        }
2953    }
2954
2955    pub fn tui_toast_proxy_settings_saved() -> &'static str {
2956        if is_chinese() {
2957            "本地代理配置已保存。"
2958        } else {
2959            "Local proxy settings saved."
2960        }
2961    }
2962
2963    pub fn tui_toast_proxy_settings_restart_required() -> &'static str {
2964        if is_chinese() {
2965            "本地代理正在运行;新监听地址/端口会在重启代理后生效。"
2966        } else {
2967            "The local proxy is running; the new listen address/port will apply after restart."
2968        }
2969    }
2970
2971    pub fn tui_toast_proxy_settings_stop_before_edit() -> &'static str {
2972        if is_chinese() {
2973            "本地代理正在运行。请先停止代理,再修改监听地址或端口。"
2974        } else {
2975            "The local proxy is running. Stop it before editing listen address or port."
2976        }
2977    }
2978
2979    pub fn tui_toast_openclaw_config_dir_saved() -> &'static str {
2980        if is_chinese() {
2981            "OpenClaw 配置目录已保存。"
2982        } else {
2983            "OpenClaw config directory saved."
2984        }
2985    }
2986
2987    pub fn tui_toast_openclaw_config_dir_sync_skipped() -> &'static str {
2988        if is_chinese() {
2989            "目标 OpenClaw 目录尚未初始化;已保存设置,但暂未同步 live 配置。"
2990        } else {
2991            "The target OpenClaw directory is not initialized yet; the setting was saved but live sync was skipped."
2992        }
2993    }
2994
2995    pub fn tui_toast_openclaw_config_dir_sync_failed(err: &str) -> String {
2996        if is_chinese() {
2997            format!("OpenClaw 配置目录已保存,但同步 live 配置失败: {err}")
2998        } else {
2999            format!("OpenClaw config directory saved, but live sync failed: {err}")
3000        }
3001    }
3002
3003    pub fn tui_toast_visible_apps_zero_selection_warning() -> &'static str {
3004        if is_chinese() {
3005            "至少保留一个可见应用。"
3006        } else {
3007            "Keep at least one app visible."
3008        }
3009    }
3010
3011    pub fn tui_toast_visible_apps_saved() -> &'static str {
3012        if is_chinese() {
3013            "可见应用已保存。"
3014        } else {
3015            "Visible apps saved."
3016        }
3017    }
3018
3019    pub fn tui_config_title() -> &'static str {
3020        if is_chinese() {
3021            "配置"
3022        } else {
3023            "Configuration"
3024        }
3025    }
3026
3027    // ---------------------------------------------------------------------
3028    // Ratatui TUI - Skills
3029    // ---------------------------------------------------------------------
3030
3031    pub fn tui_skills_install_title() -> &'static str {
3032        if is_chinese() {
3033            "安装 Skill"
3034        } else {
3035            "Install Skill"
3036        }
3037    }
3038
3039    pub fn tui_skills_install_prompt() -> &'static str {
3040        if is_chinese() {
3041            "输入技能目录,或完整标识(owner/name:directory):"
3042        } else {
3043            "Enter a skill directory, or a full key (owner/name:directory):"
3044        }
3045    }
3046
3047    pub fn tui_skills_uninstall_title() -> &'static str {
3048        if is_chinese() {
3049            "卸载 Skill"
3050        } else {
3051            "Uninstall Skill"
3052        }
3053    }
3054
3055    pub fn tui_confirm_uninstall_skill_message(name: &str, directory: &str) -> String {
3056        if is_chinese() {
3057            format!("确认卸载 '{name}'({directory})?")
3058        } else {
3059            format!("Uninstall '{name}' ({directory})?")
3060        }
3061    }
3062
3063    pub fn tui_confirm_uninstall_skills_message(count: usize) -> String {
3064        if is_chinese() {
3065            format!("确认卸载选中的 {count} 个 Skill?")
3066        } else {
3067            format!("Uninstall the {count} selected Skills?")
3068        }
3069    }
3070
3071    pub fn tui_skills_discover_title() -> &'static str {
3072        if is_chinese() {
3073            "发现 Skills"
3074        } else {
3075            "Discover Skills"
3076        }
3077    }
3078
3079    pub fn tui_skills_discover_prompt() -> &'static str {
3080        if is_chinese() {
3081            "输入关键词(留空显示全部):"
3082        } else {
3083            "Enter a keyword (leave empty to show all):"
3084        }
3085    }
3086
3087    pub fn tui_skills_discover_query_empty() -> &'static str {
3088        if is_chinese() {
3089            "全部"
3090        } else {
3091            "all"
3092        }
3093    }
3094
3095    pub fn tui_skills_discover_hint() -> &'static str {
3096        if is_chinese() {
3097            "按 f 搜索仓库里的技能,按 r 管理技能仓库。"
3098        } else {
3099            "Press f to search skills from enabled repositories, or r to manage repositories."
3100        }
3101    }
3102
3103    pub fn tui_skills_repos_title() -> &'static str {
3104        if is_chinese() {
3105            "Skill 仓库"
3106        } else {
3107            "Skill Repositories"
3108        }
3109    }
3110
3111    pub fn tui_skills_repos_hint() -> &'static str {
3112        if is_chinese() {
3113            "技能发现会从这里已启用的仓库加载列表。"
3114        } else {
3115            "Skill discovery loads results from the repositories enabled here."
3116        }
3117    }
3118
3119    pub fn tui_skills_repos_empty() -> &'static str {
3120        if is_chinese() {
3121            "未配置任何 Skill 仓库。按 a 添加。"
3122        } else {
3123            "No skill repositories configured. Press a to add."
3124        }
3125    }
3126
3127    pub fn tui_skills_repos_add_title() -> &'static str {
3128        if is_chinese() {
3129            "添加仓库"
3130        } else {
3131            "Add Repository"
3132        }
3133    }
3134
3135    pub fn tui_skills_repos_add_prompt() -> &'static str {
3136        if is_chinese() {
3137            "输入 GitHub 仓库(owner/name,可选 @branch)或完整 URL:"
3138        } else {
3139            "Enter a GitHub repository (owner/name, optional @branch) or a full URL:"
3140        }
3141    }
3142
3143    pub fn tui_skills_repos_remove_title() -> &'static str {
3144        if is_chinese() {
3145            "移除仓库"
3146        } else {
3147            "Remove Repository"
3148        }
3149    }
3150
3151    pub fn tui_confirm_remove_repo_message(owner: &str, name: &str) -> String {
3152        let repo = format!("{owner}/{name}");
3153        if is_chinese() {
3154            format!("确认移除仓库 '{repo}'?")
3155        } else {
3156            format!("Remove repository '{repo}'?")
3157        }
3158    }
3159
3160    pub fn tui_skills_unmanaged_title() -> &'static str {
3161        tui_skills_import_title()
3162    }
3163
3164    pub fn tui_skills_import_title() -> &'static str {
3165        if is_chinese() {
3166            "导入已有技能"
3167        } else {
3168            "Import Existing Skills"
3169        }
3170    }
3171
3172    pub fn tui_skills_agent_import_title() -> &'static str {
3173        if is_chinese() {
3174            "从智能体导入技能"
3175        } else {
3176            "Import Skills from Agent"
3177        }
3178    }
3179
3180    pub fn tui_skills_unmanaged_hint() -> &'static str {
3181        tui_skills_import_description()
3182    }
3183
3184    pub fn tui_skills_import_description() -> &'static str {
3185        if is_chinese() {
3186            "选择要导入到 CC Switch 统一管理的技能。"
3187        } else {
3188            "Select skills to import into CC Switch unified management."
3189        }
3190    }
3191
3192    pub fn tui_skills_agent_import_description() -> &'static str {
3193        if is_chinese() {
3194            "选择要导入到 CC Switch 的智能体技能。"
3195        } else {
3196            "Select agent skills to import into CC Switch."
3197        }
3198    }
3199
3200    pub fn tui_skills_unmanaged_empty() -> &'static str {
3201        if is_chinese() {
3202            "未发现可导入的技能。"
3203        } else {
3204            "No skills to import found."
3205        }
3206    }
3207
3208    pub fn tui_skills_detail_title() -> &'static str {
3209        if is_chinese() {
3210            "Skill 详情"
3211        } else {
3212            "Skill Detail"
3213        }
3214    }
3215
3216    pub fn tui_skill_not_found() -> &'static str {
3217        if is_chinese() {
3218            "未找到该 Skill。"
3219        } else {
3220            "Skill not found."
3221        }
3222    }
3223
3224    pub fn tui_skills_sync_method_label() -> &'static str {
3225        if is_chinese() {
3226            "同步方式"
3227        } else {
3228            "Sync"
3229        }
3230    }
3231
3232    pub fn tui_settings_skill_sync_method_label() -> &'static str {
3233        if is_chinese() {
3234            "技能管理方式"
3235        } else {
3236            "Skill Management"
3237        }
3238    }
3239
3240    pub fn tui_skills_sync_method_title() -> &'static str {
3241        if is_chinese() {
3242            "选择同步方式"
3243        } else {
3244            "Select Sync Method"
3245        }
3246    }
3247
3248    pub fn tui_skills_sync_method_name(method: crate::services::skill::SyncMethod) -> &'static str {
3249        match method {
3250            crate::services::skill::SyncMethod::Auto => {
3251                if is_chinese() {
3252                    "自动(优先使用链接,失败时复制)"
3253                } else {
3254                    "Automatic (prefer links, fall back to copy)"
3255                }
3256            }
3257            crate::services::skill::SyncMethod::Symlink => {
3258                if is_chinese() {
3259                    "仅链接"
3260                } else {
3261                    "Links only"
3262                }
3263            }
3264            crate::services::skill::SyncMethod::Copy => {
3265                if is_chinese() {
3266                    "仅复制"
3267                } else {
3268                    "Copy only"
3269                }
3270            }
3271        }
3272    }
3273
3274    pub fn tui_skills_installed_summary(installed: usize, enabled: usize, app: &str) -> String {
3275        if is_chinese() {
3276            format!("已安装: {installed}   当前应用({app})已启用: {enabled}")
3277        } else {
3278            format!("Installed: {installed}   Enabled for {app}: {enabled}")
3279        }
3280    }
3281
3282    pub fn tui_skills_installed_counts(
3283        claude: usize,
3284        codex: usize,
3285        gemini: usize,
3286        opencode: usize,
3287        openclaw: usize,
3288        hermes: usize,
3289    ) -> String {
3290        if is_chinese() {
3291            format!(
3292                "已安装 · Claude: {claude} · Codex: {codex} · Gemini: {gemini} · OpenCode: {opencode} · OpenClaw: {openclaw} · Hermes: {hermes}"
3293            )
3294        } else {
3295            format!(
3296                "Installed · Claude: {claude} · Codex: {codex} · Gemini: {gemini} · OpenCode: {opencode} · OpenClaw: {openclaw} · Hermes: {hermes}"
3297            )
3298        }
3299    }
3300
3301    pub fn tui_mcp_server_counts(
3302        claude: usize,
3303        codex: usize,
3304        gemini: usize,
3305        opencode: usize,
3306        openclaw: usize,
3307        hermes: usize,
3308    ) -> String {
3309        if is_chinese() {
3310            format!(
3311                "已安装 · Claude: {claude} · Codex: {codex} · Gemini: {gemini} · OpenCode: {opencode} · OpenClaw: {openclaw} · Hermes: {hermes}"
3312            )
3313        } else {
3314            format!(
3315                "Installed · Claude: {claude} · Codex: {codex} · Gemini: {gemini} · OpenCode: {opencode} · OpenClaw: {openclaw} · Hermes: {hermes}"
3316            )
3317        }
3318    }
3319
3320    pub fn tui_mcp_action_import_existing() -> &'static str {
3321        if is_chinese() {
3322            "导入已有"
3323        } else {
3324            "Import Existing"
3325        }
3326    }
3327
3328    pub fn tui_skills_action_import_existing() -> &'static str {
3329        if is_chinese() {
3330            "导入已有"
3331        } else {
3332            "Import Existing"
3333        }
3334    }
3335
3336    pub fn tui_skills_action_import_agent() -> &'static str {
3337        if is_chinese() {
3338            "从智能体导入"
3339        } else {
3340            "Import from Agent"
3341        }
3342    }
3343
3344    pub fn tui_skills_empty_title() -> &'static str {
3345        if is_chinese() {
3346            "暂无已安装的技能"
3347        } else {
3348            "No installed skills"
3349        }
3350    }
3351
3352    pub fn tui_skills_empty_subtitle() -> &'static str {
3353        if is_chinese() {
3354            "从仓库发现并安装技能,或导入已有技能。"
3355        } else {
3356            "Discover and install skills from repositories, or import existing skills."
3357        }
3358    }
3359
3360    pub fn tui_skills_empty_hint() -> &'static str {
3361        if is_chinese() {
3362            "暂无已安装技能。按 f 发现新技能,或按 i 导入已有技能。"
3363        } else {
3364            "No installed skills. Press f to discover skills, or i to import existing skills."
3365        }
3366    }
3367
3368    pub fn tui_config_item_export() -> &'static str {
3369        if is_chinese() {
3370            "导出配置"
3371        } else {
3372            "Export Config"
3373        }
3374    }
3375
3376    pub fn tui_config_item_import() -> &'static str {
3377        if is_chinese() {
3378            "导入配置"
3379        } else {
3380            "Import Config"
3381        }
3382    }
3383
3384    pub fn tui_config_item_backup() -> &'static str {
3385        if is_chinese() {
3386            "备份配置"
3387        } else {
3388            "Backup Config"
3389        }
3390    }
3391
3392    pub fn tui_config_item_restore() -> &'static str {
3393        if is_chinese() {
3394            "恢复配置"
3395        } else {
3396            "Restore Config"
3397        }
3398    }
3399
3400    pub fn tui_config_item_validate() -> &'static str {
3401        if is_chinese() {
3402            "验证配置"
3403        } else {
3404            "Validate Config"
3405        }
3406    }
3407
3408    pub fn tui_config_item_common_snippet() -> &'static str {
3409        if is_chinese() {
3410            "通用配置片段"
3411        } else {
3412            "Common Config Snippet"
3413        }
3414    }
3415
3416    pub fn tui_config_item_proxy() -> &'static str {
3417        if is_chinese() {
3418            "本地代理"
3419        } else {
3420            "Local Proxy"
3421        }
3422    }
3423
3424    pub fn tui_config_item_openclaw_env() -> &'static str {
3425        if is_chinese() {
3426            "环境变量"
3427        } else {
3428            "Env Variables"
3429        }
3430    }
3431
3432    pub fn tui_config_item_openclaw_workspace() -> &'static str {
3433        if is_chinese() {
3434            "Workspace 文件管理"
3435        } else {
3436            "Workspace Files"
3437        }
3438    }
3439
3440    pub fn tui_config_item_openclaw_tools() -> &'static str {
3441        if is_chinese() {
3442            "工具权限"
3443        } else {
3444            "Tool Permissions"
3445        }
3446    }
3447
3448    pub fn tui_config_item_openclaw_agents() -> &'static str {
3449        if is_chinese() {
3450            "Agents 配置"
3451        } else {
3452            "Agents Config"
3453        }
3454    }
3455
3456    pub fn tui_config_item_webdav_sync() -> &'static str {
3457        if is_chinese() {
3458            "WebDAV 同步"
3459        } else {
3460            "WebDAV Sync"
3461        }
3462    }
3463
3464    pub fn tui_config_item_webdav_settings() -> &'static str {
3465        if is_chinese() {
3466            "WebDAV 同步设置(JSON)"
3467        } else {
3468            "WebDAV Sync Settings (JSON)"
3469        }
3470    }
3471
3472    pub fn tui_config_item_webdav_check_connection() -> &'static str {
3473        if is_chinese() {
3474            "WebDAV 检查连接"
3475        } else {
3476            "WebDAV Check Connection"
3477        }
3478    }
3479
3480    pub fn tui_config_item_webdav_upload() -> &'static str {
3481        if is_chinese() {
3482            "WebDAV 上传到远端"
3483        } else {
3484            "WebDAV Upload to Remote"
3485        }
3486    }
3487
3488    pub fn tui_config_item_webdav_download() -> &'static str {
3489        if is_chinese() {
3490            "WebDAV 下载到本地"
3491        } else {
3492            "WebDAV Download to Local"
3493        }
3494    }
3495
3496    pub fn tui_config_item_webdav_reset() -> &'static str {
3497        if is_chinese() {
3498            "重置 WebDAV 配置"
3499        } else {
3500            "Reset WebDAV Settings"
3501        }
3502    }
3503
3504    pub fn tui_config_item_webdav_jianguoyun_quick_setup() -> &'static str {
3505        if is_chinese() {
3506            "坚果云一键配置"
3507        } else {
3508            "Jianguoyun Quick Setup"
3509        }
3510    }
3511
3512    pub fn tui_webdav_settings_editor_title() -> &'static str {
3513        if is_chinese() {
3514            "编辑 WebDAV 同步设置(JSON)"
3515        } else {
3516            "Edit WebDAV Sync Settings (JSON)"
3517        }
3518    }
3519
3520    pub fn tui_config_webdav_title() -> &'static str {
3521        if is_chinese() {
3522            "WebDAV 同步"
3523        } else {
3524            "WebDAV Sync"
3525        }
3526    }
3527
3528    pub fn tui_openclaw_config_env_title() -> &'static str {
3529        tui_config_item_openclaw_env()
3530    }
3531
3532    pub fn tui_openclaw_workspace_title() -> &'static str {
3533        tui_config_item_openclaw_workspace()
3534    }
3535
3536    pub fn tui_openclaw_workspace_files_block_title() -> &'static str {
3537        if is_chinese() {
3538            "Workspace 文件"
3539        } else {
3540            "Workspace Files"
3541        }
3542    }
3543
3544    pub fn tui_openclaw_workspace_directory_label() -> &'static str {
3545        if is_chinese() {
3546            "工作区目录"
3547        } else {
3548            "Workspace directory"
3549        }
3550    }
3551
3552    pub fn tui_openclaw_workspace_daily_memory_label() -> &'static str {
3553        if is_chinese() {
3554            "Daily Memory"
3555        } else {
3556            "Daily Memory"
3557        }
3558    }
3559
3560    pub fn tui_openclaw_workspace_daily_memory_count(count: usize) -> String {
3561        if is_chinese() {
3562            format!("{count} 个文件")
3563        } else if count == 1 {
3564            "1 file".to_string()
3565        } else {
3566            format!("{count} files")
3567        }
3568    }
3569
3570    pub fn tui_openclaw_workspace_status_exists() -> &'static str {
3571        if is_chinese() {
3572            "已存在"
3573        } else {
3574            "Exists"
3575        }
3576    }
3577
3578    pub fn tui_openclaw_workspace_status_missing() -> &'static str {
3579        if is_chinese() {
3580            "缺失"
3581        } else {
3582            "Missing"
3583        }
3584    }
3585
3586    pub fn tui_openclaw_config_tools_title() -> &'static str {
3587        tui_config_item_openclaw_tools()
3588    }
3589
3590    pub fn tui_openclaw_tools_description() -> &'static str {
3591        if is_chinese() {
3592            "管理 openclaw.json 中的工具权限配置(允许/拒绝列表)"
3593        } else {
3594            "Manage tool permissions in openclaw.json (allow/deny lists)"
3595        }
3596    }
3597
3598    pub fn tui_openclaw_tools_profile_block_title() -> &'static str {
3599        if is_chinese() {
3600            "权限档位"
3601        } else {
3602            "Permission Profile"
3603        }
3604    }
3605
3606    pub fn tui_openclaw_tools_rules_block_title() -> &'static str {
3607        if is_chinese() {
3608            "规则列表"
3609        } else {
3610            "Rule Lists"
3611        }
3612    }
3613
3614    pub fn tui_openclaw_tools_profile_label() -> &'static str {
3615        if is_chinese() {
3616            "配置档位"
3617        } else {
3618            "Profile"
3619        }
3620    }
3621
3622    pub fn tui_openclaw_tools_profile_unset() -> &'static str {
3623        if is_chinese() {
3624            "未设置"
3625        } else {
3626            "Not set"
3627        }
3628    }
3629
3630    pub fn tui_openclaw_tools_profile_minimal() -> &'static str {
3631        if is_chinese() {
3632            "最小权限"
3633        } else {
3634            "Minimal"
3635        }
3636    }
3637
3638    pub fn tui_openclaw_tools_profile_coding() -> &'static str {
3639        if is_chinese() {
3640            "编码"
3641        } else {
3642            "Coding"
3643        }
3644    }
3645
3646    pub fn tui_openclaw_tools_profile_messaging() -> &'static str {
3647        if is_chinese() {
3648            "对话"
3649        } else {
3650            "Messaging"
3651        }
3652    }
3653
3654    pub fn tui_openclaw_tools_profile_full() -> &'static str {
3655        if is_chinese() {
3656            "完全访问"
3657        } else {
3658            "Full"
3659        }
3660    }
3661
3662    pub fn tui_openclaw_tools_unsupported_profile_title() -> &'static str {
3663        if is_chinese() {
3664            "检测到不受支持的工具配置"
3665        } else {
3666            "Unsupported tools profile detected"
3667        }
3668    }
3669
3670    pub fn tui_openclaw_tools_unsupported_profile_description(value: &str) -> String {
3671        if is_chinese() {
3672            format!(
3673                "当前 tools.profile 的值“{value}”不在 OpenClaw 支持列表内。在你手动选择新值之前,它会被保留。"
3674            )
3675        } else {
3676            format!(
3677                "The current tools.profile value '{value}' is not in the supported OpenClaw list. It will be preserved until you choose a new value."
3678            )
3679        }
3680    }
3681
3682    pub fn tui_openclaw_tools_unsupported_profile_label() -> &'static str {
3683        if is_chinese() {
3684            "不受支持"
3685        } else {
3686            "unsupported"
3687        }
3688    }
3689
3690    pub fn tui_openclaw_tools_allow_list_label() -> &'static str {
3691        if is_chinese() {
3692            "允许列表"
3693        } else {
3694            "Allow List"
3695        }
3696    }
3697
3698    pub fn tui_openclaw_tools_deny_list_label() -> &'static str {
3699        if is_chinese() {
3700            "拒绝列表"
3701        } else {
3702            "Deny List"
3703        }
3704    }
3705
3706    pub fn tui_openclaw_tools_pattern_placeholder() -> &'static str {
3707        if is_chinese() {
3708            "工具名称或模式"
3709        } else {
3710            "Tool name or pattern"
3711        }
3712    }
3713
3714    pub fn tui_openclaw_tools_add_allow_rule() -> &'static str {
3715        if is_chinese() {
3716            "+ 添加允许规则"
3717        } else {
3718            "+ Add allow rule"
3719        }
3720    }
3721
3722    pub fn tui_openclaw_tools_add_deny_rule() -> &'static str {
3723        if is_chinese() {
3724            "+ 添加拒绝规则"
3725        } else {
3726            "+ Add deny rule"
3727        }
3728    }
3729
3730    pub fn tui_openclaw_tools_extra_fields_label() -> &'static str {
3731        if is_chinese() {
3732            "保留的其他字段"
3733        } else {
3734            "Preserved extra fields"
3735        }
3736    }
3737
3738    pub fn tui_openclaw_tools_save_label() -> &'static str {
3739        if is_chinese() {
3740            "保存"
3741        } else {
3742            "Save"
3743        }
3744    }
3745
3746    pub fn tui_openclaw_tools_load_failed_message() -> &'static str {
3747        if is_chinese() {
3748            "当前 tools 配置无法加载;请先修复上方解析警告,再编辑工具权限。"
3749        } else {
3750            "The current tools section could not be loaded. Fix the parse warning above before editing tool permissions."
3751        }
3752    }
3753
3754    pub fn tui_toast_openclaw_tools_save_result(success: bool) -> &'static str {
3755        if success {
3756            if is_chinese() {
3757                "工具权限已保存"
3758            } else {
3759                "Tool permissions saved"
3760            }
3761        } else if is_chinese() {
3762            "保存工具权限失败"
3763        } else {
3764            "Failed to save tool permissions"
3765        }
3766    }
3767
3768    pub fn tui_toast_openclaw_tools_save_failed_detail(err: &str) -> String {
3769        if is_chinese() {
3770            format!("保存工具权限失败: {err}")
3771        } else {
3772            format!("Failed to save tool permissions: {err}")
3773        }
3774    }
3775
3776    pub fn tui_toast_openclaw_tools_save_blocked_parse_error() -> &'static str {
3777        if is_chinese() {
3778            "请先修复 OpenClaw 工具配置解析警告,再保存工具权限"
3779        } else {
3780            "Fix OpenClaw tools parse warnings before saving tool permissions"
3781        }
3782    }
3783
3784    pub fn tui_toast_openclaw_tools_rule_empty() -> &'static str {
3785        if is_chinese() {
3786            "工具规则不能为空"
3787        } else {
3788            "Tool rule cannot be empty"
3789        }
3790    }
3791
3792    pub fn tui_openclaw_agents_description() -> &'static str {
3793        if is_chinese() {
3794            "管理 openclaw.json 中的 agents.defaults 配置(默认模型、运行参数等)"
3795        } else {
3796            "Manage agents.defaults in openclaw.json (default model, runtime parameters, etc.)"
3797        }
3798    }
3799
3800    pub fn tui_openclaw_agents_model_section() -> &'static str {
3801        if is_chinese() {
3802            "模型配置"
3803        } else {
3804            "Model Configuration"
3805        }
3806    }
3807
3808    pub fn tui_openclaw_agents_primary_model() -> &'static str {
3809        if is_chinese() {
3810            "默认模型"
3811        } else {
3812            "Default Model"
3813        }
3814    }
3815
3816    pub fn tui_openclaw_agents_not_set() -> &'static str {
3817        if is_chinese() {
3818            "未设置"
3819        } else {
3820            "Not set"
3821        }
3822    }
3823
3824    pub fn tui_openclaw_agents_fallback_models() -> &'static str {
3825        if is_chinese() {
3826            "回退模型"
3827        } else {
3828            "Fallback Models"
3829        }
3830    }
3831
3832    pub fn tui_openclaw_agents_add_fallback() -> &'static str {
3833        if is_chinese() {
3834            "添加回退模型"
3835        } else {
3836            "Add fallback model"
3837        }
3838    }
3839
3840    pub fn tui_openclaw_agents_add_fallback_disabled() -> &'static str {
3841        if is_chinese() {
3842            "没有可添加的回退模型了"
3843        } else {
3844            "No fallback models available to add"
3845        }
3846    }
3847
3848    pub fn tui_openclaw_agents_not_configured_suffix() -> &'static str {
3849        if is_chinese() {
3850            "供应商未配置"
3851        } else {
3852            "not configured"
3853        }
3854    }
3855
3856    pub fn tui_openclaw_agents_not_in_list(value: &str) -> String {
3857        if is_chinese() {
3858            format!("{value} (供应商未配置)")
3859        } else {
3860            format!("{value} (not configured)")
3861        }
3862    }
3863
3864    pub fn tui_openclaw_agents_runtime_section() -> &'static str {
3865        if is_chinese() {
3866            "运行参数"
3867        } else {
3868            "Runtime Parameters"
3869        }
3870    }
3871
3872    pub fn tui_openclaw_agents_workspace() -> &'static str {
3873        if is_chinese() {
3874            "工作区路径"
3875        } else {
3876            "Workspace Path"
3877        }
3878    }
3879
3880    pub fn tui_openclaw_agents_timeout() -> &'static str {
3881        if is_chinese() {
3882            "超时时间(秒)"
3883        } else {
3884            "Timeout (seconds)"
3885        }
3886    }
3887
3888    pub fn tui_openclaw_agents_context_tokens() -> &'static str {
3889        if is_chinese() {
3890            "上下文 Token 数"
3891        } else {
3892            "Context Tokens"
3893        }
3894    }
3895
3896    pub fn tui_openclaw_agents_max_concurrent() -> &'static str {
3897        if is_chinese() {
3898            "最大并发数"
3899        } else {
3900            "Max Concurrent"
3901        }
3902    }
3903
3904    pub fn tui_openclaw_agents_preserved_non_standard_value(value: &str) -> String {
3905        if is_chinese() {
3906            format!("{value}(已保留的非标准值)")
3907        } else {
3908            format!("{value} (preserved non-standard value)")
3909        }
3910    }
3911
3912    pub fn tui_openclaw_agents_preserved_runtime_notice() -> &'static str {
3913        if is_chinese() {
3914            "非标准运行参数会在你替换它们之前保持原样保存。"
3915        } else {
3916            "Non-standard runtime values are preserved until you replace them."
3917        }
3918    }
3919
3920    pub fn tui_openclaw_agents_preserved_fields_label() -> &'static str {
3921        if is_chinese() {
3922            "保留字段"
3923        } else {
3924            "Preserved Fields"
3925        }
3926    }
3927
3928    pub fn tui_openclaw_agents_legacy_timeout_title() -> &'static str {
3929        if is_chinese() {
3930            "检测到旧版超时字段"
3931        } else {
3932            "Legacy timeout detected"
3933        }
3934    }
3935
3936    pub fn tui_openclaw_agents_legacy_timeout_description() -> &'static str {
3937        if is_chinese() {
3938            "当前配置仍在使用 agents.defaults.timeout。保存本页面时会迁移为 timeoutSeconds。"
3939        } else {
3940            "This config still uses agents.defaults.timeout. Saving here will migrate it to timeoutSeconds."
3941        }
3942    }
3943
3944    pub fn tui_openclaw_agents_legacy_timeout_invalid_description() -> &'static str {
3945        if is_chinese() {
3946            "当前配置仍在使用 agents.defaults.timeout,但该值无法自动迁移。请先改为数字,或清空该字段后再保存。"
3947        } else {
3948            "This config still uses agents.defaults.timeout, but the current value cannot be migrated automatically. Change it to a number or clear the field before saving."
3949        }
3950    }
3951
3952    pub fn tui_openclaw_agents_load_failed_message() -> &'static str {
3953        if is_chinese() {
3954            "当前 agents.defaults 配置无法加载;请先修复上方解析警告,再编辑 Agents 配置。"
3955        } else {
3956            "The current agents.defaults section could not be loaded. Fix the parse warning above before editing agents defaults."
3957        }
3958    }
3959
3960    pub fn tui_openclaw_agents_save_label() -> &'static str {
3961        if is_chinese() {
3962            "保存"
3963        } else {
3964            "Save"
3965        }
3966    }
3967
3968    pub fn tui_toast_openclaw_agents_save_result(success: bool) -> &'static str {
3969        if success {
3970            if is_chinese() {
3971                "Agents 配置已保存"
3972            } else {
3973                "Agents config saved"
3974            }
3975        } else if is_chinese() {
3976            "保存 Agents 配置失败"
3977        } else {
3978            "Failed to save agents config"
3979        }
3980    }
3981
3982    pub fn tui_toast_openclaw_agents_save_failed_detail(err: &str) -> String {
3983        if is_chinese() {
3984            format!("保存 Agents 配置失败: {err}")
3985        } else {
3986            format!("Failed to save agents config: {err}")
3987        }
3988    }
3989
3990    pub fn tui_toast_openclaw_agents_save_blocked_parse_error() -> &'static str {
3991        if is_chinese() {
3992            "请先修复 OpenClaw agents.defaults 解析警告,再保存 Agents 配置"
3993        } else {
3994            "Fix OpenClaw agents parse warnings before saving agents defaults"
3995        }
3996    }
3997
3998    pub fn tui_toast_openclaw_agents_save_blocked_legacy_timeout() -> &'static str {
3999        if is_chinese() {
4000            "请先处理 agents.defaults.timeout,再保存 Agents 配置"
4001        } else {
4002            "Resolve agents.defaults.timeout before saving agents config"
4003        }
4004    }
4005
4006    pub fn tui_openclaw_config_agents_title() -> &'static str {
4007        tui_config_item_openclaw_agents()
4008    }
4009
4010    pub fn tui_openclaw_config_env_editor_title() -> &'static str {
4011        if is_chinese() {
4012            "编辑环境变量 (JSON)"
4013        } else {
4014            "Edit Env Variables (JSON)"
4015        }
4016    }
4017
4018    pub fn tui_openclaw_config_env_description() -> &'static str {
4019        if is_chinese() {
4020            "管理 openclaw.json 中的环境变量映射;保存时会写回 env.vars。"
4021        } else {
4022            "Manage the environment variable map in openclaw.json; saving writes back to env.vars."
4023        }
4024    }
4025
4026    pub fn tui_openclaw_config_env_empty() -> &'static str {
4027        if is_chinese() {
4028            "未配置环境变量"
4029        } else {
4030            "No environment variables configured"
4031        }
4032    }
4033
4034    pub fn tui_openclaw_config_tools_editor_title() -> &'static str {
4035        if is_chinese() {
4036            "编辑工具权限 (JSON)"
4037        } else {
4038            "Edit Tool Permissions (JSON)"
4039        }
4040    }
4041
4042    pub fn tui_openclaw_config_agents_editor_title() -> &'static str {
4043        if is_chinese() {
4044            "编辑 Agents 配置 (JSON)"
4045        } else {
4046            "Edit Agents Config (JSON)"
4047        }
4048    }
4049
4050    pub fn tui_openclaw_config_warning_title() -> &'static str {
4051        if is_chinese() {
4052            "OpenClaw 配置告警"
4053        } else {
4054            "OpenClaw Health Warnings"
4055        }
4056    }
4057
4058    pub fn tui_openclaw_config_file_label() -> &'static str {
4059        if is_chinese() {
4060            "配置文件"
4061        } else {
4062            "Config file"
4063        }
4064    }
4065
4066    pub fn tui_openclaw_config_section_label() -> &'static str {
4067        if is_chinese() {
4068            "当前配置"
4069        } else {
4070            "Section"
4071        }
4072    }
4073
4074    pub fn tui_openclaw_config_warning_state_label() -> &'static str {
4075        if is_chinese() {
4076            "告警状态"
4077        } else {
4078            "Warnings"
4079        }
4080    }
4081
4082    pub fn tui_openclaw_config_warning_present() -> &'static str {
4083        if is_chinese() {
4084            "发现告警"
4085        } else {
4086            "Warnings detected"
4087        }
4088    }
4089
4090    pub fn tui_openclaw_config_warning_clean() -> &'static str {
4091        if is_chinese() {
4092            "正常"
4093        } else {
4094            "Healthy"
4095        }
4096    }
4097
4098    pub fn tui_openclaw_config_path_not_available() -> &'static str {
4099        if is_chinese() {
4100            "不可用"
4101        } else {
4102            "n/a"
4103        }
4104    }
4105
4106    pub fn tui_toast_openclaw_config_saved(section: &str) -> String {
4107        if is_chinese() {
4108            format!("已保存 {section}")
4109        } else {
4110            format!("Saved {section}")
4111        }
4112    }
4113
4114    pub fn tui_openclaw_workspace_editor_title(filename: &str) -> String {
4115        if is_chinese() {
4116            format!("编辑 Workspace 文件: {filename}")
4117        } else {
4118            format!("Edit Workspace File: {filename}")
4119        }
4120    }
4121
4122    pub fn tui_openclaw_workspace_saved(filename: &str) -> String {
4123        if is_chinese() {
4124            format!("已保存 Workspace 文件: {filename}")
4125        } else {
4126            format!("Saved workspace file: {filename}")
4127        }
4128    }
4129
4130    pub fn tui_openclaw_workspace_open_failed(filename: &str, detail: &str) -> String {
4131        if is_chinese() {
4132            format!("打开 Workspace 文件失败 {filename}: {detail}")
4133        } else {
4134            format!("Failed to open workspace file {filename}: {detail}")
4135        }
4136    }
4137
4138    pub fn tui_openclaw_workspace_save_failed(filename: &str, detail: &str) -> String {
4139        if is_chinese() {
4140            format!("保存 Workspace 文件失败 {filename}: {detail}")
4141        } else {
4142            format!("Failed to save workspace file {filename}: {detail}")
4143        }
4144    }
4145
4146    pub fn tui_openclaw_workspace_refresh_failed(detail: &str) -> String {
4147        if is_chinese() {
4148            format!("刷新 Workspace 状态失败: {detail}")
4149        } else {
4150            format!("Failed to refresh workspace state: {detail}")
4151        }
4152    }
4153
4154    pub fn tui_openclaw_workspace_directory_open_failed(detail: &str) -> String {
4155        if is_chinese() {
4156            format!("打开 Workspace 目录失败: {detail}")
4157        } else {
4158            format!("Failed to open workspace directory: {detail}")
4159        }
4160    }
4161
4162    pub fn tui_openclaw_daily_memory_title() -> &'static str {
4163        if is_chinese() {
4164            "Daily Memory"
4165        } else {
4166            "Daily Memory"
4167        }
4168    }
4169
4170    pub fn tui_openclaw_daily_memory_directory_label() -> &'static str {
4171        if is_chinese() {
4172            "Memory 目录"
4173        } else {
4174            "Memory directory"
4175        }
4176    }
4177
4178    pub fn tui_openclaw_daily_memory_create_title() -> &'static str {
4179        if is_chinese() {
4180            "新建 Daily Memory"
4181        } else {
4182            "Create Daily Memory"
4183        }
4184    }
4185
4186    pub fn tui_openclaw_daily_memory_create_prompt() -> &'static str {
4187        if is_chinese() {
4188            "输入文件名(YYYY-MM-DD.md):"
4189        } else {
4190            "Enter a filename (YYYY-MM-DD.md):"
4191        }
4192    }
4193
4194    pub fn tui_openclaw_daily_memory_invalid_filename() -> &'static str {
4195        if is_chinese() {
4196            "文件名无效,请使用 YYYY-MM-DD.md。"
4197        } else {
4198            "Invalid filename. Use YYYY-MM-DD.md."
4199        }
4200    }
4201
4202    pub fn tui_openclaw_daily_memory_editor_title(filename: &str) -> String {
4203        if is_chinese() {
4204            format!("编辑 Daily Memory: {filename}")
4205        } else {
4206            format!("Edit Daily Memory: {filename}")
4207        }
4208    }
4209
4210    pub fn tui_openclaw_daily_memory_saved(filename: &str) -> String {
4211        if is_chinese() {
4212            format!("已保存 Daily Memory: {filename}")
4213        } else {
4214            format!("Saved daily memory: {filename}")
4215        }
4216    }
4217
4218    pub fn tui_openclaw_daily_memory_open_failed(filename: &str, detail: &str) -> String {
4219        if is_chinese() {
4220            format!("打开 Daily Memory 失败 {filename}: {detail}")
4221        } else {
4222            format!("Failed to open daily memory {filename}: {detail}")
4223        }
4224    }
4225
4226    pub fn tui_openclaw_daily_memory_save_failed(filename: &str, detail: &str) -> String {
4227        if is_chinese() {
4228            format!("保存 Daily Memory 失败 {filename}: {detail}")
4229        } else {
4230            format!("Failed to save daily memory {filename}: {detail}")
4231        }
4232    }
4233
4234    pub fn tui_openclaw_daily_memory_deleted(filename: &str) -> String {
4235        if is_chinese() {
4236            format!("已删除 Daily Memory: {filename}")
4237        } else {
4238            format!("Deleted daily memory: {filename}")
4239        }
4240    }
4241
4242    pub fn tui_openclaw_daily_memory_delete_failed(filename: &str, detail: &str) -> String {
4243        if is_chinese() {
4244            format!("删除 Daily Memory 失败 {filename}: {detail}")
4245        } else {
4246            format!("Failed to delete daily memory {filename}: {detail}")
4247        }
4248    }
4249
4250    pub fn tui_openclaw_daily_memory_search_failed(detail: &str) -> String {
4251        if is_chinese() {
4252            format!("搜索 Daily Memory 失败: {detail}")
4253        } else {
4254            format!("Failed to search daily memory: {detail}")
4255        }
4256    }
4257
4258    pub fn tui_openclaw_daily_memory_refresh_failed(detail: &str) -> String {
4259        if is_chinese() {
4260            format!("刷新 Daily Memory 列表失败: {detail}")
4261        } else {
4262            format!("Failed to refresh daily memory list: {detail}")
4263        }
4264    }
4265
4266    pub fn tui_openclaw_daily_memory_delete_title() -> &'static str {
4267        if is_chinese() {
4268            "删除 Daily Memory"
4269        } else {
4270            "Delete Daily Memory"
4271        }
4272    }
4273
4274    pub fn tui_openclaw_daily_memory_delete_message(filename: &str) -> String {
4275        if is_chinese() {
4276            format!("确认删除 {filename}?")
4277        } else {
4278            format!("Delete {filename}?")
4279        }
4280    }
4281
4282    pub fn tui_openclaw_memory_directory_open_failed(detail: &str) -> String {
4283        if is_chinese() {
4284            format!("打开 Memory 目录失败: {detail}")
4285        } else {
4286            format!("Failed to open memory directory: {detail}")
4287        }
4288    }
4289
4290    pub fn tui_openclaw_daily_memory_empty() -> &'static str {
4291        if is_chinese() {
4292            "还没有 Daily Memory 文件。按 a 新建。"
4293        } else {
4294            "No daily memory files yet. Press a to create one."
4295        }
4296    }
4297
4298    pub fn tui_openclaw_daily_memory_search_empty() -> &'static str {
4299        if is_chinese() {
4300            "没有匹配的 Daily Memory 文件。"
4301        } else {
4302            "No matching daily memory files."
4303        }
4304    }
4305
4306    pub fn tui_webdav_jianguoyun_setup_title() -> &'static str {
4307        if is_chinese() {
4308            "坚果云一键配置"
4309        } else {
4310            "Jianguoyun Quick Setup"
4311        }
4312    }
4313
4314    pub fn tui_webdav_jianguoyun_username_prompt() -> &'static str {
4315        if is_chinese() {
4316            "请输入坚果云账号(通常是邮箱):"
4317        } else {
4318            "Enter your Jianguoyun account (usually email):"
4319        }
4320    }
4321
4322    pub fn tui_webdav_jianguoyun_app_password_prompt() -> &'static str {
4323        if is_chinese() {
4324            "请输入坚果云第三方应用密码:"
4325        } else {
4326            "Enter your Jianguoyun app password:"
4327        }
4328    }
4329
4330    pub fn tui_webdav_loading_title_check_connection() -> &'static str {
4331        if is_chinese() {
4332            "WebDAV 检查连接"
4333        } else {
4334            "WebDAV Check Connection"
4335        }
4336    }
4337
4338    pub fn tui_webdav_loading_title_upload() -> &'static str {
4339        if is_chinese() {
4340            "WebDAV 上传"
4341        } else {
4342            "WebDAV Upload"
4343        }
4344    }
4345
4346    pub fn tui_webdav_loading_title_download() -> &'static str {
4347        if is_chinese() {
4348            "WebDAV 下载"
4349        } else {
4350            "WebDAV Download"
4351        }
4352    }
4353
4354    pub fn tui_webdav_loading_title_quick_setup() -> &'static str {
4355        if is_chinese() {
4356            "坚果云一键配置"
4357        } else {
4358            "Jianguoyun Quick Setup"
4359        }
4360    }
4361
4362    pub fn tui_webdav_loading_message() -> &'static str {
4363        if is_chinese() {
4364            "正在处理 WebDAV 请求,请稍候…"
4365        } else {
4366            "Processing WebDAV request, please wait..."
4367        }
4368    }
4369
4370    pub fn tui_config_item_reset() -> &'static str {
4371        if is_chinese() {
4372            "重置配置"
4373        } else {
4374            "Reset Config"
4375        }
4376    }
4377
4378    pub fn tui_config_item_show_full() -> &'static str {
4379        if is_chinese() {
4380            "查看完整配置"
4381        } else {
4382            "Show Full Config"
4383        }
4384    }
4385
4386    pub fn tui_config_item_show_path() -> &'static str {
4387        if is_chinese() {
4388            "显示配置路径"
4389        } else {
4390            "Show Config Path"
4391        }
4392    }
4393
4394    pub fn tui_hint_esc_close() -> &'static str {
4395        if is_chinese() {
4396            "Esc = 关闭"
4397        } else {
4398            "Esc = Close"
4399        }
4400    }
4401
4402    pub fn tui_hint_enter_submit_esc_cancel() -> &'static str {
4403        if is_chinese() {
4404            "Enter = 提交, Esc = 取消"
4405        } else {
4406            "Enter = Submit, Esc = Cancel"
4407        }
4408    }
4409
4410    pub fn tui_hint_enter_restore_esc_cancel() -> &'static str {
4411        if is_chinese() {
4412            "Enter = 恢复, Esc = 取消"
4413        } else {
4414            "Enter = restore, Esc = cancel"
4415        }
4416    }
4417
4418    pub fn tui_backup_picker_title() -> &'static str {
4419        if is_chinese() {
4420            "选择备份(Enter 恢复)"
4421        } else {
4422            "Select Backup (Enter to restore)"
4423        }
4424    }
4425
4426    pub fn tui_speedtest_running(url: &str) -> String {
4427        if is_chinese() {
4428            format!("正在测速: {}", url)
4429        } else {
4430            format!("Running: {}", url)
4431        }
4432    }
4433
4434    pub fn tui_speedtest_title_with_url(url: &str) -> String {
4435        if is_chinese() {
4436            format!("测速: {}", url)
4437        } else {
4438            format!("Speedtest: {}", url)
4439        }
4440    }
4441
4442    pub fn tui_stream_check_running(provider_name: &str) -> String {
4443        if is_chinese() {
4444            format!("正在检查: {}", provider_name)
4445        } else {
4446            format!("Checking: {}", provider_name)
4447        }
4448    }
4449
4450    pub fn tui_stream_check_title_with_provider(provider_name: &str) -> String {
4451        if is_chinese() {
4452            format!("健康检查: {}", provider_name)
4453        } else {
4454            format!("Stream Check: {}", provider_name)
4455        }
4456    }
4457
4458    pub fn tui_toast_provider_already_in_use() -> &'static str {
4459        if is_chinese() {
4460            "已在使用该供应商。"
4461        } else {
4462            "Already using this provider."
4463        }
4464    }
4465
4466    pub fn tui_toast_provider_cannot_delete_current() -> &'static str {
4467        if is_chinese() {
4468            "不能删除当前供应商。"
4469        } else {
4470            "Cannot delete current provider."
4471        }
4472    }
4473
4474    pub fn tui_toast_provider_cannot_remove_default_model() -> &'static str {
4475        if is_chinese() {
4476            "被当前默认模型引用的供应商不能直接从配置中移除。"
4477        } else {
4478            "A provider referenced by the current default model cannot be removed from config directly."
4479        }
4480    }
4481
4482    pub fn tui_toast_provider_default_requires_live_config() -> &'static str {
4483        if is_chinese() {
4484            "请先将该供应商添加到配置中,再设为默认。"
4485        } else {
4486            "Add this provider to config before setting it as default."
4487        }
4488    }
4489
4490    pub fn tui_toast_provider_default_model_missing() -> &'static str {
4491        if is_chinese() {
4492            "该供应商缺少可设为默认的主模型。"
4493        } else {
4494            "This provider has no primary model to set as default."
4495        }
4496    }
4497
4498    pub fn tui_toast_provider_removed_from_config() -> &'static str {
4499        if is_chinese() {
4500            "已从当前 OpenClaw 配置中移除该供应商。"
4501        } else {
4502            "Provider removed from the current OpenClaw config."
4503        }
4504    }
4505
4506    pub fn tui_toast_provider_added_to_app_config(app: &str) -> String {
4507        if is_chinese() {
4508            format!("已将该供应商添加到当前 {app} 配置。")
4509        } else {
4510            format!("Provider added to the current {app} config.")
4511        }
4512    }
4513
4514    pub fn tui_toast_provider_removed_from_app_config(app: &str) -> String {
4515        if is_chinese() {
4516            format!("已从当前 {app} 配置中移除该供应商。")
4517        } else {
4518            format!("Provider removed from the current {app} config.")
4519        }
4520    }
4521
4522    pub fn tui_toast_provider_set_as_default(model: &str) -> String {
4523        if is_chinese() {
4524            format!("已设为默认模型: {}", model)
4525        } else {
4526            format!("Set default model: {}", model)
4527        }
4528    }
4529
4530    pub fn tui_temp_launch_failed(message: &str) -> String {
4531        if is_chinese() {
4532            format!("临时启动失败: {}", message)
4533        } else {
4534            format!("Temporary launch failed: {}", message)
4535        }
4536    }
4537
4538    pub fn tui_confirm_delete_provider_title() -> &'static str {
4539        if is_chinese() {
4540            "删除供应商"
4541        } else {
4542            "Delete Provider"
4543        }
4544    }
4545
4546    pub fn tui_confirm_delete_provider_message(name: &str, id: &str) -> String {
4547        if is_chinese() {
4548            format!("确定删除供应商 '{}' ({})?", name, id)
4549        } else {
4550            format!("Delete provider '{}' ({})?", name, id)
4551        }
4552    }
4553
4554    pub fn tui_mcp_add_title() -> &'static str {
4555        if is_chinese() {
4556            "新增 MCP 服务器"
4557        } else {
4558            "Add MCP Server"
4559        }
4560    }
4561
4562    pub fn tui_mcp_edit_title(name: &str) -> String {
4563        if is_chinese() {
4564            format!("编辑 MCP 服务器: {}", name)
4565        } else {
4566            format!("Edit MCP Server: {}", name)
4567        }
4568    }
4569
4570    pub fn tui_mcp_apps_title(name: &str) -> String {
4571        if is_chinese() {
4572            format!("选择 MCP 应用: {}", name)
4573        } else {
4574            format!("Select MCP Apps: {}", name)
4575        }
4576    }
4577
4578    pub fn tui_mcp_type_title() -> &'static str {
4579        if is_chinese() {
4580            "选择 MCP 连接类型"
4581        } else {
4582            "Select MCP Transport"
4583        }
4584    }
4585
4586    pub fn tui_mcp_env_title() -> &'static str {
4587        if is_chinese() {
4588            "MCP 环境变量"
4589        } else {
4590            "MCP Env"
4591        }
4592    }
4593
4594    pub fn tui_mcp_env_add_entry_title() -> &'static str {
4595        if is_chinese() {
4596            "新增环境变量"
4597        } else {
4598            "Add Env Entry"
4599        }
4600    }
4601
4602    pub fn tui_mcp_env_edit_entry_title() -> &'static str {
4603        if is_chinese() {
4604            "编辑环境变量"
4605        } else {
4606            "Edit Env Entry"
4607        }
4608    }
4609
4610    pub fn tui_mcp_env_empty_state() -> &'static str {
4611        if is_chinese() {
4612            "暂无环境变量,按 a 新增。"
4613        } else {
4614            "No env entries yet. Press a to add one."
4615        }
4616    }
4617
4618    pub fn tui_skill_apps_title(name: &str) -> String {
4619        if is_chinese() {
4620            format!("选择 Skill 应用: {}", name)
4621        } else {
4622            format!("Select Skill Apps: {}", name)
4623        }
4624    }
4625
4626    pub fn tui_skills_batch_selection_name(count: usize) -> String {
4627        if is_chinese() {
4628            format!("已选择 {count} 个 Skill")
4629        } else {
4630            format!("{count} selected Skills")
4631        }
4632    }
4633
4634    pub fn tui_toast_provider_no_api_url() -> &'static str {
4635        if is_chinese() {
4636            "该供应商未配置 API URL。"
4637        } else {
4638            "No API URL configured for this provider."
4639        }
4640    }
4641
4642    pub fn tui_confirm_delete_mcp_title() -> &'static str {
4643        if is_chinese() {
4644            "删除 MCP 服务器"
4645        } else {
4646            "Delete MCP Server"
4647        }
4648    }
4649
4650    pub fn tui_confirm_delete_mcp_message(name: &str, id: &str) -> String {
4651        if is_chinese() {
4652            format!("确定删除 MCP 服务器 '{}' ({})?", name, id)
4653        } else {
4654            format!("Delete MCP server '{}' ({})?", name, id)
4655        }
4656    }
4657
4658    pub fn tui_prompt_title(name: &str) -> String {
4659        if is_chinese() {
4660            format!("提示词: {}", name)
4661        } else {
4662            format!("Prompt: {}", name)
4663        }
4664    }
4665
4666    pub fn tui_prompt_rename_title() -> &'static str {
4667        if is_chinese() {
4668            "重命名提示词"
4669        } else {
4670            "Rename Prompt"
4671        }
4672    }
4673
4674    pub fn tui_prompt_create_title() -> &'static str {
4675        if is_chinese() {
4676            "创建提示词"
4677        } else {
4678            "Create Prompt"
4679        }
4680    }
4681
4682    pub fn tui_prompt_create_prompt() -> &'static str {
4683        if is_chinese() {
4684            "输入提示词名称:"
4685        } else {
4686            "Enter a prompt name:"
4687        }
4688    }
4689
4690    pub fn tui_prompt_rename_prompt() -> &'static str {
4691        if is_chinese() {
4692            "输入新的提示词名称:"
4693        } else {
4694            "Enter a new prompt name:"
4695        }
4696    }
4697
4698    pub fn tui_toast_prompt_no_active_to_deactivate() -> &'static str {
4699        if is_chinese() {
4700            "没有可停用的活动提示词。"
4701        } else {
4702            "No active prompt to deactivate."
4703        }
4704    }
4705
4706    pub fn tui_toast_prompt_cannot_delete_active() -> &'static str {
4707        if is_chinese() {
4708            "不能删除正在启用的提示词。"
4709        } else {
4710            "Cannot delete the active prompt."
4711        }
4712    }
4713
4714    pub fn tui_confirm_delete_prompt_title() -> &'static str {
4715        if is_chinese() {
4716            "删除提示词"
4717        } else {
4718            "Delete Prompt"
4719        }
4720    }
4721
4722    pub fn tui_confirm_delete_prompt_message(name: &str, id: &str) -> String {
4723        if is_chinese() {
4724            format!("确定删除提示词 '{}' ({})?", name, id)
4725        } else {
4726            format!("Delete prompt '{}' ({})?", name, id)
4727        }
4728    }
4729
4730    pub fn tui_toast_prompt_edit_finished() -> &'static str {
4731        if is_chinese() {
4732            "提示词编辑完成"
4733        } else {
4734            "Prompt edit finished"
4735        }
4736    }
4737
4738    pub fn tui_toast_prompt_name_empty() -> &'static str {
4739        if is_chinese() {
4740            "提示词名称不能为空。"
4741        } else {
4742            "Prompt name cannot be empty."
4743        }
4744    }
4745
4746    pub fn tui_toast_prompt_not_found(id: &str) -> String {
4747        if is_chinese() {
4748            format!("未找到提示词:{}", id)
4749        } else {
4750            format!("Prompt not found: {}", id)
4751        }
4752    }
4753
4754    pub fn tui_config_paths_title() -> &'static str {
4755        if is_chinese() {
4756            "配置路径"
4757        } else {
4758            "Configuration Paths"
4759        }
4760    }
4761
4762    pub fn tui_config_paths_config_file(path: &str) -> String {
4763        if is_chinese() {
4764            format!("配置文件: {}", path)
4765        } else {
4766            format!("Config file: {}", path)
4767        }
4768    }
4769
4770    pub fn tui_config_paths_config_dir(path: &str) -> String {
4771        if is_chinese() {
4772            format!("配置目录:  {}", path)
4773        } else {
4774            format!("Config dir:  {}", path)
4775        }
4776    }
4777
4778    pub fn tui_error_failed_to_read_config(e: &str) -> String {
4779        if is_chinese() {
4780            format!("读取配置失败: {e}")
4781        } else {
4782            format!("Failed to read config: {e}")
4783        }
4784    }
4785
4786    pub fn tui_config_export_title() -> &'static str {
4787        if is_chinese() {
4788            "导出配置"
4789        } else {
4790            "Export Configuration"
4791        }
4792    }
4793
4794    pub fn tui_config_export_prompt() -> &'static str {
4795        if is_chinese() {
4796            "导出路径:"
4797        } else {
4798            "Export path:"
4799        }
4800    }
4801
4802    pub fn tui_config_import_title() -> &'static str {
4803        if is_chinese() {
4804            "导入配置"
4805        } else {
4806            "Import Configuration"
4807        }
4808    }
4809
4810    pub fn tui_config_import_prompt() -> &'static str {
4811        if is_chinese() {
4812            "从路径导入:"
4813        } else {
4814            "Import from path:"
4815        }
4816    }
4817
4818    pub fn tui_config_backup_title() -> &'static str {
4819        if is_chinese() {
4820            "备份配置"
4821        } else {
4822            "Backup Configuration"
4823        }
4824    }
4825
4826    pub fn tui_config_backup_prompt() -> &'static str {
4827        if is_chinese() {
4828            "可选名称(留空使用默认值):"
4829        } else {
4830            "Optional name (empty for default):"
4831        }
4832    }
4833
4834    pub fn tui_toast_no_backups_found() -> &'static str {
4835        if is_chinese() {
4836            "未找到备份。"
4837        } else {
4838            "No backups found."
4839        }
4840    }
4841
4842    pub fn tui_error_failed_to_read(e: &str) -> String {
4843        if is_chinese() {
4844            format!("读取失败: {e}")
4845        } else {
4846            format!("Failed to read: {e}")
4847        }
4848    }
4849
4850    pub fn tui_common_snippet_title(app: &str) -> String {
4851        if is_chinese() {
4852            format!("通用片段 ({})", app)
4853        } else {
4854            format!("Common Snippet ({})", app)
4855        }
4856    }
4857
4858    pub fn tui_config_reset_title() -> &'static str {
4859        if is_chinese() {
4860            "重置配置"
4861        } else {
4862            "Reset Configuration"
4863        }
4864    }
4865
4866    pub fn tui_config_reset_message() -> &'static str {
4867        if is_chinese() {
4868            "重置为默认配置?(这将覆盖当前配置)"
4869        } else {
4870            "Reset to default configuration? (This will overwrite your current config)"
4871        }
4872    }
4873
4874    pub fn tui_toast_export_path_empty() -> &'static str {
4875        if is_chinese() {
4876            "导出路径为空。"
4877        } else {
4878            "Export path is empty."
4879        }
4880    }
4881
4882    pub fn tui_toast_import_path_empty() -> &'static str {
4883        if is_chinese() {
4884            "导入路径为空。"
4885        } else {
4886            "Import path is empty."
4887        }
4888    }
4889
4890    pub fn tui_confirm_import_message(path: &str) -> String {
4891        if is_chinese() {
4892            format!("确认从 '{}' 导入?", path)
4893        } else {
4894            format!("Import from '{}'?", path)
4895        }
4896    }
4897
4898    pub fn tui_toast_command_empty() -> &'static str {
4899        if is_chinese() {
4900            "命令为空。"
4901        } else {
4902            "Command is empty."
4903        }
4904    }
4905
4906    pub fn tui_toast_url_empty() -> &'static str {
4907        if is_chinese() {
4908            "URL 为空。"
4909        } else {
4910            "URL is empty."
4911        }
4912    }
4913
4914    pub fn tui_toast_mcp_env_key_empty() -> &'static str {
4915        if is_chinese() {
4916            "环境变量 Key 不能为空。"
4917        } else {
4918            "Env key cannot be empty."
4919        }
4920    }
4921
4922    pub fn tui_toast_mcp_env_duplicate_key(key: &str) -> String {
4923        if is_chinese() {
4924            format!("环境变量 Key '{}' 已存在。", key)
4925        } else {
4926            format!("Env key '{key}' already exists.")
4927        }
4928    }
4929
4930    pub fn tui_confirm_restore_backup_title() -> &'static str {
4931        if is_chinese() {
4932            "恢复备份"
4933        } else {
4934            "Restore Backup"
4935        }
4936    }
4937
4938    pub fn tui_confirm_restore_backup_message(name: &str) -> String {
4939        if is_chinese() {
4940            format!("确认从备份 '{}' 恢复?", name)
4941        } else {
4942            format!("Restore from backup '{}'?", name)
4943        }
4944    }
4945
4946    pub fn tui_speedtest_line_url(url: &str) -> String {
4947        format!("URL: {}", url)
4948    }
4949
4950    pub fn tui_stream_check_line_provider(provider_name: &str) -> String {
4951        if is_chinese() {
4952            format!("供应商: {provider_name}")
4953        } else {
4954            format!("Provider: {provider_name}")
4955        }
4956    }
4957
4958    pub fn tui_stream_check_line_status(status: &str) -> String {
4959        if is_chinese() {
4960            format!("状态:   {status}")
4961        } else {
4962            format!("Status:  {status}")
4963        }
4964    }
4965
4966    pub fn tui_stream_check_line_response_time(response_time: &str) -> String {
4967        if is_chinese() {
4968            format!("耗时:   {response_time}")
4969        } else {
4970            format!("Time:    {response_time}")
4971        }
4972    }
4973
4974    pub fn tui_stream_check_line_http_status(status: &str) -> String {
4975        if is_chinese() {
4976            format!("HTTP:   {status}")
4977        } else {
4978            format!("HTTP:    {status}")
4979        }
4980    }
4981
4982    pub fn tui_stream_check_line_model(model: &str) -> String {
4983        if is_chinese() {
4984            format!("模型:   {model}")
4985        } else {
4986            format!("Model:   {model}")
4987        }
4988    }
4989
4990    pub fn tui_stream_check_line_retries(retries: &str) -> String {
4991        if is_chinese() {
4992            format!("重试:   {retries}")
4993        } else {
4994            format!("Retries: {retries}")
4995        }
4996    }
4997
4998    pub fn tui_stream_check_line_message(message: &str) -> String {
4999        if is_chinese() {
5000            format!("信息:   {message}")
5001        } else {
5002            format!("Message: {message}")
5003        }
5004    }
5005
5006    pub fn tui_speedtest_line_latency(latency: &str) -> String {
5007        if is_chinese() {
5008            format!("延迟:   {latency}")
5009        } else {
5010            format!("Latency: {latency}")
5011        }
5012    }
5013
5014    pub fn tui_speedtest_line_status(status: &str) -> String {
5015        if is_chinese() {
5016            format!("状态:   {status}")
5017        } else {
5018            format!("Status:  {status}")
5019        }
5020    }
5021
5022    pub fn tui_speedtest_line_error(err: &str) -> String {
5023        if is_chinese() {
5024            format!("错误:   {err}")
5025        } else {
5026            format!("Error:   {err}")
5027        }
5028    }
5029
5030    pub fn tui_toast_speedtest_finished() -> &'static str {
5031        if is_chinese() {
5032            "测速完成。"
5033        } else {
5034            "Speedtest finished."
5035        }
5036    }
5037
5038    pub fn tui_toast_speedtest_failed(err: &str) -> String {
5039        if is_chinese() {
5040            format!("测速失败: {err}")
5041        } else {
5042            format!("Speedtest failed: {err}")
5043        }
5044    }
5045
5046    pub fn tui_toast_speedtest_unavailable(err: &str) -> String {
5047        if is_chinese() {
5048            format!("测速不可用: {err}")
5049        } else {
5050            format!("Speedtest unavailable: {err}")
5051        }
5052    }
5053
5054    pub fn tui_toast_speedtest_disabled() -> &'static str {
5055        if is_chinese() {
5056            "本次会话测速不可用。"
5057        } else {
5058            "Speedtest is disabled for this session."
5059        }
5060    }
5061
5062    pub fn tui_toast_local_env_check_unavailable(err: &str) -> String {
5063        if is_chinese() {
5064            format!("本地环境检查不可用: {err}")
5065        } else {
5066            format!("Local environment check unavailable: {err}")
5067        }
5068    }
5069
5070    pub fn tui_toast_local_env_check_disabled() -> &'static str {
5071        if is_chinese() {
5072            "本次会话本地环境检查不可用。"
5073        } else {
5074            "Local environment check is disabled for this session."
5075        }
5076    }
5077
5078    pub fn tui_toast_local_env_check_request_failed(err: &str) -> String {
5079        if is_chinese() {
5080            format!("本地环境检查刷新请求失败: {err}")
5081        } else {
5082            format!("Failed to enqueue local environment check: {err}")
5083        }
5084    }
5085
5086    pub fn tui_toast_speedtest_request_failed(err: &str) -> String {
5087        if is_chinese() {
5088            format!("测速请求失败: {err}")
5089        } else {
5090            format!("Failed to enqueue speedtest: {err}")
5091        }
5092    }
5093
5094    pub fn tui_toast_stream_check_finished() -> &'static str {
5095        if is_chinese() {
5096            "健康检查完成。"
5097        } else {
5098            "Stream check finished."
5099        }
5100    }
5101
5102    pub fn tui_toast_stream_check_failed(err: &str) -> String {
5103        if is_chinese() {
5104            format!("健康检查失败: {err}")
5105        } else {
5106            format!("Stream check failed: {err}")
5107        }
5108    }
5109
5110    pub fn tui_toast_stream_check_unavailable(err: &str) -> String {
5111        if is_chinese() {
5112            format!("健康检查不可用: {err}")
5113        } else {
5114            format!("Stream check unavailable: {err}")
5115        }
5116    }
5117
5118    pub fn tui_toast_stream_check_disabled() -> &'static str {
5119        if is_chinese() {
5120            "本次会话健康检查不可用。"
5121        } else {
5122            "Stream check is disabled for this session."
5123        }
5124    }
5125
5126    pub fn tui_toast_stream_check_request_failed(err: &str) -> String {
5127        if is_chinese() {
5128            format!("健康检查请求失败: {err}")
5129        } else {
5130            format!("Failed to enqueue stream check: {err}")
5131        }
5132    }
5133
5134    pub fn tui_toast_quota_not_available() -> &'static str {
5135        if is_chinese() {
5136            "当前供应商没有官方额度查询。"
5137        } else {
5138            "This provider has no official quota query."
5139        }
5140    }
5141
5142    pub fn tui_toast_quota_worker_unavailable(err: &str) -> String {
5143        if is_chinese() {
5144            format!("额度查询后台任务不可用: {err}")
5145        } else {
5146            format!("Quota worker unavailable: {err}")
5147        }
5148    }
5149
5150    pub fn tui_toast_quota_refresh_started(provider: &str) -> String {
5151        if is_chinese() {
5152            format!("正在刷新额度: {provider}")
5153        } else {
5154            format!("Refreshing quota: {provider}")
5155        }
5156    }
5157
5158    pub fn tui_toast_quota_refresh_finished(provider: &str) -> String {
5159        if is_chinese() {
5160            format!("额度已刷新: {provider}")
5161        } else {
5162            format!("Quota refreshed: {provider}")
5163        }
5164    }
5165
5166    pub fn tui_toast_quota_refresh_failed(err: &str) -> String {
5167        if is_chinese() {
5168            format!("额度刷新失败: {err}")
5169        } else {
5170            format!("Quota refresh failed: {err}")
5171        }
5172    }
5173
5174    pub fn tui_toast_skills_worker_unavailable(err: &str) -> String {
5175        if is_chinese() {
5176            format!("Skills 后台任务不可用: {err}")
5177        } else {
5178            format!("Skills worker unavailable: {err}")
5179        }
5180    }
5181
5182    pub fn tui_toast_webdav_worker_unavailable(err: &str) -> String {
5183        if is_chinese() {
5184            format!("WebDAV 后台任务不可用: {err}")
5185        } else {
5186            format!("WebDAV worker unavailable: {err}")
5187        }
5188    }
5189
5190    pub fn tui_toast_model_fetch_worker_unavailable(err: &str) -> String {
5191        if is_chinese() {
5192            format!("模型获取后台任务不可用: {err}")
5193        } else {
5194            format!("Model fetch worker unavailable: {err}")
5195        }
5196    }
5197
5198    pub fn tui_toast_model_fetch_worker_disabled() -> &'static str {
5199        if is_chinese() {
5200            "本次会话模型获取后台任务不可用。"
5201        } else {
5202            "Model fetch worker is disabled for this session."
5203        }
5204    }
5205
5206    pub fn tui_toast_webdav_worker_disabled() -> &'static str {
5207        if is_chinese() {
5208            "本次会话 WebDAV 后台任务不可用。"
5209        } else {
5210            "WebDAV worker is disabled for this session."
5211        }
5212    }
5213
5214    pub fn tui_error_skills_worker_unavailable() -> &'static str {
5215        if is_chinese() {
5216            "Skills 后台任务不可用。"
5217        } else {
5218            "Skills worker unavailable."
5219        }
5220    }
5221
5222    pub fn tui_toast_skills_discover_finished(count: usize) -> String {
5223        if is_chinese() {
5224            format!("发现完成:{count} 个结果。")
5225        } else {
5226            format!("Discover finished: {count} result(s).")
5227        }
5228    }
5229
5230    pub fn tui_toast_skills_discover_failed(err: &str) -> String {
5231        if is_chinese() {
5232            format!("发现失败: {err}")
5233        } else {
5234            format!("Discover failed: {err}")
5235        }
5236    }
5237
5238    pub fn tui_toast_skill_installed(directory: &str) -> String {
5239        if is_chinese() {
5240            format!("已安装: {directory}")
5241        } else {
5242            format!("Installed: {directory}")
5243        }
5244    }
5245
5246    pub fn tui_toast_skill_install_failed(spec: &str, err: &str) -> String {
5247        if is_chinese() {
5248            format!("安装失败({spec}): {err}")
5249        } else {
5250            format!("Install failed ({spec}): {err}")
5251        }
5252    }
5253
5254    pub fn tui_toast_skill_already_installed() -> &'static str {
5255        if is_chinese() {
5256            "该 Skill 已安装。"
5257        } else {
5258            "Skill already installed."
5259        }
5260    }
5261
5262    pub fn tui_toast_skill_spec_empty() -> &'static str {
5263        if is_chinese() {
5264            "Skill 不能为空。"
5265        } else {
5266            "Skill spec is empty."
5267        }
5268    }
5269
5270    pub fn tui_toast_skill_toggled(directory: &str, enabled: bool) -> String {
5271        if is_chinese() {
5272            format!("{} {directory}", if enabled { "已启用" } else { "已禁用" })
5273        } else {
5274            format!(
5275                "{} {directory}",
5276                if enabled { "Enabled" } else { "Disabled" }
5277            )
5278        }
5279    }
5280
5281    pub fn tui_toast_skills_toggled(count: usize, enabled: bool) -> String {
5282        if is_chinese() {
5283            format!(
5284                "已{} {count} 个 Skill",
5285                if enabled { "启用" } else { "禁用" }
5286            )
5287        } else {
5288            format!(
5289                "{} {count} Skills",
5290                if enabled { "Enabled" } else { "Disabled" }
5291            )
5292        }
5293    }
5294
5295    pub fn tui_toast_skill_uninstalled(directory: &str) -> String {
5296        if is_chinese() {
5297            format!("已卸载: {directory}")
5298        } else {
5299            format!("Uninstalled: {directory}")
5300        }
5301    }
5302
5303    pub fn tui_toast_skills_uninstalled(count: usize) -> String {
5304        if is_chinese() {
5305            format!("已卸载 {count} 个 Skill")
5306        } else {
5307            format!("Uninstalled {count} Skills")
5308        }
5309    }
5310
5311    pub fn tui_toast_skill_apps_updated() -> &'static str {
5312        if is_chinese() {
5313            "Skill 应用已更新。"
5314        } else {
5315            "Skill apps updated."
5316        }
5317    }
5318
5319    pub fn tui_toast_skills_synced() -> &'static str {
5320        if is_chinese() {
5321            "Skills 同步完成。"
5322        } else {
5323            "Skills synced."
5324        }
5325    }
5326
5327    pub fn tui_toast_skills_sync_method_set(method: &str) -> String {
5328        if is_chinese() {
5329            format!("同步方式已设置为:{method}。重新同步后会应用到已有技能。")
5330        } else {
5331            format!("Sync method set to: {method}. Re-sync to apply it to existing skills.")
5332        }
5333    }
5334
5335    pub fn tui_toast_repo_spec_empty() -> &'static str {
5336        if is_chinese() {
5337            "仓库不能为空。"
5338        } else {
5339            "Repository is empty."
5340        }
5341    }
5342
5343    pub fn tui_error_repo_spec_empty() -> &'static str {
5344        if is_chinese() {
5345            "仓库不能为空。"
5346        } else {
5347            "Repository cannot be empty."
5348        }
5349    }
5350
5351    pub fn tui_error_repo_spec_invalid() -> &'static str {
5352        if is_chinese() {
5353            "仓库格式无效。请使用 owner/name 或 https://github.com/owner/name"
5354        } else {
5355            "Invalid repo format. Use owner/name or https://github.com/owner/name"
5356        }
5357    }
5358
5359    pub fn tui_toast_repo_added() -> &'static str {
5360        if is_chinese() {
5361            "仓库已添加。"
5362        } else {
5363            "Repository added."
5364        }
5365    }
5366
5367    pub fn tui_toast_repo_removed() -> &'static str {
5368        if is_chinese() {
5369            "仓库已移除。"
5370        } else {
5371            "Repository removed."
5372        }
5373    }
5374
5375    pub fn tui_toast_repo_toggled(enabled: bool) -> String {
5376        if is_chinese() {
5377            if enabled {
5378                "仓库已启用。".to_string()
5379            } else {
5380                "仓库已禁用。".to_string()
5381            }
5382        } else {
5383            if enabled {
5384                "Repository enabled.".to_string()
5385            } else {
5386                "Repository disabled.".to_string()
5387            }
5388        }
5389    }
5390
5391    pub fn tui_toast_skip_claude_onboarding_toggled(enabled: bool) -> String {
5392        if is_chinese() {
5393            if enabled {
5394                "已跳过 Claude Code 初次安装确认。".to_string()
5395            } else {
5396                "已恢复 Claude Code 初次安装确认。".to_string()
5397            }
5398        } else {
5399            if enabled {
5400                "Claude Code onboarding confirmation will be skipped.".to_string()
5401            } else {
5402                "Claude Code onboarding confirmation restored.".to_string()
5403            }
5404        }
5405    }
5406
5407    pub fn tui_toast_claude_plugin_integration_toggled(enabled: bool) -> String {
5408        if is_chinese() {
5409            if enabled {
5410                "已启用 Claude Code for VSCode 插件联动。".to_string()
5411            } else {
5412                "已关闭 Claude Code for VSCode 插件联动。".to_string()
5413            }
5414        } else {
5415            if enabled {
5416                "Claude Code for VSCode integration enabled.".to_string()
5417            } else {
5418                "Claude Code for VSCode integration disabled.".to_string()
5419            }
5420        }
5421    }
5422
5423    pub fn tui_toast_claude_plugin_sync_failed(err: &str) -> String {
5424        if is_chinese() {
5425            format!("同步 Claude Code for VSCode 插件失败: {err}")
5426        } else {
5427            format!("Failed to sync Claude Code for VSCode integration: {err}")
5428        }
5429    }
5430
5431    pub fn tui_toast_unmanaged_scanned(count: usize) -> String {
5432        if is_chinese() {
5433            format!("扫描完成:发现 {count} 个可导入技能。")
5434        } else {
5435            format!("Scan finished: found {count} skill(s) available to import.")
5436        }
5437    }
5438
5439    pub fn tui_toast_no_unmanaged_selected() -> &'static str {
5440        if is_chinese() {
5441            "请至少选择一个要导入的技能。"
5442        } else {
5443            "Select at least one skill to import."
5444        }
5445    }
5446
5447    pub fn tui_toast_unmanaged_imported(count: usize) -> String {
5448        if is_chinese() {
5449            format!("已导入 {count} 个技能。")
5450        } else {
5451            format!("Imported {count} skill(s).")
5452        }
5453    }
5454
5455    pub fn tui_toast_provider_deleted() -> &'static str {
5456        if is_chinese() {
5457            "供应商已删除。"
5458        } else {
5459            "Provider deleted."
5460        }
5461    }
5462
5463    pub fn tui_toast_provider_add_finished() -> &'static str {
5464        if is_chinese() {
5465            "供应商新增流程已完成。"
5466        } else {
5467            "Provider add flow finished."
5468        }
5469    }
5470
5471    pub fn tui_toast_provider_add_missing_fields() -> &'static str {
5472        if is_chinese() {
5473            "请填写 name,id 会自动生成。"
5474        } else {
5475            "Please fill in name. id will be generated automatically."
5476        }
5477    }
5478
5479    pub fn tui_toast_provider_missing_name() -> &'static str {
5480        if is_chinese() {
5481            "请填写 name,id 会自动生成。"
5482        } else {
5483            "Please fill in name. id will be generated automatically."
5484        }
5485    }
5486
5487    pub fn tui_toast_provider_add_failed() -> &'static str {
5488        if is_chinese() {
5489            "新增供应商失败。"
5490        } else {
5491            "Failed to add provider."
5492        }
5493    }
5494
5495    pub fn tui_toast_provider_edit_finished() -> &'static str {
5496        if is_chinese() {
5497            "供应商编辑流程已完成。"
5498        } else {
5499            "Provider edit flow finished."
5500        }
5501    }
5502
5503    pub fn tui_toast_mcp_updated() -> &'static str {
5504        if is_chinese() {
5505            "MCP 已更新。"
5506        } else {
5507            "MCP updated."
5508        }
5509    }
5510
5511    pub fn tui_toast_mcp_upserted() -> &'static str {
5512        if is_chinese() {
5513            "MCP 服务器已保存。"
5514        } else {
5515            "MCP server saved."
5516        }
5517    }
5518
5519    pub fn tui_toast_mcp_missing_fields() -> &'static str {
5520        if is_chinese() {
5521            "请在 JSON 中填写 id 和 name。"
5522        } else {
5523            "Please fill in id and name in JSON."
5524        }
5525    }
5526
5527    pub fn tui_toast_mcp_server_deleted() -> &'static str {
5528        if is_chinese() {
5529            "MCP 服务器已删除。"
5530        } else {
5531            "MCP server deleted."
5532        }
5533    }
5534
5535    pub fn tui_toast_mcp_server_not_found() -> &'static str {
5536        if is_chinese() {
5537            "未找到 MCP 服务器。"
5538        } else {
5539            "MCP server not found."
5540        }
5541    }
5542
5543    pub fn tui_toast_mcp_imported(count: usize) -> String {
5544        if is_chinese() {
5545            format!("已导入 {count} 个 MCP 服务器。")
5546        } else {
5547            format!("Imported {count} MCP server(s).")
5548        }
5549    }
5550
5551    pub fn tui_toast_live_sync_skipped_uninitialized(app: &str) -> String {
5552        if is_chinese() {
5553            format!(
5554                "未检测到 {app} 客户端本地配置,已跳过写入 live 文件;先运行一次 {app} 初始化后再试。"
5555            )
5556        } else {
5557            format!("Live sync skipped: {app} client not initialized; run it once to initialize, then retry.")
5558        }
5559    }
5560
5561    pub fn tui_toast_mcp_updated_live_sync_skipped(apps: &[&str]) -> String {
5562        let list = if is_chinese() {
5563            apps.join("、")
5564        } else {
5565            apps.join(", ")
5566        };
5567
5568        if is_chinese() {
5569            format!(
5570                "MCP 已更新,但以下客户端未初始化,已跳过写入 live 文件:{list};先运行一次对应客户端初始化后再试。"
5571            )
5572        } else {
5573            format!(
5574                "MCP updated, but live sync skipped for uninitialized client(s): {list}; run them once to initialize, then retry."
5575            )
5576        }
5577    }
5578
5579    pub fn tui_toast_prompt_activated() -> &'static str {
5580        if is_chinese() {
5581            "提示词已启用。"
5582        } else {
5583            "Prompt activated."
5584        }
5585    }
5586
5587    pub fn tui_toast_prompt_deactivated() -> &'static str {
5588        if is_chinese() {
5589            "提示词已停用。"
5590        } else {
5591            "Prompt deactivated."
5592        }
5593    }
5594
5595    pub fn tui_toast_prompt_deleted() -> &'static str {
5596        if is_chinese() {
5597            "提示词已删除。"
5598        } else {
5599            "Prompt deleted."
5600        }
5601    }
5602
5603    pub fn tui_toast_prompt_created() -> &'static str {
5604        if is_chinese() {
5605            "提示词已创建。"
5606        } else {
5607            "Prompt created."
5608        }
5609    }
5610
5611    pub fn tui_toast_prompt_renamed() -> &'static str {
5612        if is_chinese() {
5613            "提示词已重命名。"
5614        } else {
5615            "Prompt renamed."
5616        }
5617    }
5618
5619    pub fn tui_toast_exported_to(path: &str) -> String {
5620        if is_chinese() {
5621            format!("已导出到 {}", path)
5622        } else {
5623            format!("Exported to {}", path)
5624        }
5625    }
5626
5627    pub fn tui_error_import_file_not_found(path: &str) -> String {
5628        if is_chinese() {
5629            format!("导入文件不存在: {}", path)
5630        } else {
5631            format!("Import file not found: {}", path)
5632        }
5633    }
5634
5635    pub fn tui_toast_imported_config() -> &'static str {
5636        if is_chinese() {
5637            "配置已导入。"
5638        } else {
5639            "Imported config."
5640        }
5641    }
5642
5643    pub fn tui_toast_imported_with_backup(backup_id: &str) -> String {
5644        if is_chinese() {
5645            format!("已导入(备份: {backup_id})")
5646        } else {
5647            format!("Imported (backup: {backup_id})")
5648        }
5649    }
5650
5651    pub fn tui_toast_no_config_file_to_backup() -> &'static str {
5652        if is_chinese() {
5653            "没有可备份的配置文件。"
5654        } else {
5655            "No config file to backup."
5656        }
5657    }
5658
5659    pub fn tui_toast_backup_created(id: &str) -> String {
5660        if is_chinese() {
5661            format!("备份已创建: {id}")
5662        } else {
5663            format!("Backup created: {id}")
5664        }
5665    }
5666
5667    pub fn tui_toast_restored_from_backup() -> &'static str {
5668        if is_chinese() {
5669            "已从备份恢复。"
5670        } else {
5671            "Restored from backup."
5672        }
5673    }
5674
5675    pub fn tui_toast_restored_with_pre_backup(pre_backup: &str) -> String {
5676        if is_chinese() {
5677            format!("已恢复(恢复前备份: {pre_backup})")
5678        } else {
5679            format!("Restored (pre-backup: {pre_backup})")
5680        }
5681    }
5682
5683    pub fn tui_toast_webdav_settings_saved() -> &'static str {
5684        if is_chinese() {
5685            "WebDAV 同步设置已保存。"
5686        } else {
5687            "WebDAV sync settings saved."
5688        }
5689    }
5690
5691    pub fn tui_toast_proxy_takeover_requires_running() -> &'static str {
5692        if is_chinese() {
5693            "前台代理未运行,请先启动 `cc-switch proxy serve`。"
5694        } else {
5695            "Foreground proxy is not running. Start `cc-switch proxy serve` first."
5696        }
5697    }
5698
5699    pub fn tui_toast_proxy_takeover_updated(app: &str, enabled: bool) -> String {
5700        if is_chinese() {
5701            if enabled {
5702                format!("已将 {app} 接管到前台代理。")
5703            } else {
5704                format!("已将 {app} 恢复到 live 配置。")
5705            }
5706        } else if enabled {
5707            format!("{app} now uses the foreground proxy.")
5708        } else {
5709            format!("{app} restored to its live config.")
5710        }
5711    }
5712
5713    pub fn tui_toast_proxy_managed_current_app_updated(app: &str, enabled: bool) -> String {
5714        if is_chinese() {
5715            if enabled {
5716                format!("{app} 已走 cc-switch 代理。")
5717            } else {
5718                format!("{app} 已恢复 live 配置。")
5719            }
5720        } else if enabled {
5721            format!("{app} now routes through cc-switch.")
5722        } else {
5723            format!("{app} restored to its live config.")
5724        }
5725    }
5726
5727    pub fn tui_toast_proxy_worker_unavailable(err: &str) -> String {
5728        if is_chinese() {
5729            format!("代理任务不可用:{err}")
5730        } else {
5731            format!("Proxy worker unavailable: {err}")
5732        }
5733    }
5734
5735    pub fn tui_toast_proxy_request_failed(err: &str) -> String {
5736        if is_chinese() {
5737            format!("代理请求发送失败:{err}")
5738        } else {
5739            format!("Proxy request failed: {err}")
5740        }
5741    }
5742
5743    pub fn tui_error_proxy_worker_unavailable() -> &'static str {
5744        if is_chinese() {
5745            "代理任务不可用。"
5746        } else {
5747            "Proxy worker unavailable."
5748        }
5749    }
5750
5751    pub fn tui_toast_webdav_settings_cleared() -> &'static str {
5752        if is_chinese() {
5753            "WebDAV 同步设置已清空。"
5754        } else {
5755            "WebDAV sync settings cleared."
5756        }
5757    }
5758
5759    pub fn tui_toast_webdav_connection_ok() -> &'static str {
5760        if is_chinese() {
5761            "WebDAV 连接检查通过。"
5762        } else {
5763            "WebDAV connection check passed."
5764        }
5765    }
5766
5767    pub fn tui_toast_webdav_upload_ok() -> &'static str {
5768        if is_chinese() {
5769            "WebDAV 上传完成。"
5770        } else {
5771            "WebDAV upload completed."
5772        }
5773    }
5774
5775    pub fn tui_toast_webdav_download_ok() -> &'static str {
5776        if is_chinese() {
5777            "WebDAV 下载完成。"
5778        } else {
5779            "WebDAV download completed."
5780        }
5781    }
5782
5783    pub fn tui_webdav_v1_migration_title() -> &'static str {
5784        if is_chinese() {
5785            "发现旧版同步数据"
5786        } else {
5787            "Legacy sync data detected"
5788        }
5789    }
5790
5791    pub fn tui_webdav_v1_migration_message() -> &'static str {
5792        if is_chinese() {
5793            "远端存在 V1 格式的同步数据,是否迁移到 V2?\n迁移将下载旧数据、应用到本地、重新上传为新格式,并清理旧数据。"
5794        } else {
5795            "V1 sync data found on remote. Migrate to V2?\nThis will download old data, apply locally, re-upload as V2, and clean up V1 data."
5796        }
5797    }
5798
5799    pub fn tui_webdav_loading_title_v1_migration() -> &'static str {
5800        if is_chinese() {
5801            "V1 → V2 迁移"
5802        } else {
5803            "V1 → V2 Migration"
5804        }
5805    }
5806
5807    pub fn tui_toast_webdav_v1_migration_ok() -> &'static str {
5808        if is_chinese() {
5809            "V1 → V2 迁移完成,旧数据已清理。"
5810        } else {
5811            "V1 → V2 migration completed, old data cleaned up."
5812        }
5813    }
5814
5815    pub fn tui_toast_webdav_jianguoyun_configured() -> &'static str {
5816        if is_chinese() {
5817            "坚果云一键配置完成,连接检查通过。"
5818        } else {
5819            "Jianguoyun quick setup completed and connection verified."
5820        }
5821    }
5822
5823    pub fn tui_toast_webdav_username_empty() -> &'static str {
5824        if is_chinese() {
5825            "请输入 WebDAV 用户名。"
5826        } else {
5827            "Please enter a WebDAV username."
5828        }
5829    }
5830
5831    pub fn tui_toast_webdav_password_empty() -> &'static str {
5832        if is_chinese() {
5833            "请输入 WebDAV 第三方应用密码。"
5834        } else {
5835            "Please enter a WebDAV app password."
5836        }
5837    }
5838
5839    pub fn tui_toast_webdav_request_failed(err: &str) -> String {
5840        if is_chinese() {
5841            format!("WebDAV 请求提交失败: {err}")
5842        } else {
5843            format!("Failed to enqueue WebDAV request: {err}")
5844        }
5845    }
5846
5847    pub fn tui_toast_webdav_action_failed(action: &str, err: &str) -> String {
5848        if is_chinese() {
5849            format!("{action} 失败: {err}")
5850        } else {
5851            format!("{action} failed: {err}")
5852        }
5853    }
5854
5855    pub fn tui_toast_webdav_quick_setup_failed(err: &str) -> String {
5856        if is_chinese() {
5857            format!("坚果云一键配置已保存,但连接检查失败: {err}")
5858        } else {
5859            format!("Jianguoyun quick setup was saved, but connection check failed: {err}")
5860        }
5861    }
5862
5863    pub fn tui_toast_config_file_does_not_exist() -> &'static str {
5864        if is_chinese() {
5865            "配置文件不存在。"
5866        } else {
5867            "Config file does not exist."
5868        }
5869    }
5870
5871    pub fn tui_config_validation_title() -> &'static str {
5872        if is_chinese() {
5873            "配置校验"
5874        } else {
5875            "Config Validation"
5876        }
5877    }
5878
5879    pub fn tui_config_validation_failed_title() -> &'static str {
5880        if is_chinese() {
5881            "配置校验失败"
5882        } else {
5883            "Config Validation Failed"
5884        }
5885    }
5886
5887    pub fn tui_config_validation_ok() -> &'static str {
5888        if is_chinese() {
5889            "✓ 配置是有效的 JSON"
5890        } else {
5891            "✓ Configuration is valid JSON"
5892        }
5893    }
5894
5895    pub fn tui_config_validation_provider_count(app: &str, count: usize) -> String {
5896        if is_chinese() {
5897            format!("{app} 供应商:  {count}")
5898        } else {
5899            format!("{app} providers:  {count}")
5900        }
5901    }
5902
5903    pub fn tui_config_validation_mcp_servers(count: usize) -> String {
5904        if is_chinese() {
5905            format!("MCP 服务器:       {count}")
5906        } else {
5907            format!("MCP servers:       {count}")
5908        }
5909    }
5910
5911    pub fn tui_toast_validation_passed() -> &'static str {
5912        if is_chinese() {
5913            "校验通过。"
5914        } else {
5915            "Validation passed."
5916        }
5917    }
5918
5919    pub fn tui_toast_config_reset_to_defaults() -> &'static str {
5920        if is_chinese() {
5921            "配置已重置为默认值。"
5922        } else {
5923            "Config reset to defaults."
5924        }
5925    }
5926
5927    pub fn tui_toast_config_reset_with_backup(backup_id: &str) -> String {
5928        if is_chinese() {
5929            format!("配置已重置(备份: {backup_id})")
5930        } else {
5931            format!("Config reset (backup: {backup_id})")
5932        }
5933    }
5934
5935    pub fn menu_home() -> &'static str {
5936        let (en, zh) = menu_home_variants();
5937        if is_chinese() {
5938            zh
5939        } else {
5940            en
5941        }
5942    }
5943
5944    pub fn menu_home_variants() -> (&'static str, &'static str) {
5945        ("🏠 Home", "🏠 首页")
5946    }
5947
5948    pub fn menu_manage_providers() -> &'static str {
5949        let (en, zh) = menu_manage_providers_variants();
5950        if is_chinese() {
5951            zh
5952        } else {
5953            en
5954        }
5955    }
5956
5957    pub fn menu_manage_providers_variants() -> (&'static str, &'static str) {
5958        ("🔑 Providers", "🔑 供应商")
5959    }
5960
5961    pub fn menu_manage_mcp() -> &'static str {
5962        let (en, zh) = menu_manage_mcp_variants();
5963        if is_chinese() {
5964            zh
5965        } else {
5966            en
5967        }
5968    }
5969
5970    pub fn menu_manage_mcp_variants() -> (&'static str, &'static str) {
5971        ("🔌 MCP Servers", "🔌 MCP 服务器")
5972    }
5973
5974    pub fn menu_manage_prompts() -> &'static str {
5975        let (en, zh) = menu_manage_prompts_variants();
5976        if is_chinese() {
5977            zh
5978        } else {
5979            en
5980        }
5981    }
5982
5983    pub fn menu_manage_prompts_variants() -> (&'static str, &'static str) {
5984        ("💬 Prompts", "💬 提示词")
5985    }
5986
5987    pub fn menu_manage_config() -> &'static str {
5988        let (en, zh) = menu_manage_config_variants();
5989        if is_chinese() {
5990            zh
5991        } else {
5992            en
5993        }
5994    }
5995
5996    pub fn menu_manage_config_variants() -> (&'static str, &'static str) {
5997        ("📋 Configuration", "📋 配置")
5998    }
5999
6000    pub fn menu_manage_skills() -> &'static str {
6001        let (en, zh) = menu_manage_skills_variants();
6002        if is_chinese() {
6003            zh
6004        } else {
6005            en
6006        }
6007    }
6008
6009    pub fn menu_manage_skills_variants() -> (&'static str, &'static str) {
6010        ("🧩 Skills", "🧩 技能")
6011    }
6012
6013    pub fn menu_openclaw_workspace() -> &'static str {
6014        let (en, zh) = menu_openclaw_workspace_variants();
6015        if is_chinese() {
6016            zh
6017        } else {
6018            en
6019        }
6020    }
6021
6022    pub fn menu_openclaw_workspace_variants() -> (&'static str, &'static str) {
6023        ("📁 Workspace Files", "📁 Workspace 文件管理")
6024    }
6025
6026    pub fn menu_openclaw_env() -> &'static str {
6027        let (en, zh) = menu_openclaw_env_variants();
6028        if is_chinese() {
6029            zh
6030        } else {
6031            en
6032        }
6033    }
6034
6035    pub fn menu_openclaw_env_variants() -> (&'static str, &'static str) {
6036        ("🌱 Env Variables", "🌱 环境变量")
6037    }
6038
6039    pub fn menu_openclaw_tools() -> &'static str {
6040        let (en, zh) = menu_openclaw_tools_variants();
6041        if is_chinese() {
6042            zh
6043        } else {
6044            en
6045        }
6046    }
6047
6048    pub fn menu_openclaw_tools_variants() -> (&'static str, &'static str) {
6049        ("🔐 Tool Permissions", "🔐 工具权限")
6050    }
6051
6052    pub fn menu_openclaw_agents() -> &'static str {
6053        let (en, zh) = menu_openclaw_agents_variants();
6054        if is_chinese() {
6055            zh
6056        } else {
6057            en
6058        }
6059    }
6060
6061    pub fn menu_openclaw_agents_variants() -> (&'static str, &'static str) {
6062        ("🤖 Agents Config", "🤖 Agents 配置")
6063    }
6064
6065    pub fn menu_settings() -> &'static str {
6066        let (en, zh) = menu_settings_variants();
6067        if is_chinese() {
6068            zh
6069        } else {
6070            en
6071        }
6072    }
6073
6074    pub fn menu_settings_variants() -> (&'static str, &'static str) {
6075        ("🔧 Settings", "🔧 设置")
6076    }
6077
6078    pub fn menu_exit() -> &'static str {
6079        let (en, zh) = menu_exit_variants();
6080        if is_chinese() {
6081            zh
6082        } else {
6083            en
6084        }
6085    }
6086
6087    pub fn menu_exit_variants() -> (&'static str, &'static str) {
6088        ("🚪 Exit", "🚪 退出")
6089    }
6090
6091    // ============================================
6092    // SKILLS (Skills)
6093    // ============================================
6094
6095    pub fn skills_management() -> &'static str {
6096        if is_chinese() {
6097            "技能管理"
6098        } else {
6099            "Skills Management"
6100        }
6101    }
6102
6103    pub fn no_skills_installed() -> &'static str {
6104        if is_chinese() {
6105            "未安装任何 Skills。"
6106        } else {
6107            "No skills installed."
6108        }
6109    }
6110
6111    pub fn skills_discover() -> &'static str {
6112        if is_chinese() {
6113            "🔎 发现/搜索 Skills"
6114        } else {
6115            "🔎 Discover/Search Skills"
6116        }
6117    }
6118
6119    pub fn skills_install() -> &'static str {
6120        if is_chinese() {
6121            "⬇️  安装 Skill"
6122        } else {
6123            "⬇️  Install Skill"
6124        }
6125    }
6126
6127    pub fn skills_uninstall() -> &'static str {
6128        if is_chinese() {
6129            "🗑️  卸载 Skill"
6130        } else {
6131            "🗑️  Uninstall Skill"
6132        }
6133    }
6134
6135    pub fn skills_toggle_for_app() -> &'static str {
6136        if is_chinese() {
6137            "✅ 启用/禁用(当前应用)"
6138        } else {
6139            "✅ Enable/Disable (Current App)"
6140        }
6141    }
6142
6143    pub fn skills_show_info() -> &'static str {
6144        if is_chinese() {
6145            "ℹ️  查看 Skill 信息"
6146        } else {
6147            "ℹ️  Skill Info"
6148        }
6149    }
6150
6151    pub fn skills_sync_now() -> &'static str {
6152        if is_chinese() {
6153            "🔄 同步 Skills 到本地"
6154        } else {
6155            "🔄 Sync Skills to Live"
6156        }
6157    }
6158
6159    pub fn skills_sync_method() -> &'static str {
6160        if is_chinese() {
6161            "🔗 同步方式(auto/symlink/copy)"
6162        } else {
6163            "🔗 Sync Method (auto/symlink/copy)"
6164        }
6165    }
6166
6167    pub fn skills_select_sync_method() -> &'static str {
6168        if is_chinese() {
6169            "选择同步方式:"
6170        } else {
6171            "Select sync method:"
6172        }
6173    }
6174
6175    pub fn skills_current_sync_method(method: &str) -> String {
6176        if is_chinese() {
6177            format!("当前同步方式:{method}")
6178        } else {
6179            format!("Current sync method: {method}")
6180        }
6181    }
6182
6183    pub fn skills_current_app_note(app: &str) -> String {
6184        if is_chinese() {
6185            format!("提示:启用/禁用将作用于当前应用({app})。")
6186        } else {
6187            format!("Note: Enable/Disable applies to the current app ({app}).")
6188        }
6189    }
6190
6191    pub fn skills_scan_unmanaged() -> &'static str {
6192        if is_chinese() {
6193            "🕵️  查找已有技能"
6194        } else {
6195            "🕵️  Find Existing Skills"
6196        }
6197    }
6198
6199    pub fn skills_import_from_apps() -> &'static str {
6200        if is_chinese() {
6201            "📥 导入已有技能"
6202        } else {
6203            "📥 Import Existing Skills"
6204        }
6205    }
6206
6207    pub fn skills_manage_repos() -> &'static str {
6208        if is_chinese() {
6209            "📦 管理技能仓库"
6210        } else {
6211            "📦 Manage Skill Repos"
6212        }
6213    }
6214
6215    pub fn skills_enter_query() -> &'static str {
6216        if is_chinese() {
6217            "输入搜索关键词(可选):"
6218        } else {
6219            "Enter search query (optional):"
6220        }
6221    }
6222
6223    pub fn skills_enter_install_spec() -> &'static str {
6224        if is_chinese() {
6225            "输入技能目录,或完整标识(owner/name:directory):"
6226        } else {
6227            "Enter a skill directory, or a full key (owner/name:directory):"
6228        }
6229    }
6230
6231    pub fn skills_select_skill() -> &'static str {
6232        if is_chinese() {
6233            "选择一个 Skill:"
6234        } else {
6235            "Select a skill:"
6236        }
6237    }
6238
6239    pub fn skills_confirm_install(name: &str, app: &str) -> String {
6240        if is_chinese() {
6241            format!("确认安装 '{name}' 并启用到 {app}?")
6242        } else {
6243            format!("Install '{name}' and enable for {app}?")
6244        }
6245    }
6246
6247    pub fn skills_confirm_uninstall(name: &str) -> String {
6248        if is_chinese() {
6249            format!("确认卸载 '{name}'?")
6250        } else {
6251            format!("Uninstall '{name}'?")
6252        }
6253    }
6254
6255    pub fn skills_confirm_toggle(name: &str, app: &str, enabled: bool) -> String {
6256        if is_chinese() {
6257            if enabled {
6258                format!("确认启用 '{name}' 到 {app}?")
6259            } else {
6260                format!("确认在 {app} 禁用 '{name}'?")
6261            }
6262        } else if enabled {
6263            format!("Enable '{name}' for {app}?")
6264        } else {
6265            format!("Disable '{name}' for {app}?")
6266        }
6267    }
6268
6269    pub fn skills_no_unmanaged_found() -> &'static str {
6270        if is_chinese() {
6271            "未发现可导入的技能。所有技能已在 CC Switch 中统一管理。"
6272        } else {
6273            "No skills to import found. All skills are already managed by CC Switch."
6274        }
6275    }
6276
6277    pub fn skills_no_agent_installed_found() -> &'static str {
6278        if is_chinese() {
6279            "未发现可导入的智能体技能。已管理技能会自动同步实际启用状态。"
6280        } else {
6281            "No agent skills found to import. Managed skills automatically reflect live app enablement."
6282        }
6283    }
6284
6285    pub fn skills_select_unmanaged_to_import() -> &'static str {
6286        if is_chinese() {
6287            "选择要导入的技能:"
6288        } else {
6289            "Select skills to import:"
6290        }
6291    }
6292
6293    pub fn skills_repos_management() -> &'static str {
6294        if is_chinese() {
6295            "技能仓库管理"
6296        } else {
6297            "Skill Repos"
6298        }
6299    }
6300
6301    pub fn skills_repo_list() -> &'static str {
6302        if is_chinese() {
6303            "📋 查看仓库列表"
6304        } else {
6305            "📋 List Repos"
6306        }
6307    }
6308
6309    pub fn skills_repo_add() -> &'static str {
6310        if is_chinese() {
6311            "➕ 添加仓库"
6312        } else {
6313            "➕ Add Repo"
6314        }
6315    }
6316
6317    pub fn skills_repo_remove() -> &'static str {
6318        if is_chinese() {
6319            "➖ 移除仓库"
6320        } else {
6321            "➖ Remove Repo"
6322        }
6323    }
6324
6325    pub fn skills_repo_enter_spec() -> &'static str {
6326        if is_chinese() {
6327            "输入 GitHub 仓库(owner/name,可选 @branch)或完整 URL:"
6328        } else {
6329            "Enter a GitHub repository (owner/name, optional @branch) or a full URL:"
6330        }
6331    }
6332
6333    // ============================================
6334    // PROVIDER MANAGEMENT (供应商管理)
6335    // ============================================
6336
6337    pub fn provider_management() -> &'static str {
6338        if is_chinese() {
6339            "🔌 供应商管理"
6340        } else {
6341            "🔌 Provider Management"
6342        }
6343    }
6344
6345    pub fn no_providers() -> &'static str {
6346        if is_chinese() {
6347            "未找到供应商。"
6348        } else {
6349            "No providers found."
6350        }
6351    }
6352
6353    pub fn view_current_provider() -> &'static str {
6354        if is_chinese() {
6355            "📋 查看当前供应商详情"
6356        } else {
6357            "📋 View Current Provider Details"
6358        }
6359    }
6360
6361    pub fn switch_provider() -> &'static str {
6362        if is_chinese() {
6363            "🔄 切换供应商"
6364        } else {
6365            "🔄 Switch Provider"
6366        }
6367    }
6368
6369    pub fn add_provider() -> &'static str {
6370        if is_chinese() {
6371            "➕ 新增供应商"
6372        } else {
6373            "➕ Add Provider"
6374        }
6375    }
6376
6377    pub fn add_official_provider() -> &'static str {
6378        if is_chinese() {
6379            "添加官方供应商"
6380        } else {
6381            "Add Official Provider"
6382        }
6383    }
6384
6385    pub fn add_third_party_provider() -> &'static str {
6386        if is_chinese() {
6387            "添加第三方供应商"
6388        } else {
6389            "Add Third-Party Provider"
6390        }
6391    }
6392
6393    pub fn select_provider_add_mode() -> &'static str {
6394        if is_chinese() {
6395            "请选择供应商类型:"
6396        } else {
6397            "Select provider type:"
6398        }
6399    }
6400
6401    pub fn delete_provider() -> &'static str {
6402        if is_chinese() {
6403            "🗑️  删除供应商"
6404        } else {
6405            "🗑️  Delete Provider"
6406        }
6407    }
6408
6409    pub fn back_to_main() -> &'static str {
6410        if is_chinese() {
6411            "⬅️  返回主菜单"
6412        } else {
6413            "⬅️  Back to Main Menu"
6414        }
6415    }
6416
6417    pub fn choose_action() -> &'static str {
6418        if is_chinese() {
6419            "选择操作:"
6420        } else {
6421            "Choose an action:"
6422        }
6423    }
6424
6425    pub fn esc_to_go_back_help() -> &'static str {
6426        if is_chinese() {
6427            "Esc 返回上一步"
6428        } else {
6429            "Esc to go back"
6430        }
6431    }
6432
6433    pub fn select_filter_help() -> &'static str {
6434        if is_chinese() {
6435            "Esc 返回;输入可过滤"
6436        } else {
6437            "Esc to go back; type to filter"
6438        }
6439    }
6440
6441    pub fn current_provider_details() -> &'static str {
6442        if is_chinese() {
6443            "当前供应商详情"
6444        } else {
6445            "Current Provider Details"
6446        }
6447    }
6448
6449    pub fn only_one_provider() -> &'static str {
6450        if is_chinese() {
6451            "只有一个供应商,无法切换。"
6452        } else {
6453            "Only one provider available. Cannot switch."
6454        }
6455    }
6456
6457    pub fn no_other_providers() -> &'static str {
6458        if is_chinese() {
6459            "没有其他供应商可切换。"
6460        } else {
6461            "No other providers to switch to."
6462        }
6463    }
6464
6465    pub fn select_provider_to_switch() -> &'static str {
6466        if is_chinese() {
6467            "选择要切换到的供应商:"
6468        } else {
6469            "Select provider to switch to:"
6470        }
6471    }
6472
6473    pub fn switched_to_provider(id: &str) -> String {
6474        if is_chinese() {
6475            format!("✓ 已切换到供应商 '{}'", id)
6476        } else {
6477            format!("✓ Switched to provider '{}'", id)
6478        }
6479    }
6480
6481    pub fn provider_added_to_app_config(id: &str, app: &str) -> String {
6482        if is_chinese() {
6483            format!("✓ 已将供应商 '{}' 添加到 {} 配置", id, app)
6484        } else {
6485            format!("✓ Added provider '{}' to {} config", id, app)
6486        }
6487    }
6488
6489    pub fn restart_note() -> &'static str {
6490        if is_chinese() {
6491            "注意:请重启 CLI 客户端以应用更改。"
6492        } else {
6493            "Note: Restart your CLI client to apply the changes."
6494        }
6495    }
6496
6497    pub fn live_sync_skipped_uninitialized_warning(app: &str) -> String {
6498        if is_chinese() {
6499            format!("⚠ 未检测到 {app} 客户端本地配置,已跳过写入 live 文件;先运行一次 {app} 初始化后再试。")
6500        } else {
6501            format!("⚠ Live sync skipped: {app} client not initialized; run it once to initialize, then retry.")
6502        }
6503    }
6504
6505    pub fn no_deletable_providers() -> &'static str {
6506        if is_chinese() {
6507            "没有可删除的供应商(无法删除当前供应商)。"
6508        } else {
6509            "No providers available for deletion (cannot delete current provider)."
6510        }
6511    }
6512
6513    pub fn select_provider_to_delete() -> &'static str {
6514        if is_chinese() {
6515            "选择要删除的供应商:"
6516        } else {
6517            "Select provider to delete:"
6518        }
6519    }
6520
6521    pub fn confirm_delete(id: &str) -> String {
6522        if is_chinese() {
6523            format!("确定要删除供应商 '{}' 吗?", id)
6524        } else {
6525            format!("Are you sure you want to delete provider '{}'?", id)
6526        }
6527    }
6528
6529    pub fn cancelled() -> &'static str {
6530        if is_chinese() {
6531            "已取消。"
6532        } else {
6533            "Cancelled."
6534        }
6535    }
6536
6537    pub fn selection_cancelled() -> &'static str {
6538        if is_chinese() {
6539            "已取消选择"
6540        } else {
6541            "Selection cancelled"
6542        }
6543    }
6544
6545    pub fn invalid_selection() -> &'static str {
6546        if is_chinese() {
6547            "选择无效"
6548        } else {
6549            "Invalid selection"
6550        }
6551    }
6552
6553    pub fn available_backups() -> &'static str {
6554        if is_chinese() {
6555            "可用备份"
6556        } else {
6557            "Available Backups"
6558        }
6559    }
6560
6561    pub fn no_backups_found() -> &'static str {
6562        if is_chinese() {
6563            "未找到备份。"
6564        } else {
6565            "No backups found."
6566        }
6567    }
6568
6569    pub fn create_backup_first_hint() -> &'static str {
6570        if is_chinese() {
6571            "请先创建备份:cc-switch config backup"
6572        } else {
6573            "Create a backup first: cc-switch config backup"
6574        }
6575    }
6576
6577    pub fn found_backups(count: usize) -> String {
6578        if is_chinese() {
6579            format!("找到 {} 个备份:", count)
6580        } else {
6581            format!("Found {} backup(s):", count)
6582        }
6583    }
6584
6585    pub fn select_backup_to_restore() -> &'static str {
6586        if is_chinese() {
6587            "选择要恢复的备份:"
6588        } else {
6589            "Select backup to restore:"
6590        }
6591    }
6592
6593    pub fn warning_title() -> &'static str {
6594        if is_chinese() {
6595            "警告:"
6596        } else {
6597            "Warning:"
6598        }
6599    }
6600
6601    pub fn config_restore_warning_replace() -> &'static str {
6602        if is_chinese() {
6603            "这将用所选备份替换你当前的配置。"
6604        } else {
6605            "This will replace your current configuration with the selected backup."
6606        }
6607    }
6608
6609    pub fn config_restore_warning_pre_backup() -> &'static str {
6610        if is_chinese() {
6611            "系统会先创建一次当前状态的备份。"
6612        } else {
6613            "A backup of the current state will be created first."
6614        }
6615    }
6616
6617    pub fn config_restore_confirm_prompt() -> &'static str {
6618        if is_chinese() {
6619            "确认继续恢复?"
6620        } else {
6621            "Continue with restore?"
6622        }
6623    }
6624
6625    pub fn deleted_provider(id: &str) -> String {
6626        if is_chinese() {
6627            format!("✓ 已删除供应商 '{}'", id)
6628        } else {
6629            format!("✓ Deleted provider '{}'", id)
6630        }
6631    }
6632
6633    // Provider Input - Basic Fields
6634    pub fn provider_name_label() -> &'static str {
6635        if is_chinese() {
6636            "供应商名称:"
6637        } else {
6638            "Provider Name:"
6639        }
6640    }
6641
6642    pub fn provider_name_help() -> &'static str {
6643        if is_chinese() {
6644            "必填,用于显示的友好名称"
6645        } else {
6646            "Required, friendly display name"
6647        }
6648    }
6649
6650    pub fn provider_name_help_edit() -> &'static str {
6651        if is_chinese() {
6652            "必填,直接回车保持原值"
6653        } else {
6654            "Required, press Enter to keep"
6655        }
6656    }
6657
6658    pub fn provider_name_placeholder() -> &'static str {
6659        "OpenAI"
6660    }
6661
6662    pub fn provider_name_empty_error() -> &'static str {
6663        if is_chinese() {
6664            "供应商名称不能为空"
6665        } else {
6666            "Provider name cannot be empty"
6667        }
6668    }
6669
6670    pub fn website_url_label() -> &'static str {
6671        if is_chinese() {
6672            "官网 URL(可选):"
6673        } else {
6674            "Website URL (opt.):"
6675        }
6676    }
6677
6678    pub fn website_url_help() -> &'static str {
6679        if is_chinese() {
6680            "供应商的网站地址,直接回车跳过"
6681        } else {
6682            "Provider's website, press Enter to skip"
6683        }
6684    }
6685
6686    pub fn website_url_help_edit() -> &'static str {
6687        if is_chinese() {
6688            "留空则不修改,直接回车跳过"
6689        } else {
6690            "Leave blank to keep, Enter to skip"
6691        }
6692    }
6693
6694    pub fn website_url_placeholder() -> &'static str {
6695        "https://openai.com"
6696    }
6697
6698    // Provider Commands
6699    pub fn no_providers_hint() -> &'static str {
6700        "Use 'cc-switch provider add' to create a new provider."
6701    }
6702
6703    pub fn app_config_not_found(app: &str) -> String {
6704        if is_chinese() {
6705            format!("应用 {} 配置不存在", app)
6706        } else {
6707            format!("Application {} configuration not found", app)
6708        }
6709    }
6710
6711    pub fn provider_not_found(id: &str) -> String {
6712        if is_chinese() {
6713            format!("供应商不存在: {}", id)
6714        } else {
6715            format!("Provider not found: {}", id)
6716        }
6717    }
6718
6719    pub fn generated_id(id: &str) -> String {
6720        if is_chinese() {
6721            format!("生成的 ID: {}", id)
6722        } else {
6723            format!("Generated ID: {}", id)
6724        }
6725    }
6726
6727    pub fn configure_optional_fields_prompt() -> &'static str {
6728        if is_chinese() {
6729            "配置可选字段(备注、排序索引)?"
6730        } else {
6731            "Configure optional fields (notes, sort index)?"
6732        }
6733    }
6734
6735    pub fn current_config_header() -> &'static str {
6736        if is_chinese() {
6737            "当前配置:"
6738        } else {
6739            "Current Configuration:"
6740        }
6741    }
6742
6743    pub fn modify_provider_config_prompt() -> &'static str {
6744        if is_chinese() {
6745            "修改供应商配置(API Key, Base URL 等)?"
6746        } else {
6747            "Modify provider configuration (API Key, Base URL, etc.)?"
6748        }
6749    }
6750
6751    pub fn modify_optional_fields_prompt() -> &'static str {
6752        if is_chinese() {
6753            "修改可选字段(备注、排序索引)?"
6754        } else {
6755            "Modify optional fields (notes, sort index)?"
6756        }
6757    }
6758
6759    pub fn current_provider_synced_warning() -> &'static str {
6760        if is_chinese() {
6761            "⚠ 此供应商当前已激活,修改已同步到 live 配置"
6762        } else {
6763            "⚠ This provider is currently active, changes synced to live config"
6764        }
6765    }
6766
6767    pub fn input_failed_error(err: &str) -> String {
6768        if is_chinese() {
6769            format!("输入失败: {}", err)
6770        } else {
6771            format!("Input failed: {}", err)
6772        }
6773    }
6774
6775    pub fn cannot_delete_current_provider() -> &'static str {
6776        "Cannot delete the current active provider. Please switch to another provider first."
6777    }
6778
6779    // Provider Input - Basic Fields
6780    pub fn provider_name_prompt() -> &'static str {
6781        if is_chinese() {
6782            "供应商名称:"
6783        } else {
6784            "Provider Name:"
6785        }
6786    }
6787
6788    // Provider Input - Claude Configuration
6789    pub fn config_claude_header() -> &'static str {
6790        if is_chinese() {
6791            "配置 Claude 供应商:"
6792        } else {
6793            "Configure Claude Provider:"
6794        }
6795    }
6796
6797    pub fn api_key_label() -> &'static str {
6798        if is_chinese() {
6799            "API Key:"
6800        } else {
6801            "API Key:"
6802        }
6803    }
6804
6805    pub fn api_key_help() -> &'static str {
6806        if is_chinese() {
6807            "留空使用默认值"
6808        } else {
6809            "Leave empty to use default"
6810        }
6811    }
6812
6813    pub fn base_url_label() -> &'static str {
6814        if is_chinese() {
6815            "Base URL:"
6816        } else {
6817            "Base URL:"
6818        }
6819    }
6820
6821    pub fn base_url_empty_error() -> &'static str {
6822        if is_chinese() {
6823            "API 请求地址不能为空"
6824        } else {
6825            "API URL cannot be empty"
6826        }
6827    }
6828
6829    pub fn base_url_placeholder() -> &'static str {
6830        if is_chinese() {
6831            "如 https://api.anthropic.com"
6832        } else {
6833            "e.g., https://api.anthropic.com"
6834        }
6835    }
6836
6837    pub fn configure_model_names_prompt() -> &'static str {
6838        if is_chinese() {
6839            "配置模型名称?"
6840        } else {
6841            "Configure model names?"
6842        }
6843    }
6844
6845    pub fn model_default_label() -> &'static str {
6846        if is_chinese() {
6847            "默认模型:"
6848        } else {
6849            "Default Model:"
6850        }
6851    }
6852
6853    pub fn model_default_help() -> &'static str {
6854        if is_chinese() {
6855            "留空使用 Claude Code 默认模型"
6856        } else {
6857            "Leave empty to use Claude Code default"
6858        }
6859    }
6860
6861    pub fn model_haiku_label() -> &'static str {
6862        if is_chinese() {
6863            "Haiku 模型:"
6864        } else {
6865            "Haiku Model:"
6866        }
6867    }
6868
6869    pub fn model_haiku_placeholder() -> &'static str {
6870        if is_chinese() {
6871            "如 claude-3-5-haiku-20241022"
6872        } else {
6873            "e.g., claude-3-5-haiku-20241022"
6874        }
6875    }
6876
6877    pub fn model_sonnet_label() -> &'static str {
6878        if is_chinese() {
6879            "Sonnet 模型:"
6880        } else {
6881            "Sonnet Model:"
6882        }
6883    }
6884
6885    pub fn model_sonnet_placeholder() -> &'static str {
6886        if is_chinese() {
6887            "如 claude-3-5-sonnet-20241022"
6888        } else {
6889            "e.g., claude-3-5-sonnet-20241022"
6890        }
6891    }
6892
6893    pub fn model_opus_label() -> &'static str {
6894        if is_chinese() {
6895            "Opus 模型:"
6896        } else {
6897            "Opus Model:"
6898        }
6899    }
6900
6901    pub fn model_opus_placeholder() -> &'static str {
6902        if is_chinese() {
6903            "如 claude-3-opus-20240229"
6904        } else {
6905            "e.g., claude-3-opus-20240229"
6906        }
6907    }
6908
6909    // Provider Input - Codex Configuration
6910    pub fn config_codex_header() -> &'static str {
6911        if is_chinese() {
6912            "配置 Codex 供应商:"
6913        } else {
6914            "Configure Codex Provider:"
6915        }
6916    }
6917
6918    pub fn openai_api_key_label() -> &'static str {
6919        if is_chinese() {
6920            "OpenAI API Key:"
6921        } else {
6922            "OpenAI API Key:"
6923        }
6924    }
6925
6926    pub fn anthropic_api_key_label() -> &'static str {
6927        if is_chinese() {
6928            "Anthropic API Key:"
6929        } else {
6930            "Anthropic API Key:"
6931        }
6932    }
6933
6934    pub fn config_toml_label() -> &'static str {
6935        if is_chinese() {
6936            "配置内容 (TOML):"
6937        } else {
6938            "Config Content (TOML):"
6939        }
6940    }
6941
6942    pub fn config_toml_help() -> &'static str {
6943        if is_chinese() {
6944            "按 Esc 后 Enter 提交"
6945        } else {
6946            "Press Esc then Enter to submit"
6947        }
6948    }
6949
6950    pub fn config_toml_placeholder() -> &'static str {
6951        if is_chinese() {
6952            "留空使用默认配置"
6953        } else {
6954            "Leave empty to use default config"
6955        }
6956    }
6957
6958    // Codex 0.64+ Configuration
6959    pub fn codex_auth_mode_info() -> &'static str {
6960        if is_chinese() {
6961            "⚠ 请选择 Codex 的鉴权方式(决定 API Key 从哪里读取)"
6962        } else {
6963            "⚠ Choose how Codex authenticates (where the API key is read from)"
6964        }
6965    }
6966
6967    pub fn codex_auth_mode_label() -> &'static str {
6968        if is_chinese() {
6969            "认证方式:"
6970        } else {
6971            "Auth Mode:"
6972        }
6973    }
6974
6975    pub fn codex_auth_mode_help() -> &'static str {
6976        if is_chinese() {
6977            "OpenAI 认证:使用 auth.json/凭据存储;环境变量:使用 env_key 指定的变量(未设置会报错)"
6978        } else {
6979            "OpenAI auth uses auth.json/credential store; env var mode uses env_key (missing env var will error)"
6980        }
6981    }
6982
6983    pub fn codex_auth_mode_openai() -> &'static str {
6984        if is_chinese() {
6985            "OpenAI 认证(推荐,无需环境变量)"
6986        } else {
6987            "OpenAI auth (recommended, no env var)"
6988        }
6989    }
6990
6991    pub fn codex_auth_mode_env_var() -> &'static str {
6992        if is_chinese() {
6993            "环境变量(env_key,需要手动 export)"
6994        } else {
6995            "Environment variable (env_key, requires export)"
6996        }
6997    }
6998
6999    pub fn codex_official_provider_tip() -> &'static str {
7000        if is_chinese() {
7001            "提示:官方供应商将使用 Codex 官方登录保存的凭证(codex login 可能会打开浏览器),无需填写 API Key"
7002        } else {
7003            "Tip: Official provider uses Codex login credentials (`codex login` may open a browser); no API key required"
7004        }
7005    }
7006
7007    pub fn codex_env_key_info() -> &'static str {
7008        if is_chinese() {
7009            "⚠ 环境变量模式:Codex 将从指定的环境变量读取 API Key"
7010        } else {
7011            "⚠ Env var mode: Codex will read the API key from the specified environment variable"
7012        }
7013    }
7014
7015    pub fn codex_env_key_label() -> &'static str {
7016        if is_chinese() {
7017            "环境变量名称:"
7018        } else {
7019            "Environment Variable Name:"
7020        }
7021    }
7022
7023    pub fn codex_env_key_help() -> &'static str {
7024        if is_chinese() {
7025            "Codex 将从此环境变量读取 API 密钥(默认: OPENAI_API_KEY)"
7026        } else {
7027            "Codex will read API key from this env var (default: OPENAI_API_KEY)"
7028        }
7029    }
7030
7031    pub fn codex_wire_api_label() -> &'static str {
7032        if is_chinese() {
7033            "API 格式:"
7034        } else {
7035            "API Format:"
7036        }
7037    }
7038
7039    pub fn codex_wire_api_help() -> &'static str {
7040        if is_chinese() {
7041            "chat = Chat Completions API (大多数第三方), responses = OpenAI Responses API"
7042        } else {
7043            "chat = Chat Completions API (most providers), responses = OpenAI Responses API"
7044        }
7045    }
7046
7047    pub fn codex_env_reminder(env_key: &str) -> String {
7048        if is_chinese() {
7049            format!(
7050                "⚠ 请确保已设置环境变量 {} 并包含您的 API 密钥\n  例如: export {}=\"your-api-key\"",
7051                env_key, env_key
7052            )
7053        } else {
7054            format!(
7055                "⚠ Make sure to set the {} environment variable with your API key\n  Example: export {}=\"your-api-key\"",
7056                env_key, env_key
7057            )
7058        }
7059    }
7060
7061    pub fn codex_openai_auth_info() -> &'static str {
7062        if is_chinese() {
7063            "✓ OpenAI 认证模式:Codex 将使用 auth.json/系统凭据存储,无需设置 OPENAI_API_KEY 环境变量"
7064        } else {
7065            "✓ OpenAI auth mode: Codex will use auth.json/credential store; no OPENAI_API_KEY env var required"
7066        }
7067    }
7068
7069    pub fn codex_dual_write_info(env_key: &str, _api_key: &str) -> String {
7070        if is_chinese() {
7071            format!(
7072                "✓ 双写模式已启用(兼容所有 Codex 版本)\n\
7073                  • 旧版本 Codex: 将使用 auth.json 中的 API Key\n\
7074                  • Codex 0.64+: 可使用环境变量 {} (更安全)\n\
7075                    例如: export {}=\"your-api-key\"",
7076                env_key, env_key
7077            )
7078        } else {
7079            format!(
7080                "✓ Dual-write mode enabled (compatible with all Codex versions)\n\
7081                  • Legacy Codex: Will use API Key from auth.json\n\
7082                  • Codex 0.64+: Can use env variable {} (more secure)\n\
7083                    Example: export {}=\"your-api-key\"",
7084                env_key, env_key
7085            )
7086        }
7087    }
7088
7089    pub fn use_current_config_prompt() -> &'static str {
7090        if is_chinese() {
7091            "使用当前配置?"
7092        } else {
7093            "Use current configuration?"
7094        }
7095    }
7096
7097    pub fn use_current_config_help() -> &'static str {
7098        if is_chinese() {
7099            "选择 No 将进入自定义输入模式"
7100        } else {
7101            "Select No to enter custom input mode"
7102        }
7103    }
7104
7105    pub fn input_toml_config() -> &'static str {
7106        if is_chinese() {
7107            "输入 TOML 配置(多行,输入空行结束):"
7108        } else {
7109            "Enter TOML config (multiple lines, empty line to finish):"
7110        }
7111    }
7112
7113    pub fn direct_enter_to_finish() -> &'static str {
7114        if is_chinese() {
7115            "直接回车结束输入"
7116        } else {
7117            "Press Enter to finish"
7118        }
7119    }
7120
7121    pub fn current_config_label() -> &'static str {
7122        if is_chinese() {
7123            "当前配置:"
7124        } else {
7125            "Current Config:"
7126        }
7127    }
7128
7129    pub fn config_toml_header() -> &'static str {
7130        if is_chinese() {
7131            "Config.toml 配置:"
7132        } else {
7133            "Config.toml Configuration:"
7134        }
7135    }
7136
7137    // Provider Input - Gemini Configuration
7138    pub fn config_gemini_header() -> &'static str {
7139        if is_chinese() {
7140            "配置 Gemini 供应商:"
7141        } else {
7142            "Configure Gemini Provider:"
7143        }
7144    }
7145
7146    pub fn auth_type_label() -> &'static str {
7147        if is_chinese() {
7148            "认证类型:"
7149        } else {
7150            "Auth Type:"
7151        }
7152    }
7153
7154    pub fn auth_type_api_key() -> &'static str {
7155        if is_chinese() {
7156            "API Key"
7157        } else {
7158            "API Key"
7159        }
7160    }
7161
7162    pub fn auth_type_service_account() -> &'static str {
7163        if is_chinese() {
7164            "Service Account (ADC)"
7165        } else {
7166            "Service Account (ADC)"
7167        }
7168    }
7169
7170    pub fn gemini_api_key_label() -> &'static str {
7171        if is_chinese() {
7172            "Gemini API Key:"
7173        } else {
7174            "Gemini API Key:"
7175        }
7176    }
7177
7178    pub fn gemini_base_url_label() -> &'static str {
7179        if is_chinese() {
7180            "Base URL:"
7181        } else {
7182            "Base URL:"
7183        }
7184    }
7185
7186    pub fn gemini_base_url_help() -> &'static str {
7187        if is_chinese() {
7188            "留空使用官方 API"
7189        } else {
7190            "Leave empty to use official API"
7191        }
7192    }
7193
7194    pub fn gemini_base_url_placeholder() -> &'static str {
7195        if is_chinese() {
7196            "如 https://generativelanguage.googleapis.com"
7197        } else {
7198            "e.g., https://generativelanguage.googleapis.com"
7199        }
7200    }
7201
7202    pub fn adc_project_id_label() -> &'static str {
7203        if is_chinese() {
7204            "GCP Project ID:"
7205        } else {
7206            "GCP Project ID:"
7207        }
7208    }
7209
7210    pub fn adc_location_label() -> &'static str {
7211        if is_chinese() {
7212            "GCP Location:"
7213        } else {
7214            "GCP Location:"
7215        }
7216    }
7217
7218    pub fn adc_location_placeholder() -> &'static str {
7219        if is_chinese() {
7220            "如 us-central1"
7221        } else {
7222            "e.g., us-central1"
7223        }
7224    }
7225
7226    pub fn google_oauth_official() -> &'static str {
7227        if is_chinese() {
7228            "Google OAuth(官方)"
7229        } else {
7230            "Google OAuth (Official)"
7231        }
7232    }
7233
7234    pub fn packycode_api_key() -> &'static str {
7235        if is_chinese() {
7236            "PackyCode API Key"
7237        } else {
7238            "PackyCode API Key"
7239        }
7240    }
7241
7242    pub fn generic_api_key() -> &'static str {
7243        if is_chinese() {
7244            "通用 API Key"
7245        } else {
7246            "Generic API Key"
7247        }
7248    }
7249
7250    pub fn select_auth_method_help() -> &'static str {
7251        if is_chinese() {
7252            "选择 Gemini 的认证方式"
7253        } else {
7254            "Select authentication method for Gemini"
7255        }
7256    }
7257
7258    pub fn use_google_oauth_warning() -> &'static str {
7259        if is_chinese() {
7260            "使用 Google OAuth,将清空 API Key 配置"
7261        } else {
7262            "Using Google OAuth, API Key config will be cleared"
7263        }
7264    }
7265
7266    pub fn packycode_api_key_help() -> &'static str {
7267        if is_chinese() {
7268            "从 PackyCode 获取的 API Key"
7269        } else {
7270            "API Key obtained from PackyCode"
7271        }
7272    }
7273
7274    pub fn packycode_endpoint_help() -> &'static str {
7275        if is_chinese() {
7276            "PackyCode API 端点"
7277        } else {
7278            "PackyCode API endpoint"
7279        }
7280    }
7281
7282    pub fn generic_api_key_help() -> &'static str {
7283        if is_chinese() {
7284            "通用的 Gemini API Key"
7285        } else {
7286            "Generic Gemini API Key"
7287        }
7288    }
7289
7290    // Provider Input - Optional Fields
7291    pub fn notes_label() -> &'static str {
7292        if is_chinese() {
7293            "备注:"
7294        } else {
7295            "Notes:"
7296        }
7297    }
7298
7299    pub fn notes_placeholder() -> &'static str {
7300        if is_chinese() {
7301            "可选的备注信息"
7302        } else {
7303            "Optional notes"
7304        }
7305    }
7306
7307    pub fn sort_index_label() -> &'static str {
7308        if is_chinese() {
7309            "排序索引:"
7310        } else {
7311            "Sort Index:"
7312        }
7313    }
7314
7315    pub fn sort_index_help() -> &'static str {
7316        if is_chinese() {
7317            "数字越小越靠前,留空使用创建时间排序"
7318        } else {
7319            "Lower numbers appear first, leave empty to sort by creation time"
7320        }
7321    }
7322
7323    pub fn sort_index_placeholder() -> &'static str {
7324        if is_chinese() {
7325            "如 1, 2, 3..."
7326        } else {
7327            "e.g., 1, 2, 3..."
7328        }
7329    }
7330
7331    pub fn invalid_sort_index() -> &'static str {
7332        if is_chinese() {
7333            "排序索引必须是有效的数字"
7334        } else {
7335            "Sort index must be a valid number"
7336        }
7337    }
7338
7339    pub fn optional_fields_config() -> &'static str {
7340        if is_chinese() {
7341            "可选字段配置:"
7342        } else {
7343            "Optional Fields Configuration:"
7344        }
7345    }
7346
7347    pub fn notes_example_placeholder() -> &'static str {
7348        if is_chinese() {
7349            "自定义供应商,用于测试"
7350        } else {
7351            "Custom provider for testing"
7352        }
7353    }
7354
7355    pub fn notes_help_edit() -> &'static str {
7356        if is_chinese() {
7357            "关于此供应商的额外说明,直接回车保持原值"
7358        } else {
7359            "Additional notes about this provider, press Enter to keep current value"
7360        }
7361    }
7362
7363    pub fn notes_help_new() -> &'static str {
7364        if is_chinese() {
7365            "关于此供应商的额外说明,直接回车跳过"
7366        } else {
7367            "Additional notes about this provider, press Enter to skip"
7368        }
7369    }
7370
7371    pub fn sort_index_help_edit() -> &'static str {
7372        if is_chinese() {
7373            "数字,用于控制显示顺序,直接回车保持原值"
7374        } else {
7375            "Number for display order, press Enter to keep current value"
7376        }
7377    }
7378
7379    pub fn sort_index_help_new() -> &'static str {
7380        if is_chinese() {
7381            "数字,用于控制显示顺序,直接回车跳过"
7382        } else {
7383            "Number for display order, press Enter to skip"
7384        }
7385    }
7386
7387    pub fn invalid_sort_index_number() -> &'static str {
7388        if is_chinese() {
7389            "排序索引必须是数字"
7390        } else {
7391            "Sort index must be a number"
7392        }
7393    }
7394
7395    pub fn provider_config_summary() -> &'static str {
7396        if is_chinese() {
7397            "=== 供应商配置摘要 ==="
7398        } else {
7399            "=== Provider Configuration Summary ==="
7400        }
7401    }
7402
7403    pub fn id_label() -> &'static str {
7404        if is_chinese() {
7405            "ID"
7406        } else {
7407            "ID"
7408        }
7409    }
7410
7411    pub fn website_label() -> &'static str {
7412        if is_chinese() {
7413            "官网"
7414        } else {
7415            "Website"
7416        }
7417    }
7418
7419    pub fn core_config_label() -> &'static str {
7420        if is_chinese() {
7421            "核心配置:"
7422        } else {
7423            "Core Configuration:"
7424        }
7425    }
7426
7427    pub fn model_label() -> &'static str {
7428        if is_chinese() {
7429            "模型"
7430        } else {
7431            "Model"
7432        }
7433    }
7434
7435    pub fn config_toml_lines(count: usize) -> String {
7436        if is_chinese() {
7437            format!("Config (TOML): {} 行", count)
7438        } else {
7439            format!("Config (TOML): {} lines", count)
7440        }
7441    }
7442
7443    pub fn optional_fields_label() -> &'static str {
7444        if is_chinese() {
7445            "可选字段:"
7446        } else {
7447            "Optional Fields:"
7448        }
7449    }
7450
7451    pub fn notes_label_colon() -> &'static str {
7452        if is_chinese() {
7453            "备注"
7454        } else {
7455            "Notes"
7456        }
7457    }
7458
7459    pub fn sort_index_label_colon() -> &'static str {
7460        if is_chinese() {
7461            "排序索引"
7462        } else {
7463            "Sort Index"
7464        }
7465    }
7466
7467    pub fn id_label_colon() -> &'static str {
7468        if is_chinese() {
7469            "ID"
7470        } else {
7471            "ID"
7472        }
7473    }
7474
7475    pub fn url_label_colon() -> &'static str {
7476        if is_chinese() {
7477            "网址"
7478        } else {
7479            "URL"
7480        }
7481    }
7482
7483    pub fn api_url_label_colon() -> &'static str {
7484        if is_chinese() {
7485            "API 地址"
7486        } else {
7487            "API URL"
7488        }
7489    }
7490
7491    pub fn summary_divider() -> &'static str {
7492        "======================"
7493    }
7494
7495    // Provider Input - Summary Display
7496    pub fn basic_info_header() -> &'static str {
7497        if is_chinese() {
7498            "基本信息"
7499        } else {
7500            "Basic Info"
7501        }
7502    }
7503
7504    pub fn name_display_label() -> &'static str {
7505        if is_chinese() {
7506            "名称"
7507        } else {
7508            "Name"
7509        }
7510    }
7511
7512    pub fn app_display_label() -> &'static str {
7513        if is_chinese() {
7514            "应用"
7515        } else {
7516            "App"
7517        }
7518    }
7519
7520    pub fn notes_display_label() -> &'static str {
7521        if is_chinese() {
7522            "备注"
7523        } else {
7524            "Notes"
7525        }
7526    }
7527
7528    pub fn sort_index_display_label() -> &'static str {
7529        if is_chinese() {
7530            "排序"
7531        } else {
7532            "Sort Index"
7533        }
7534    }
7535
7536    pub fn config_info_header() -> &'static str {
7537        if is_chinese() {
7538            "配置信息"
7539        } else {
7540            "Configuration"
7541        }
7542    }
7543
7544    pub fn api_key_display_label() -> &'static str {
7545        if is_chinese() {
7546            "API Key"
7547        } else {
7548            "API Key"
7549        }
7550    }
7551
7552    pub fn base_url_display_label() -> &'static str {
7553        if is_chinese() {
7554            "Base URL"
7555        } else {
7556            "Base URL"
7557        }
7558    }
7559
7560    pub fn model_config_header() -> &'static str {
7561        if is_chinese() {
7562            "模型配置"
7563        } else {
7564            "Model Configuration"
7565        }
7566    }
7567
7568    pub fn default_model_display() -> &'static str {
7569        if is_chinese() {
7570            "默认"
7571        } else {
7572            "Default"
7573        }
7574    }
7575
7576    pub fn haiku_model_display() -> &'static str {
7577        if is_chinese() {
7578            "Haiku"
7579        } else {
7580            "Haiku"
7581        }
7582    }
7583
7584    pub fn sonnet_model_display() -> &'static str {
7585        if is_chinese() {
7586            "Sonnet"
7587        } else {
7588            "Sonnet"
7589        }
7590    }
7591
7592    pub fn opus_model_display() -> &'static str {
7593        if is_chinese() {
7594            "Opus"
7595        } else {
7596            "Opus"
7597        }
7598    }
7599
7600    pub fn auth_type_display_label() -> &'static str {
7601        if is_chinese() {
7602            "认证"
7603        } else {
7604            "Auth Type"
7605        }
7606    }
7607
7608    pub fn project_id_display_label() -> &'static str {
7609        if is_chinese() {
7610            "项目 ID"
7611        } else {
7612            "Project ID"
7613        }
7614    }
7615
7616    pub fn location_display_label() -> &'static str {
7617        if is_chinese() {
7618            "位置"
7619        } else {
7620            "Location"
7621        }
7622    }
7623
7624    // Interactive Provider - Menu Options
7625    pub fn edit_provider_menu() -> &'static str {
7626        if is_chinese() {
7627            "➕ 编辑供应商"
7628        } else {
7629            "➕ Edit Provider"
7630        }
7631    }
7632
7633    pub fn no_editable_providers() -> &'static str {
7634        if is_chinese() {
7635            "没有可编辑的供应商"
7636        } else {
7637            "No providers available for editing"
7638        }
7639    }
7640
7641    pub fn select_provider_to_edit() -> &'static str {
7642        if is_chinese() {
7643            "选择要编辑的供应商:"
7644        } else {
7645            "Select provider to edit:"
7646        }
7647    }
7648
7649    pub fn choose_edit_mode() -> &'static str {
7650        if is_chinese() {
7651            "选择编辑模式:"
7652        } else {
7653            "Choose edit mode:"
7654        }
7655    }
7656
7657    pub fn select_config_file_to_edit() -> &'static str {
7658        if is_chinese() {
7659            "选择要编辑的配置文件:"
7660        } else {
7661            "Select config file to edit:"
7662        }
7663    }
7664
7665    pub fn provider_missing_auth_field() -> &'static str {
7666        if is_chinese() {
7667            "settings_config 中缺少 'auth' 字段"
7668        } else {
7669            "Missing 'auth' field in settings_config"
7670        }
7671    }
7672
7673    pub fn provider_missing_or_invalid_config_field() -> &'static str {
7674        if is_chinese() {
7675            "settings_config 中缺少或无效的 'config' 字段"
7676        } else {
7677            "Missing or invalid 'config' field in settings_config"
7678        }
7679    }
7680
7681    pub fn edit_mode_interactive() -> &'static str {
7682        if is_chinese() {
7683            "📝 交互式编辑 (分步提示)"
7684        } else {
7685            "📝 Interactive editing (step-by-step prompts)"
7686        }
7687    }
7688
7689    pub fn edit_mode_json_editor() -> &'static str {
7690        if is_chinese() {
7691            "✏️  JSON 编辑 (使用外部编辑器)"
7692        } else {
7693            "✏️  JSON editing (use external editor)"
7694        }
7695    }
7696
7697    pub fn cancel() -> &'static str {
7698        if is_chinese() {
7699            "❌ 取消"
7700        } else {
7701            "❌ Cancel"
7702        }
7703    }
7704
7705    pub fn opening_external_editor() -> &'static str {
7706        if is_chinese() {
7707            "正在打开外部编辑器..."
7708        } else {
7709            "Opening external editor..."
7710        }
7711    }
7712
7713    pub fn invalid_json_syntax() -> &'static str {
7714        if is_chinese() {
7715            "无效的 JSON 语法"
7716        } else {
7717            "Invalid JSON syntax"
7718        }
7719    }
7720
7721    pub fn invalid_provider_structure() -> &'static str {
7722        if is_chinese() {
7723            "无效的供应商结构"
7724        } else {
7725            "Invalid provider structure"
7726        }
7727    }
7728
7729    pub fn provider_id_cannot_be_changed() -> &'static str {
7730        if is_chinese() {
7731            "供应商 ID 不能被修改"
7732        } else {
7733            "Provider ID cannot be changed"
7734        }
7735    }
7736
7737    pub fn retry_editing() -> &'static str {
7738        if is_chinese() {
7739            "是否重新编辑?"
7740        } else {
7741            "Retry editing?"
7742        }
7743    }
7744
7745    pub fn no_changes_detected() -> &'static str {
7746        if is_chinese() {
7747            "未检测到任何更改"
7748        } else {
7749            "No changes detected"
7750        }
7751    }
7752
7753    pub fn provider_summary() -> &'static str {
7754        if is_chinese() {
7755            "供应商信息摘要"
7756        } else {
7757            "Provider Summary"
7758        }
7759    }
7760
7761    pub fn confirm_save_changes() -> &'static str {
7762        if is_chinese() {
7763            "确认保存更改?"
7764        } else {
7765            "Save changes?"
7766        }
7767    }
7768
7769    pub fn editor_failed() -> &'static str {
7770        if is_chinese() {
7771            "编辑器失败"
7772        } else {
7773            "Editor failed"
7774        }
7775    }
7776
7777    pub fn invalid_selection_format() -> &'static str {
7778        if is_chinese() {
7779            "无效的选择格式"
7780        } else {
7781            "Invalid selection format"
7782        }
7783    }
7784
7785    // Provider Display Labels (for show_current and view_provider_detail)
7786    pub fn basic_info_section_header() -> &'static str {
7787        if is_chinese() {
7788            "基本信息 / Basic Info"
7789        } else {
7790            "Basic Info"
7791        }
7792    }
7793
7794    pub fn name_label_with_colon() -> &'static str {
7795        if is_chinese() {
7796            "名称"
7797        } else {
7798            "Name"
7799        }
7800    }
7801
7802    pub fn app_label_with_colon() -> &'static str {
7803        if is_chinese() {
7804            "应用"
7805        } else {
7806            "App"
7807        }
7808    }
7809
7810    pub fn api_config_section_header() -> &'static str {
7811        if is_chinese() {
7812            "API 配置 / API Configuration"
7813        } else {
7814            "API Configuration"
7815        }
7816    }
7817
7818    pub fn model_config_section_header() -> &'static str {
7819        if is_chinese() {
7820            "模型配置 / Model Configuration"
7821        } else {
7822            "Model Configuration"
7823        }
7824    }
7825
7826    pub fn main_model_label_with_colon() -> &'static str {
7827        if is_chinese() {
7828            "主模型"
7829        } else {
7830            "Main Model"
7831        }
7832    }
7833
7834    pub fn updated_config_header() -> &'static str {
7835        if is_chinese() {
7836            "修改后配置:"
7837        } else {
7838            "Updated Configuration:"
7839        }
7840    }
7841
7842    // Provider Add/Edit Messages
7843    pub fn generated_id_message(id: &str) -> String {
7844        if is_chinese() {
7845            format!("生成的 ID: {}", id)
7846        } else {
7847            format!("Generated ID: {}", id)
7848        }
7849    }
7850
7851    pub fn edit_fields_instruction() -> &'static str {
7852        if is_chinese() {
7853            "逐个编辑字段(直接回车保留当前值):\n"
7854        } else {
7855            "Edit fields one by one (press Enter to keep current value):\n"
7856        }
7857    }
7858
7859    // ============================================
7860    // MCP SERVER MANAGEMENT (MCP 服务器管理)
7861    // ============================================
7862
7863    pub fn mcp_management() -> &'static str {
7864        if is_chinese() {
7865            "🛠️  MCP 服务器管理"
7866        } else {
7867            "🛠️  MCP Server Management"
7868        }
7869    }
7870
7871    pub fn no_mcp_servers() -> &'static str {
7872        if is_chinese() {
7873            "未找到 MCP 服务器。"
7874        } else {
7875            "No MCP servers found."
7876        }
7877    }
7878
7879    pub fn sync_all_servers() -> &'static str {
7880        if is_chinese() {
7881            "🔄 同步所有服务器"
7882        } else {
7883            "🔄 Sync All Servers"
7884        }
7885    }
7886
7887    pub fn synced_successfully() -> &'static str {
7888        if is_chinese() {
7889            "✓ 所有 MCP 服务器同步成功"
7890        } else {
7891            "✓ All MCP servers synced successfully"
7892        }
7893    }
7894
7895    // ============================================
7896    // PROMPT MANAGEMENT (提示词管理)
7897    // ============================================
7898
7899    pub fn prompts_management() -> &'static str {
7900        if is_chinese() {
7901            "💬 提示词管理"
7902        } else {
7903            "💬 Prompt Management"
7904        }
7905    }
7906
7907    pub fn no_prompts() -> &'static str {
7908        if is_chinese() {
7909            "未找到提示词预设。"
7910        } else {
7911            "No prompt presets found."
7912        }
7913    }
7914
7915    pub fn switch_active_prompt() -> &'static str {
7916        if is_chinese() {
7917            "🔄 切换活动提示词"
7918        } else {
7919            "🔄 Switch Active Prompt"
7920        }
7921    }
7922
7923    pub fn no_prompts_available() -> &'static str {
7924        if is_chinese() {
7925            "没有可用的提示词。"
7926        } else {
7927            "No prompts available."
7928        }
7929    }
7930
7931    pub fn select_prompt_to_activate() -> &'static str {
7932        if is_chinese() {
7933            "选择要激活的提示词:"
7934        } else {
7935            "Select prompt to activate:"
7936        }
7937    }
7938
7939    pub fn activated_prompt(id: &str) -> String {
7940        if is_chinese() {
7941            format!("✓ 已激活提示词 '{}'", id)
7942        } else {
7943            format!("✓ Activated prompt '{}'", id)
7944        }
7945    }
7946
7947    pub fn deactivated_prompt(id: &str) -> String {
7948        if is_chinese() {
7949            format!("✓ 已取消激活提示词 '{}'", id)
7950        } else {
7951            format!("✓ Deactivated prompt '{}'", id)
7952        }
7953    }
7954
7955    pub fn prompt_cleared_note() -> &'static str {
7956        if is_chinese() {
7957            "实时文件已清空"
7958        } else {
7959            "Live prompt file has been cleared"
7960        }
7961    }
7962
7963    pub fn prompt_synced_note() -> &'static str {
7964        if is_chinese() {
7965            "注意:提示词已同步到实时配置文件。"
7966        } else {
7967            "Note: The prompt has been synced to the live configuration file."
7968        }
7969    }
7970
7971    // Configuration View
7972    pub fn current_configuration() -> &'static str {
7973        if is_chinese() {
7974            "👁️  当前配置"
7975        } else {
7976            "👁️  Current Configuration"
7977        }
7978    }
7979
7980    pub fn provider_label() -> &'static str {
7981        if is_chinese() {
7982            "供应商:"
7983        } else {
7984            "Provider:"
7985        }
7986    }
7987
7988    pub fn mcp_servers_label() -> &'static str {
7989        if is_chinese() {
7990            "MCP 服务器:"
7991        } else {
7992            "MCP Servers:"
7993        }
7994    }
7995
7996    pub fn tui_label_mcp_short() -> &'static str {
7997        "MCP:"
7998    }
7999
8000    pub fn tui_label_skills() -> &'static str {
8001        if is_chinese() {
8002            "技能:"
8003        } else {
8004            "Skills:"
8005        }
8006    }
8007
8008    pub fn prompts_label() -> &'static str {
8009        if is_chinese() {
8010            "提示词:"
8011        } else {
8012            "Prompts:"
8013        }
8014    }
8015
8016    pub fn total() -> &'static str {
8017        if is_chinese() {
8018            "总计"
8019        } else {
8020            "Total"
8021        }
8022    }
8023
8024    pub fn enabled() -> &'static str {
8025        if is_chinese() {
8026            "启用"
8027        } else {
8028            "Enabled"
8029        }
8030    }
8031
8032    pub fn disabled() -> &'static str {
8033        if is_chinese() {
8034            "禁用"
8035        } else {
8036            "Disabled"
8037        }
8038    }
8039
8040    pub fn active() -> &'static str {
8041        if is_chinese() {
8042            "活动"
8043        } else {
8044            "Active"
8045        }
8046    }
8047
8048    pub fn none() -> &'static str {
8049        if is_chinese() {
8050            "无"
8051        } else {
8052            "None"
8053        }
8054    }
8055
8056    // Settings
8057    pub fn settings_title() -> &'static str {
8058        if is_chinese() {
8059            "⚙️  设置"
8060        } else {
8061            "⚙️  Settings"
8062        }
8063    }
8064
8065    pub fn change_language() -> &'static str {
8066        if is_chinese() {
8067            "🌐 切换语言"
8068        } else {
8069            "🌐 Change Language"
8070        }
8071    }
8072
8073    pub fn current_language_label() -> &'static str {
8074        if is_chinese() {
8075            "当前语言"
8076        } else {
8077            "Current Language"
8078        }
8079    }
8080
8081    pub fn select_language() -> &'static str {
8082        if is_chinese() {
8083            "选择语言:"
8084        } else {
8085            "Select language:"
8086        }
8087    }
8088
8089    pub fn language_changed() -> &'static str {
8090        if is_chinese() {
8091            "✓ 语言已更改"
8092        } else {
8093            "✓ Language changed"
8094        }
8095    }
8096
8097    pub fn skip_claude_onboarding() -> &'static str {
8098        if is_chinese() {
8099            "🚫 跳过 Claude Code 初次安装确认"
8100        } else {
8101            "🚫 Skip Claude Code onboarding confirmation"
8102        }
8103    }
8104
8105    pub fn skip_claude_onboarding_label() -> &'static str {
8106        if is_chinese() {
8107            "跳过 Claude Code 初次安装确认"
8108        } else {
8109            "Skip Claude Code onboarding confirmation"
8110        }
8111    }
8112
8113    pub fn skip_claude_onboarding_confirm(enable: bool, path: &str) -> String {
8114        if is_chinese() {
8115            if enable {
8116                format!(
8117                    "确认启用跳过 Claude Code 初次安装确认?\n将写入 {path}: hasCompletedOnboarding=true"
8118                )
8119            } else {
8120                format!(
8121                    "确认恢复 Claude Code 初次安装确认?\n将从 {path} 删除 hasCompletedOnboarding"
8122                )
8123            }
8124        } else {
8125            if enable {
8126                format!(
8127                    "Enable skipping Claude Code onboarding confirmation?\nWrites hasCompletedOnboarding=true to {path}"
8128                )
8129            } else {
8130                format!(
8131                    "Disable skipping Claude Code onboarding confirmation?\nRemoves hasCompletedOnboarding from {path}"
8132                )
8133            }
8134        }
8135    }
8136
8137    pub fn skip_claude_onboarding_changed(enable: bool) -> String {
8138        if is_chinese() {
8139            if enable {
8140                "✓ 已启用:跳过 Claude Code 初次安装确认".to_string()
8141            } else {
8142                "✓ 已恢复 Claude Code 初次安装确认".to_string()
8143            }
8144        } else {
8145            if enable {
8146                "✓ Skip Claude Code onboarding confirmation enabled".to_string()
8147            } else {
8148                "✓ Claude Code onboarding confirmation restored".to_string()
8149            }
8150        }
8151    }
8152
8153    pub fn enable_claude_plugin_integration() -> &'static str {
8154        if is_chinese() {
8155            "🔌 接管 Claude Code for VSCode 插件"
8156        } else {
8157            "🔌 Apply to Claude Code for VSCode"
8158        }
8159    }
8160
8161    pub fn enable_claude_plugin_integration_label() -> &'static str {
8162        if is_chinese() {
8163            "接管 Claude Code for VSCode 插件"
8164        } else {
8165            "Apply to Claude Code for VSCode"
8166        }
8167    }
8168
8169    pub fn enable_claude_plugin_integration_confirm(enable: bool, path: &str) -> String {
8170        if is_chinese() {
8171            if enable {
8172                format!(
8173                    "确认启用 Claude Code for VSCode 插件联动?\n将写入 {path}: primaryApiKey=\"any\""
8174                )
8175            } else {
8176                "确认关闭 Claude Code for VSCode 插件联动?".to_string()
8177            }
8178        } else {
8179            if enable {
8180                format!(
8181                    "Enable Claude Code for VSCode integration?\nWrites primaryApiKey=\"any\" to {path}"
8182                )
8183            } else {
8184                format!(
8185                    "Disable Claude Code for VSCode integration?\nRemoves primaryApiKey from {path}"
8186                )
8187            }
8188        }
8189    }
8190
8191    pub fn enable_claude_plugin_integration_changed(enable: bool) -> String {
8192        if is_chinese() {
8193            if enable {
8194                "✓ 已启用 Claude Code for VSCode 插件联动".to_string()
8195            } else {
8196                "✓ 已关闭 Claude Code for VSCode 插件联动".to_string()
8197            }
8198        } else {
8199            if enable {
8200                "✓ Claude Code for VSCode integration enabled".to_string()
8201            } else {
8202                "✓ Claude Code for VSCode integration disabled".to_string()
8203            }
8204        }
8205    }
8206
8207    pub fn claude_plugin_sync_failed_warning(err: &str) -> String {
8208        if is_chinese() {
8209            format!("⚠ Claude Code for VSCode 插件联动失败: {err}")
8210        } else {
8211            format!("⚠ Claude Code for VSCode integration failed: {err}")
8212        }
8213    }
8214
8215    // App Selection
8216    pub fn select_application() -> &'static str {
8217        if is_chinese() {
8218            "选择应用程序:"
8219        } else {
8220            "Select application:"
8221        }
8222    }
8223
8224    pub fn switched_to_app(app: &str) -> String {
8225        if is_chinese() {
8226            format!("✓ 已切换到 {}", app)
8227        } else {
8228            format!("✓ Switched to {}", app)
8229        }
8230    }
8231
8232    // Common
8233    pub fn press_enter() -> &'static str {
8234        if is_chinese() {
8235            "按 Enter 继续..."
8236        } else {
8237            "Press Enter to continue..."
8238        }
8239    }
8240
8241    pub fn error_prefix() -> &'static str {
8242        if is_chinese() {
8243            "错误"
8244        } else {
8245            "Error"
8246        }
8247    }
8248
8249    // Table Headers
8250    pub fn header_name() -> &'static str {
8251        if is_chinese() {
8252            "名称"
8253        } else {
8254            "Name"
8255        }
8256    }
8257
8258    pub fn header_category() -> &'static str {
8259        if is_chinese() {
8260            "类别"
8261        } else {
8262            "Category"
8263        }
8264    }
8265
8266    pub fn header_description() -> &'static str {
8267        if is_chinese() {
8268            "描述"
8269        } else {
8270            "Description"
8271        }
8272    }
8273
8274    // Config Management
8275    pub fn config_management() -> &'static str {
8276        if is_chinese() {
8277            "⚙️  配置文件管理"
8278        } else {
8279            "⚙️  Configuration Management"
8280        }
8281    }
8282
8283    pub fn config_export() -> &'static str {
8284        if is_chinese() {
8285            "📤 导出配置"
8286        } else {
8287            "📤 Export Config"
8288        }
8289    }
8290
8291    pub fn config_import() -> &'static str {
8292        if is_chinese() {
8293            "📥 导入配置"
8294        } else {
8295            "📥 Import Config"
8296        }
8297    }
8298
8299    pub fn config_backup() -> &'static str {
8300        if is_chinese() {
8301            "💾 备份配置"
8302        } else {
8303            "💾 Backup Config"
8304        }
8305    }
8306
8307    pub fn config_restore() -> &'static str {
8308        if is_chinese() {
8309            "♻️  恢复配置"
8310        } else {
8311            "♻️  Restore Config"
8312        }
8313    }
8314
8315    pub fn config_validate() -> &'static str {
8316        if is_chinese() {
8317            "✓ 验证配置"
8318        } else {
8319            "✓ Validate Config"
8320        }
8321    }
8322
8323    pub fn config_common_snippet() -> &'static str {
8324        if is_chinese() {
8325            "🧩 通用配置片段"
8326        } else {
8327            "🧩 Common Config Snippet"
8328        }
8329    }
8330
8331    pub fn config_common_snippet_title() -> &'static str {
8332        if is_chinese() {
8333            "通用配置片段"
8334        } else {
8335            "Common Config Snippet"
8336        }
8337    }
8338
8339    pub fn config_common_snippet_none_set() -> &'static str {
8340        if is_chinese() {
8341            "未设置通用配置片段。"
8342        } else {
8343            "No common config snippet is set."
8344        }
8345    }
8346
8347    pub fn config_common_snippet_set_for_app(app: &str) -> String {
8348        if is_chinese() {
8349            format!("✓ 已为应用 '{}' 设置通用配置片段", app)
8350        } else {
8351            format!("✓ Common config snippet set for app '{}'", app)
8352        }
8353    }
8354
8355    pub fn config_common_snippet_require_json_or_file() -> &'static str {
8356        if is_chinese() {
8357            "请提供 --json 或 --file"
8358        } else {
8359            "Please provide --json or --file"
8360        }
8361    }
8362
8363    pub fn config_reset() -> &'static str {
8364        if is_chinese() {
8365            "🔄 重置配置"
8366        } else {
8367            "🔄 Reset Config"
8368        }
8369    }
8370
8371    pub fn config_show_full() -> &'static str {
8372        if is_chinese() {
8373            "👁️  查看完整配置"
8374        } else {
8375            "👁️  Show Full Config"
8376        }
8377    }
8378
8379    pub fn config_show_path() -> &'static str {
8380        if is_chinese() {
8381            "📍 显示配置路径"
8382        } else {
8383            "📍 Show Config Path"
8384        }
8385    }
8386
8387    pub fn enter_export_path() -> &'static str {
8388        if is_chinese() {
8389            "输入导出文件路径:"
8390        } else {
8391            "Enter export file path:"
8392        }
8393    }
8394
8395    pub fn enter_import_path() -> &'static str {
8396        if is_chinese() {
8397            "输入导入文件路径:"
8398        } else {
8399            "Enter import file path:"
8400        }
8401    }
8402
8403    pub fn enter_restore_path() -> &'static str {
8404        if is_chinese() {
8405            "输入备份文件路径:"
8406        } else {
8407            "Enter backup file path:"
8408        }
8409    }
8410
8411    pub fn confirm_import() -> &'static str {
8412        if is_chinese() {
8413            "确定要导入配置吗?这将覆盖当前配置。"
8414        } else {
8415            "Are you sure you want to import? This will overwrite current configuration."
8416        }
8417    }
8418
8419    pub fn confirm_reset() -> &'static str {
8420        if is_chinese() {
8421            "确定要重置配置吗?这将删除所有自定义设置。"
8422        } else {
8423            "Are you sure you want to reset? This will delete all custom settings."
8424        }
8425    }
8426
8427    pub fn common_config_snippet_editor_prompt(app: &str) -> String {
8428        let is_codex = app == "codex";
8429        if is_chinese() {
8430            if is_codex {
8431                format!("编辑 {app} 的通用配置片段(TOML,留空则清除):")
8432            } else {
8433                format!("编辑 {app} 的通用配置片段(JSON 对象,留空则清除):")
8434            }
8435        } else {
8436            if is_codex {
8437                format!("Edit common config snippet for {app} (TOML; empty to clear):")
8438            } else {
8439                format!("Edit common config snippet for {app} (JSON object; empty to clear):")
8440            }
8441        }
8442    }
8443
8444    pub fn common_config_snippet_invalid_json(err: &str) -> String {
8445        if is_chinese() {
8446            format!("JSON 无效:{err}")
8447        } else {
8448            format!("Invalid JSON: {err}")
8449        }
8450    }
8451
8452    pub fn common_config_snippet_invalid_toml(err: &str) -> String {
8453        if is_chinese() {
8454            format!("TOML 无效:{err}")
8455        } else {
8456            format!("Invalid TOML: {err}")
8457        }
8458    }
8459
8460    pub fn failed_to_serialize_json(err: &str) -> String {
8461        if is_chinese() {
8462            format!("序列化 JSON 失败:{err}")
8463        } else {
8464            format!("Failed to serialize JSON: {err}")
8465        }
8466    }
8467
8468    pub fn common_config_snippet_not_object() -> &'static str {
8469        if is_chinese() {
8470            "通用配置必须是 JSON 对象(例如:{\"env\":{...}})"
8471        } else {
8472            "Common config must be a JSON object (e.g. {\"env\":{...}})"
8473        }
8474    }
8475
8476    pub fn common_config_snippet_saved() -> &'static str {
8477        if is_chinese() {
8478            "✓ 已保存通用配置片段"
8479        } else {
8480            "✓ Common config snippet saved"
8481        }
8482    }
8483
8484    pub fn common_config_snippet_cleared() -> &'static str {
8485        if is_chinese() {
8486            "✓ 已清除通用配置片段"
8487        } else {
8488            "✓ Common config snippet cleared"
8489        }
8490    }
8491
8492    pub fn common_config_snippet_apply_now() -> &'static str {
8493        if is_chinese() {
8494            "现在应用到当前供应商(写入 live 配置)?"
8495        } else {
8496            "Apply to current provider now (write live config)?"
8497        }
8498    }
8499
8500    pub fn common_config_snippet_no_current_provider() -> &'static str {
8501        if is_chinese() {
8502            "当前未选择供应商,已保存通用配置片段。"
8503        } else {
8504            "No current provider selected; common config snippet saved."
8505        }
8506    }
8507
8508    pub fn common_config_snippet_no_current_provider_after_clear() -> &'static str {
8509        if is_chinese() {
8510            "当前未选择供应商,已清除通用配置片段。"
8511        } else {
8512            "No current provider selected; common config snippet cleared."
8513        }
8514    }
8515
8516    pub fn common_config_snippet_applied() -> &'static str {
8517        if is_chinese() {
8518            "✓ 已在适用时刷新 live 配置(请重启对应客户端)"
8519        } else {
8520            "✓ Refreshed live config when applicable (restart the client)"
8521        }
8522    }
8523
8524    pub fn common_config_snippet_apply_hint() -> &'static str {
8525        if is_chinese() {
8526            "提示:切换一次供应商即可重新写入 live 配置。"
8527        } else {
8528            "Tip: switch provider once to re-write the live config."
8529        }
8530    }
8531
8532    pub fn common_config_snippet_apply_not_needed() -> &'static str {
8533        if is_chinese() {
8534            "当前配置已是最新,无需重新应用。"
8535        } else {
8536            "The current live config is already up to date; nothing to apply."
8537        }
8538    }
8539
8540    pub fn confirm_restore() -> &'static str {
8541        if is_chinese() {
8542            "确定要从备份恢复配置吗?"
8543        } else {
8544            "Are you sure you want to restore from backup?"
8545        }
8546    }
8547
8548    pub fn exported_to(path: &str) -> String {
8549        if is_chinese() {
8550            format!("✓ 已导出到 '{}'", path)
8551        } else {
8552            format!("✓ Exported to '{}'", path)
8553        }
8554    }
8555
8556    pub fn imported_from(path: &str) -> String {
8557        if is_chinese() {
8558            format!("✓ 已从 '{}' 导入", path)
8559        } else {
8560            format!("✓ Imported from '{}'", path)
8561        }
8562    }
8563
8564    pub fn backup_created(id: &str) -> String {
8565        if is_chinese() {
8566            format!("✓ 已创建备份,ID: {}", id)
8567        } else {
8568            format!("✓ Backup created, ID: {}", id)
8569        }
8570    }
8571
8572    pub fn restored_from(path: &str) -> String {
8573        if is_chinese() {
8574            format!("✓ 已从 '{}' 恢复", path)
8575        } else {
8576            format!("✓ Restored from '{}'", path)
8577        }
8578    }
8579
8580    pub fn config_valid() -> &'static str {
8581        if is_chinese() {
8582            "✓ 配置文件有效"
8583        } else {
8584            "✓ Configuration is valid"
8585        }
8586    }
8587
8588    pub fn config_reset_done() -> &'static str {
8589        if is_chinese() {
8590            "✓ 配置已重置为默认值"
8591        } else {
8592            "✓ Configuration reset to defaults"
8593        }
8594    }
8595
8596    pub fn file_overwrite_confirm(path: &str) -> String {
8597        if is_chinese() {
8598            format!("文件 '{}' 已存在,是否覆盖?", path)
8599        } else {
8600            format!("File '{}' exists. Overwrite?", path)
8601        }
8602    }
8603
8604    // MCP Management Additional
8605    pub fn mcp_delete_server() -> &'static str {
8606        if is_chinese() {
8607            "🗑️  删除服务器"
8608        } else {
8609            "🗑️  Delete Server"
8610        }
8611    }
8612
8613    pub fn mcp_enable_server() -> &'static str {
8614        if is_chinese() {
8615            "✅ 启用服务器"
8616        } else {
8617            "✅ Enable Server"
8618        }
8619    }
8620
8621    pub fn mcp_disable_server() -> &'static str {
8622        if is_chinese() {
8623            "❌ 禁用服务器"
8624        } else {
8625            "❌ Disable Server"
8626        }
8627    }
8628
8629    pub fn mcp_import_servers() -> &'static str {
8630        if is_chinese() {
8631            "📥 导入已有 MCP 服务器"
8632        } else {
8633            "📥 Import Existing MCP Servers"
8634        }
8635    }
8636
8637    pub fn mcp_validate_command() -> &'static str {
8638        if is_chinese() {
8639            "✓ 验证命令"
8640        } else {
8641            "✓ Validate Command"
8642        }
8643    }
8644
8645    pub fn select_server_to_delete() -> &'static str {
8646        if is_chinese() {
8647            "选择要删除的服务器:"
8648        } else {
8649            "Select server to delete:"
8650        }
8651    }
8652
8653    pub fn select_server_to_enable() -> &'static str {
8654        if is_chinese() {
8655            "选择要启用的服务器:"
8656        } else {
8657            "Select server to enable:"
8658        }
8659    }
8660
8661    pub fn select_server_to_disable() -> &'static str {
8662        if is_chinese() {
8663            "选择要禁用的服务器:"
8664        } else {
8665            "Select server to disable:"
8666        }
8667    }
8668
8669    pub fn select_apps_to_enable() -> &'static str {
8670        if is_chinese() {
8671            "选择要启用的应用:"
8672        } else {
8673            "Select apps to enable for:"
8674        }
8675    }
8676
8677    pub fn select_apps_to_disable() -> &'static str {
8678        if is_chinese() {
8679            "选择要禁用的应用:"
8680        } else {
8681            "Select apps to disable for:"
8682        }
8683    }
8684
8685    pub fn enter_command_to_validate() -> &'static str {
8686        if is_chinese() {
8687            "输入要验证的命令:"
8688        } else {
8689            "Enter command to validate:"
8690        }
8691    }
8692
8693    pub fn server_deleted(id: &str) -> String {
8694        if is_chinese() {
8695            format!("✓ 已删除服务器 '{}'", id)
8696        } else {
8697            format!("✓ Deleted server '{}'", id)
8698        }
8699    }
8700
8701    pub fn server_enabled(id: &str) -> String {
8702        if is_chinese() {
8703            format!("✓ 已启用服务器 '{}'", id)
8704        } else {
8705            format!("✓ Enabled server '{}'", id)
8706        }
8707    }
8708
8709    pub fn server_disabled(id: &str) -> String {
8710        if is_chinese() {
8711            format!("✓ 已禁用服务器 '{}'", id)
8712        } else {
8713            format!("✓ Disabled server '{}'", id)
8714        }
8715    }
8716
8717    pub fn servers_imported(count: usize) -> String {
8718        if is_chinese() {
8719            format!("✓ 已导入 {count} 个 MCP 服务器")
8720        } else {
8721            format!("✓ Imported {count} MCP server(s)")
8722        }
8723    }
8724
8725    pub fn command_valid(cmd: &str) -> String {
8726        if is_chinese() {
8727            format!("✓ 命令 '{}' 有效", cmd)
8728        } else {
8729            format!("✓ Command '{}' is valid", cmd)
8730        }
8731    }
8732
8733    pub fn command_invalid(cmd: &str) -> String {
8734        if is_chinese() {
8735            format!("✗ 命令 '{}' 未找到", cmd)
8736        } else {
8737            format!("✗ Command '{}' not found", cmd)
8738        }
8739    }
8740
8741    // Prompts Management Additional
8742    pub fn prompts_show_content() -> &'static str {
8743        if is_chinese() {
8744            "👁️  查看完整内容"
8745        } else {
8746            "👁️  View Full Content"
8747        }
8748    }
8749
8750    pub fn prompts_delete() -> &'static str {
8751        if is_chinese() {
8752            "🗑️  删除提示词"
8753        } else {
8754            "🗑️  Delete Prompt"
8755        }
8756    }
8757
8758    pub fn prompts_view_current() -> &'static str {
8759        if is_chinese() {
8760            "📋 查看当前提示词"
8761        } else {
8762            "📋 View Current Prompt"
8763        }
8764    }
8765
8766    pub fn select_prompt_to_view() -> &'static str {
8767        if is_chinese() {
8768            "选择要查看的提示词:"
8769        } else {
8770            "Select prompt to view:"
8771        }
8772    }
8773
8774    pub fn select_prompt_to_delete() -> &'static str {
8775        if is_chinese() {
8776            "选择要删除的提示词:"
8777        } else {
8778            "Select prompt to delete:"
8779        }
8780    }
8781
8782    pub fn prompt_deleted(id: &str) -> String {
8783        if is_chinese() {
8784            format!("✓ 已删除提示词 '{}'", id)
8785        } else {
8786            format!("✓ Deleted prompt '{}'", id)
8787        }
8788    }
8789
8790    pub fn no_active_prompt() -> &'static str {
8791        if is_chinese() {
8792            "当前没有激活的提示词。"
8793        } else {
8794            "No active prompt."
8795        }
8796    }
8797
8798    pub fn cannot_delete_active() -> &'static str {
8799        if is_chinese() {
8800            "无法删除当前激活的提示词。"
8801        } else {
8802            "Cannot delete the active prompt."
8803        }
8804    }
8805
8806    pub fn no_servers_to_delete() -> &'static str {
8807        if is_chinese() {
8808            "没有可删除的服务器。"
8809        } else {
8810            "No servers to delete."
8811        }
8812    }
8813
8814    pub fn no_prompts_to_delete() -> &'static str {
8815        if is_chinese() {
8816            "没有可删除的提示词。"
8817        } else {
8818            "No prompts to delete."
8819        }
8820    }
8821
8822    // Provider Speedtest
8823    pub fn speedtest_endpoint() -> &'static str {
8824        if is_chinese() {
8825            "🚀 测试端点速度"
8826        } else {
8827            "🚀 Speedtest endpoint"
8828        }
8829    }
8830
8831    pub fn back() -> &'static str {
8832        if is_chinese() {
8833            "← 返回"
8834        } else {
8835            "← Back"
8836        }
8837    }
8838
8839    // ============================================
8840    // TUI UPDATE (TUI 自更新)
8841    // ============================================
8842
8843    pub fn tui_settings_check_for_updates() -> &'static str {
8844        if is_chinese() {
8845            "检查更新"
8846        } else {
8847            "Check for Updates"
8848        }
8849    }
8850
8851    pub fn tui_update_checking_title() -> &'static str {
8852        if is_chinese() {
8853            "检查更新中"
8854        } else {
8855            "Checking for Updates"
8856        }
8857    }
8858
8859    pub fn tui_update_available_title() -> &'static str {
8860        if is_chinese() {
8861            "发现新版本"
8862        } else {
8863            "Update Available"
8864        }
8865    }
8866
8867    pub fn tui_update_downloading_title() -> &'static str {
8868        if is_chinese() {
8869            "正在更新"
8870        } else {
8871            "Updating"
8872        }
8873    }
8874
8875    pub fn tui_update_result_title() -> &'static str {
8876        if is_chinese() {
8877            "更新结果"
8878        } else {
8879            "Update Result"
8880        }
8881    }
8882
8883    pub fn tui_update_version_info(current: &str, new: &str) -> String {
8884        if is_chinese() {
8885            format!("当前: v{current}  →  最新: {new}")
8886        } else {
8887            format!("Current: v{current}  →  Latest: {new}")
8888        }
8889    }
8890
8891    pub fn tui_update_btn_update() -> &'static str {
8892        if is_chinese() {
8893            "更新"
8894        } else {
8895            "Update"
8896        }
8897    }
8898
8899    pub fn tui_update_btn_cancel() -> &'static str {
8900        if is_chinese() {
8901            "取消"
8902        } else {
8903            "Cancel"
8904        }
8905    }
8906
8907    pub fn tui_update_downloading_kb(kb: u64) -> String {
8908        if is_chinese() {
8909            format!("已下载 {kb} KB")
8910        } else {
8911            format!("Downloaded {kb} KB")
8912        }
8913    }
8914
8915    pub fn tui_update_downloading_progress(pct: u64, downloaded_kb: u64, total_kb: u64) -> String {
8916        if is_chinese() {
8917            format!("{pct}%  ({downloaded_kb} / {total_kb} KB)")
8918        } else {
8919            format!("{pct}%  ({downloaded_kb} / {total_kb} KB)")
8920        }
8921    }
8922
8923    pub fn tui_update_success(tag: &str) -> String {
8924        if is_chinese() {
8925            format!("已更新到 {tag},按 Enter 退出")
8926        } else {
8927            format!("Updated to {tag}. Press Enter to exit.")
8928        }
8929    }
8930
8931    pub fn tui_update_err_worker_unavailable() -> &'static str {
8932        if is_chinese() {
8933            "更新服务不可用"
8934        } else {
8935            "Update worker unavailable"
8936        }
8937    }
8938
8939    pub fn tui_update_err_check_first() -> &'static str {
8940        if is_chinese() {
8941            "请先检查更新"
8942        } else {
8943            "Please check for updates first"
8944        }
8945    }
8946
8947    pub fn tui_toast_already_latest(v: &str) -> String {
8948        if is_chinese() {
8949            format!("已是最新版本 v{v}")
8950        } else {
8951            format!("Already on latest v{v}")
8952        }
8953    }
8954
8955    pub fn tui_toast_update_downgrade(current: &str, target: &str) -> String {
8956        if is_chinese() {
8957            format!("当前 v{current} 比 {target} 更新")
8958        } else {
8959            format!("Current v{current} is newer than {target}")
8960        }
8961    }
8962
8963    pub fn tui_toast_update_check_failed(err: &str) -> String {
8964        if is_chinese() {
8965            format!("检查更新失败: {err}")
8966        } else {
8967            format!("Update check failed: {err}")
8968        }
8969    }
8970
8971    pub fn tui_key_hide() -> &'static str {
8972        if is_chinese() {
8973            "隐藏"
8974        } else {
8975            "hide"
8976        }
8977    }
8978
8979    pub fn tui_toast_update_bg_success(tag: &str) -> String {
8980        if is_chinese() {
8981            format!("后台更新到 {tag} 完成")
8982        } else {
8983            format!("Background update to {tag} complete")
8984        }
8985    }
8986
8987    pub fn tui_toast_update_bg_failed(err: &str) -> String {
8988        if is_chinese() {
8989            format!("后台更新失败: {err}")
8990        } else {
8991            format!("Background update failed: {err}")
8992        }
8993    }
8994
8995    pub fn tui_toast_provider_live_config_imported() -> &'static str {
8996        if is_chinese() {
8997            "已将当前 live 配置导入为供应商"
8998        } else {
8999            "Imported the current live config as a provider"
9000        }
9001    }
9002
9003    pub fn tui_toast_codex_live_config_imported() -> &'static str {
9004        if is_chinese() {
9005            "已将当前 Codex live 配置导入为供应商"
9006        } else {
9007            "Imported the current Codex live config as a provider"
9008        }
9009    }
9010
9011    pub fn tui_toast_no_live_config_imported() -> &'static str {
9012        if is_chinese() {
9013            "没有可导入的 live 供应商"
9014        } else {
9015            "No live providers were imported"
9016        }
9017    }
9018}
9019
9020#[cfg(test)]
9021mod tests {
9022    use super::{texts, use_test_language, Language};
9023    use std::sync::mpsc;
9024    use std::thread;
9025
9026    #[test]
9027    fn website_url_label_keeps_optional_with_abbrev() {
9028        let label = texts::website_url_label();
9029        assert_eq!(label, "Website URL (opt.):");
9030        assert!(label.contains("(opt.)"));
9031        assert!(!label.contains("(optional)"));
9032    }
9033
9034    #[test]
9035    fn chinese_tui_copy_avoids_key_mixed_english_labels() {
9036        let _lang = use_test_language(Language::Chinese);
9037
9038        assert_eq!(texts::tui_home_section_connection(), "连接信息");
9039        assert_eq!(texts::tui_home_status_online(), "在线");
9040        assert_eq!(texts::tui_home_status_offline(), "离线");
9041        assert_eq!(texts::tui_label_mcp_servers_active(), "已启用");
9042        assert_eq!(texts::skills_management(), "技能管理");
9043        assert_eq!(texts::menu_manage_mcp(), "🔌 MCP 服务器");
9044
9045        let help = texts::tui_help_text();
9046        assert!(help.contains("文本输入:Ctrl+A/E 行首/行尾"));
9047        assert!(help.contains("供应商:Enter 详情"));
9048        assert!(help.contains("供应商详情:Space 切换"));
9049        assert!(help.contains("提示词:c 新建,r 刷新,Enter 查看"));
9050        assert!(help.contains("技能:Enter 详情"));
9051        assert!(help.contains("配置:Enter 打开/执行"));
9052        assert!(help.contains("设置:Enter 应用"));
9053        assert!(!help.contains("Text input:"));
9054        assert!(!help.contains("Providers:"));
9055        assert!(!help.contains("Provider Detail:"));
9056        assert!(!help.contains("Skills:"));
9057        assert!(!help.contains("Config:"));
9058        assert!(!help.contains("Settings:"));
9059    }
9060
9061    #[test]
9062    fn proxy_dashboard_copy_is_fully_localized_in_chinese() {
9063        let _lang = use_test_language(Language::Chinese);
9064
9065        assert_eq!(texts::tui_home_section_connection(), "连接信息");
9066        assert_eq!(
9067            texts::tui_proxy_dashboard_failover_copy(),
9068            "仅做手动路由,不会自动切换供应商。"
9069        );
9070        assert_eq!(
9071            texts::tui_proxy_dashboard_manual_routing_copy("Claude"),
9072            "手动路由:Claude 的流量会通过 cc-switch。"
9073        );
9074    }
9075
9076    #[test]
9077    fn openclaw_provider_status_copy_is_fully_localized_in_chinese() {
9078        let _lang = use_test_language(Language::Chinese);
9079
9080        assert_eq!(texts::tui_label_openclaw_status(), "状态");
9081        assert_eq!(texts::tui_label_openclaw_model(), "模型");
9082        assert_eq!(texts::tui_openclaw_status_default(), "默认");
9083        assert_eq!(
9084            texts::tui_openclaw_status_in_config_and_saved(),
9085            "配置中 + 已保存"
9086        );
9087        assert_eq!(texts::tui_openclaw_status_live_only(), "仅当前配置");
9088        assert_eq!(texts::tui_openclaw_status_saved_only(), "仅已保存");
9089        assert_eq!(texts::tui_openclaw_status_untracked(), "未跟踪");
9090    }
9091
9092    #[test]
9093    fn test_language_override_does_not_leak_across_threads() {
9094        let _lang = use_test_language(Language::English);
9095        let (ready_tx, ready_rx) = mpsc::channel();
9096        let (release_tx, release_rx) = mpsc::channel();
9097
9098        let handle = thread::spawn(move || {
9099            let _lang = use_test_language(Language::Chinese);
9100            ready_tx.send(()).expect("signal ready");
9101            release_rx.recv().expect("wait for release");
9102        });
9103
9104        ready_rx.recv().expect("wait for child language override");
9105
9106        assert_eq!(
9107            texts::tui_home_section_connection(),
9108            "Connection Details",
9109            "child thread language override should not affect this test thread"
9110        );
9111
9112        release_tx.send(()).expect("release child thread");
9113        handle.join().expect("join child thread");
9114    }
9115}