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_resolve() -> &'static str {
2510        if is_chinese() {
2511            "解决"
2512        } else {
2513            "resolve"
2514        }
2515    }
2516
2517    pub fn tui_key_activate() -> &'static str {
2518        if is_chinese() {
2519            "激活"
2520        } else {
2521            "activate"
2522        }
2523    }
2524
2525    pub fn tui_key_deactivate() -> &'static str {
2526        if is_chinese() {
2527            "取消激活"
2528        } else {
2529            "deactivate"
2530        }
2531    }
2532
2533    pub fn tui_key_open() -> &'static str {
2534        if is_chinese() {
2535            "打开"
2536        } else {
2537            "open"
2538        }
2539    }
2540
2541    pub fn tui_key_open_directory() -> &'static str {
2542        if is_chinese() {
2543            "打开目录"
2544        } else {
2545            "open dir"
2546        }
2547    }
2548
2549    pub fn tui_key_create() -> &'static str {
2550        if is_chinese() {
2551            "新建"
2552        } else {
2553            "create"
2554        }
2555    }
2556
2557    pub fn tui_key_rename() -> &'static str {
2558        if is_chinese() {
2559            "重命名"
2560        } else {
2561            "rename"
2562        }
2563    }
2564
2565    pub fn tui_key_apply() -> &'static str {
2566        if is_chinese() {
2567            "应用"
2568        } else {
2569            "apply"
2570        }
2571    }
2572
2573    pub fn tui_key_edit_snippet() -> &'static str {
2574        if is_chinese() {
2575            "编辑片段"
2576        } else {
2577            "edit snippet"
2578        }
2579    }
2580
2581    pub fn tui_key_close() -> &'static str {
2582        if is_chinese() {
2583            "关闭"
2584        } else {
2585            "close"
2586        }
2587    }
2588
2589    pub fn tui_key_exit() -> &'static str {
2590        if is_chinese() {
2591            "退出"
2592        } else {
2593            "exit"
2594        }
2595    }
2596
2597    pub fn tui_key_cancel() -> &'static str {
2598        if is_chinese() {
2599            "取消"
2600        } else {
2601            "cancel"
2602        }
2603    }
2604
2605    pub fn tui_key_submit() -> &'static str {
2606        if is_chinese() {
2607            "提交"
2608        } else {
2609            "submit"
2610        }
2611    }
2612
2613    pub fn tui_key_yes() -> &'static str {
2614        if is_chinese() {
2615            "确认"
2616        } else {
2617            "confirm"
2618        }
2619    }
2620
2621    pub fn tui_key_no() -> &'static str {
2622        if is_chinese() {
2623            "返回"
2624        } else {
2625            "back"
2626        }
2627    }
2628
2629    pub fn tui_key_scroll() -> &'static str {
2630        if is_chinese() {
2631            "滚动"
2632        } else {
2633            "scroll"
2634        }
2635    }
2636
2637    pub fn tui_key_restore() -> &'static str {
2638        if is_chinese() {
2639            "恢复"
2640        } else {
2641            "restore"
2642        }
2643    }
2644
2645    pub fn tui_key_takeover() -> &'static str {
2646        if is_chinese() {
2647            "接管"
2648        } else {
2649            "take over"
2650        }
2651    }
2652
2653    pub fn tui_key_save() -> &'static str {
2654        if is_chinese() {
2655            "保存"
2656        } else {
2657            "save"
2658        }
2659    }
2660
2661    pub fn tui_key_external_editor() -> &'static str {
2662        if is_chinese() {
2663            "外部编辑器"
2664        } else {
2665            "external editor"
2666        }
2667    }
2668
2669    pub fn tui_key_save_and_exit() -> &'static str {
2670        if is_chinese() {
2671            "保存并退出"
2672        } else {
2673            "save & exit"
2674        }
2675    }
2676
2677    pub fn tui_key_exit_without_save() -> &'static str {
2678        if is_chinese() {
2679            "不保存退出"
2680        } else {
2681            "exit w/o save"
2682        }
2683    }
2684
2685    pub fn tui_key_edit_mode() -> &'static str {
2686        if is_chinese() {
2687            "编辑"
2688        } else {
2689            "edit"
2690        }
2691    }
2692
2693    pub fn tui_key_clear() -> &'static str {
2694        if is_chinese() {
2695            "清除"
2696        } else {
2697            "clear"
2698        }
2699    }
2700
2701    pub fn tui_key_move() -> &'static str {
2702        if is_chinese() {
2703            "移动"
2704        } else {
2705            "move"
2706        }
2707    }
2708
2709    pub fn tui_key_exit_edit() -> &'static str {
2710        if is_chinese() {
2711            "退出编辑"
2712        } else {
2713            "exit edit"
2714        }
2715    }
2716
2717    pub fn tui_key_select() -> &'static str {
2718        if is_chinese() {
2719            "选择"
2720        } else {
2721            "select"
2722        }
2723    }
2724
2725    pub fn tui_key_edges() -> &'static str {
2726        if is_chinese() {
2727            "首尾"
2728        } else {
2729            "top/end"
2730        }
2731    }
2732
2733    pub fn tui_key_fetch_model() -> &'static str {
2734        if is_chinese() {
2735            "获取模型"
2736        } else {
2737            "fetch model"
2738        }
2739    }
2740
2741    pub fn tui_key_deactivate_active() -> &'static str {
2742        if is_chinese() {
2743            "取消激活(当前)"
2744        } else {
2745            "deactivate active"
2746        }
2747    }
2748
2749    pub fn tui_provider_list_keys() -> &'static str {
2750        if is_chinese() {
2751            "按键:a=新增  e=编辑  Enter=详情  s=切换  /=搜索"
2752        } else {
2753            "Keys: a=add  e=edit  Enter=details  s=switch  /=filter"
2754        }
2755    }
2756
2757    pub fn tui_home_ascii_logo() -> &'static str {
2758        // Same ASCII art across languages.
2759        r#"                                  _  _         _
2760   ___  ___        ___ __      __(_)| |_  ___ | |__
2761  / __|/ __|_____ / __|\ \ /\ / /| || __|/ __|| '_ \
2762 | (__| (__|_____|\__ \ \ V  V / | || |_| (__ | | | |
2763  \___|\___|      |___/  \_/\_/  |_| \__|\___||_| |_|
2764                                                      "#
2765    }
2766
2767    pub fn tui_common_snippet_keys() -> &'static str {
2768        if is_chinese() {
2769            "按键:e=编辑  c=清除  a=应用  Esc=返回"
2770        } else {
2771            "Keys: e=edit  c=clear  a=apply  Esc=back"
2772        }
2773    }
2774
2775    pub fn tui_view_config_app(app: &str) -> String {
2776        if is_chinese() {
2777            format!("应用: {}", app)
2778        } else {
2779            format!("App: {}", app)
2780        }
2781    }
2782
2783    pub fn tui_view_config_provider(provider: &str) -> String {
2784        if is_chinese() {
2785            format!("供应商: {}", provider)
2786        } else {
2787            format!("Provider: {}", provider)
2788        }
2789    }
2790
2791    pub fn tui_view_config_api_url(url: &str) -> String {
2792        if is_chinese() {
2793            format!("API URL:  {}", url)
2794        } else {
2795            format!("API URL:  {}", url)
2796        }
2797    }
2798
2799    pub fn tui_view_config_mcp_servers(enabled: usize, total: usize) -> String {
2800        if is_chinese() {
2801            format!("MCP 服务器: {} 启用 / {} 总数", enabled, total)
2802        } else {
2803            format!("MCP servers: {} enabled / {} total", enabled, total)
2804        }
2805    }
2806
2807    pub fn tui_view_config_prompts(active: &str) -> String {
2808        if is_chinese() {
2809            format!("提示词: {}", active)
2810        } else {
2811            format!("Prompts: {}", active)
2812        }
2813    }
2814
2815    pub fn tui_view_config_config_file(path: &str) -> String {
2816        if is_chinese() {
2817            format!("配置文件: {}", path)
2818        } else {
2819            format!("Config file: {}", path)
2820        }
2821    }
2822
2823    pub fn tui_settings_header_language() -> &'static str {
2824        if is_chinese() {
2825            "语言"
2826        } else {
2827            "Language"
2828        }
2829    }
2830
2831    pub fn tui_settings_header_setting() -> &'static str {
2832        if is_chinese() {
2833            "设置项"
2834        } else {
2835            "Setting"
2836        }
2837    }
2838
2839    pub fn tui_settings_header_value() -> &'static str {
2840        if is_chinese() {
2841            "值"
2842        } else {
2843            "Value"
2844        }
2845    }
2846
2847    pub fn tui_settings_title() -> &'static str {
2848        if is_chinese() {
2849            "设置"
2850        } else {
2851            "Settings"
2852        }
2853    }
2854
2855    pub fn tui_settings_visible_apps_label() -> &'static str {
2856        if is_chinese() {
2857            "可见应用"
2858        } else {
2859            "Visible Apps"
2860        }
2861    }
2862
2863    pub fn tui_settings_visible_apps_title() -> &'static str {
2864        if is_chinese() {
2865            "选择可见应用"
2866        } else {
2867            "Choose Visible Apps"
2868        }
2869    }
2870
2871    pub fn tui_settings_proxy_title() -> &'static str {
2872        if is_chinese() {
2873            "本地代理"
2874        } else {
2875            "Local Proxy"
2876        }
2877    }
2878
2879    pub fn tui_settings_proxy_listen_address_label() -> &'static str {
2880        if is_chinese() {
2881            "监听地址"
2882        } else {
2883            "Listen Address"
2884        }
2885    }
2886
2887    pub fn tui_settings_proxy_listen_port_label() -> &'static str {
2888        if is_chinese() {
2889            "监听端口"
2890        } else {
2891            "Listen Port"
2892        }
2893    }
2894
2895    pub fn tui_settings_proxy_listen_address_prompt() -> &'static str {
2896        if is_chinese() {
2897            "输入监听地址(如 127.0.0.1 / localhost / 0.0.0.0)"
2898        } else {
2899            "Enter listen address (for example 127.0.0.1 / localhost / 0.0.0.0)"
2900        }
2901    }
2902
2903    pub fn tui_settings_proxy_listen_port_prompt() -> &'static str {
2904        if is_chinese() {
2905            "输入监听端口(1024-65535)"
2906        } else {
2907            "Enter listen port (1024-65535)"
2908        }
2909    }
2910
2911    pub fn tui_settings_openclaw_config_dir_label() -> &'static str {
2912        if is_chinese() {
2913            "OpenClaw 配置目录"
2914        } else {
2915            "OpenClaw Config Directory"
2916        }
2917    }
2918
2919    pub fn tui_settings_openclaw_config_dir_prompt() -> &'static str {
2920        if is_chinese() {
2921            "输入 OpenClaw 配置目录;留空恢复默认 ~/.openclaw"
2922        } else {
2923            "Enter the OpenClaw config directory; leave empty to use ~/.openclaw"
2924        }
2925    }
2926
2927    pub fn tui_settings_openclaw_config_dir_default_value() -> &'static str {
2928        "Default (~/.openclaw)"
2929    }
2930
2931    pub fn tui_settings_proxy_restart_hint() -> &'static str {
2932        if is_chinese() {
2933            "修改监听地址或端口后,需先停止并重新开启本地代理才能生效"
2934        } else {
2935            "Changes to listen address or port require stopping and restarting the local proxy"
2936        }
2937    }
2938
2939    pub fn tui_settings_proxy_stop_before_edit_hint() -> &'static str {
2940        if is_chinese() {
2941            "请先停止本地代理,再修改监听地址或端口"
2942        } else {
2943            "Stop the local proxy before editing listen address or port"
2944        }
2945    }
2946
2947    pub fn tui_toast_proxy_listen_address_invalid() -> &'static str {
2948        if is_chinese() {
2949            "地址无效,请输入有效的 IPv4 地址、localhost 或 0.0.0.0"
2950        } else {
2951            "Invalid address. Enter a valid IPv4 address, localhost, or 0.0.0.0"
2952        }
2953    }
2954
2955    pub fn tui_toast_proxy_listen_port_invalid() -> &'static str {
2956        if is_chinese() {
2957            "端口无效,请输入 1024-65535 之间的数字"
2958        } else {
2959            "Invalid port. Enter a number between 1024 and 65535"
2960        }
2961    }
2962
2963    pub fn tui_toast_proxy_settings_saved() -> &'static str {
2964        if is_chinese() {
2965            "本地代理配置已保存。"
2966        } else {
2967            "Local proxy settings saved."
2968        }
2969    }
2970
2971    pub fn tui_toast_proxy_settings_restart_required() -> &'static str {
2972        if is_chinese() {
2973            "本地代理正在运行;新监听地址/端口会在重启代理后生效。"
2974        } else {
2975            "The local proxy is running; the new listen address/port will apply after restart."
2976        }
2977    }
2978
2979    pub fn tui_toast_proxy_settings_stop_before_edit() -> &'static str {
2980        if is_chinese() {
2981            "本地代理正在运行。请先停止代理,再修改监听地址或端口。"
2982        } else {
2983            "The local proxy is running. Stop it before editing listen address or port."
2984        }
2985    }
2986
2987    pub fn tui_toast_openclaw_config_dir_saved() -> &'static str {
2988        if is_chinese() {
2989            "OpenClaw 配置目录已保存。"
2990        } else {
2991            "OpenClaw config directory saved."
2992        }
2993    }
2994
2995    pub fn tui_toast_openclaw_config_dir_sync_skipped() -> &'static str {
2996        if is_chinese() {
2997            "目标 OpenClaw 目录尚未初始化;已保存设置,但暂未同步 live 配置。"
2998        } else {
2999            "The target OpenClaw directory is not initialized yet; the setting was saved but live sync was skipped."
3000        }
3001    }
3002
3003    pub fn tui_toast_openclaw_config_dir_sync_failed(err: &str) -> String {
3004        if is_chinese() {
3005            format!("OpenClaw 配置目录已保存,但同步 live 配置失败: {err}")
3006        } else {
3007            format!("OpenClaw config directory saved, but live sync failed: {err}")
3008        }
3009    }
3010
3011    pub fn tui_toast_visible_apps_zero_selection_warning() -> &'static str {
3012        if is_chinese() {
3013            "至少保留一个可见应用。"
3014        } else {
3015            "Keep at least one app visible."
3016        }
3017    }
3018
3019    pub fn tui_toast_visible_apps_saved() -> &'static str {
3020        if is_chinese() {
3021            "可见应用已保存。"
3022        } else {
3023            "Visible apps saved."
3024        }
3025    }
3026
3027    pub fn tui_config_title() -> &'static str {
3028        if is_chinese() {
3029            "配置"
3030        } else {
3031            "Configuration"
3032        }
3033    }
3034
3035    // ---------------------------------------------------------------------
3036    // Ratatui TUI - Skills
3037    // ---------------------------------------------------------------------
3038
3039    pub fn tui_skills_install_title() -> &'static str {
3040        if is_chinese() {
3041            "安装 Skill"
3042        } else {
3043            "Install Skill"
3044        }
3045    }
3046
3047    pub fn tui_skills_install_prompt() -> &'static str {
3048        if is_chinese() {
3049            "输入技能目录,或完整标识(owner/name:directory):"
3050        } else {
3051            "Enter a skill directory, or a full key (owner/name:directory):"
3052        }
3053    }
3054
3055    pub fn tui_skills_uninstall_title() -> &'static str {
3056        if is_chinese() {
3057            "卸载 Skill"
3058        } else {
3059            "Uninstall Skill"
3060        }
3061    }
3062
3063    pub fn tui_confirm_uninstall_skill_message(name: &str, directory: &str) -> String {
3064        if is_chinese() {
3065            format!("确认卸载 '{name}'({directory})?")
3066        } else {
3067            format!("Uninstall '{name}' ({directory})?")
3068        }
3069    }
3070
3071    pub fn tui_confirm_uninstall_skills_message(count: usize) -> String {
3072        if is_chinese() {
3073            format!("确认卸载选中的 {count} 个 Skill?")
3074        } else {
3075            format!("Uninstall the {count} selected Skills?")
3076        }
3077    }
3078
3079    pub fn tui_skills_discover_title() -> &'static str {
3080        if is_chinese() {
3081            "发现 Skills"
3082        } else {
3083            "Discover Skills"
3084        }
3085    }
3086
3087    pub fn tui_skills_discover_prompt() -> &'static str {
3088        if is_chinese() {
3089            "输入关键词(留空显示全部):"
3090        } else {
3091            "Enter a keyword (leave empty to show all):"
3092        }
3093    }
3094
3095    pub fn tui_skills_discover_query_empty() -> &'static str {
3096        if is_chinese() {
3097            "全部"
3098        } else {
3099            "all"
3100        }
3101    }
3102
3103    pub fn tui_skills_discover_hint() -> &'static str {
3104        if is_chinese() {
3105            "按 f 搜索仓库里的技能,按 r 管理技能仓库。"
3106        } else {
3107            "Press f to search skills from enabled repositories, or r to manage repositories."
3108        }
3109    }
3110
3111    pub fn tui_skills_repos_title() -> &'static str {
3112        if is_chinese() {
3113            "Skill 仓库"
3114        } else {
3115            "Skill Repositories"
3116        }
3117    }
3118
3119    pub fn tui_skills_repos_hint() -> &'static str {
3120        if is_chinese() {
3121            "技能发现会从这里已启用的仓库加载列表。"
3122        } else {
3123            "Skill discovery loads results from the repositories enabled here."
3124        }
3125    }
3126
3127    pub fn tui_skills_repos_empty() -> &'static str {
3128        if is_chinese() {
3129            "未配置任何 Skill 仓库。按 a 添加。"
3130        } else {
3131            "No skill repositories configured. Press a to add."
3132        }
3133    }
3134
3135    pub fn tui_skills_repos_add_title() -> &'static str {
3136        if is_chinese() {
3137            "添加仓库"
3138        } else {
3139            "Add Repository"
3140        }
3141    }
3142
3143    pub fn tui_skills_repos_add_prompt() -> &'static str {
3144        if is_chinese() {
3145            "输入 GitHub 仓库(owner/name,可选 @branch)或完整 URL:"
3146        } else {
3147            "Enter a GitHub repository (owner/name, optional @branch) or a full URL:"
3148        }
3149    }
3150
3151    pub fn tui_skills_repos_remove_title() -> &'static str {
3152        if is_chinese() {
3153            "移除仓库"
3154        } else {
3155            "Remove Repository"
3156        }
3157    }
3158
3159    pub fn tui_confirm_remove_repo_message(owner: &str, name: &str) -> String {
3160        let repo = format!("{owner}/{name}");
3161        if is_chinese() {
3162            format!("确认移除仓库 '{repo}'?")
3163        } else {
3164            format!("Remove repository '{repo}'?")
3165        }
3166    }
3167
3168    pub fn tui_skills_unmanaged_title() -> &'static str {
3169        tui_skills_import_title()
3170    }
3171
3172    pub fn tui_skills_import_title() -> &'static str {
3173        if is_chinese() {
3174            "导入已有技能"
3175        } else {
3176            "Import Existing Skills"
3177        }
3178    }
3179
3180    pub fn tui_skills_agent_import_title() -> &'static str {
3181        if is_chinese() {
3182            "从智能体导入技能"
3183        } else {
3184            "Import Skills from Agent"
3185        }
3186    }
3187
3188    pub fn tui_skills_unmanaged_hint() -> &'static str {
3189        tui_skills_import_description()
3190    }
3191
3192    pub fn tui_skills_import_description() -> &'static str {
3193        if is_chinese() {
3194            "选择要导入到 CC Switch 统一管理的技能。"
3195        } else {
3196            "Select skills to import into CC Switch unified management."
3197        }
3198    }
3199
3200    pub fn tui_skills_agent_import_description() -> &'static str {
3201        if is_chinese() {
3202            "选择要导入到 CC Switch 的智能体技能。"
3203        } else {
3204            "Select agent skills to import into CC Switch."
3205        }
3206    }
3207
3208    pub fn tui_skills_unmanaged_empty() -> &'static str {
3209        if is_chinese() {
3210            "未发现可导入的技能。"
3211        } else {
3212            "No skills to import found."
3213        }
3214    }
3215
3216    pub fn tui_skills_detail_title() -> &'static str {
3217        if is_chinese() {
3218            "Skill 详情"
3219        } else {
3220            "Skill Detail"
3221        }
3222    }
3223
3224    pub fn tui_skill_not_found() -> &'static str {
3225        if is_chinese() {
3226            "未找到该 Skill。"
3227        } else {
3228            "Skill not found."
3229        }
3230    }
3231
3232    pub fn tui_skills_sync_method_label() -> &'static str {
3233        if is_chinese() {
3234            "同步方式"
3235        } else {
3236            "Sync"
3237        }
3238    }
3239
3240    pub fn tui_settings_skill_sync_method_label() -> &'static str {
3241        if is_chinese() {
3242            "技能管理方式"
3243        } else {
3244            "Skill Management"
3245        }
3246    }
3247
3248    pub fn tui_skills_sync_method_title() -> &'static str {
3249        if is_chinese() {
3250            "选择同步方式"
3251        } else {
3252            "Select Sync Method"
3253        }
3254    }
3255
3256    pub fn tui_skills_sync_method_name(method: crate::services::skill::SyncMethod) -> &'static str {
3257        match method {
3258            crate::services::skill::SyncMethod::Auto => {
3259                if is_chinese() {
3260                    "自动(优先使用链接,失败时复制)"
3261                } else {
3262                    "Automatic (prefer links, fall back to copy)"
3263                }
3264            }
3265            crate::services::skill::SyncMethod::Symlink => {
3266                if is_chinese() {
3267                    "仅链接"
3268                } else {
3269                    "Links only"
3270                }
3271            }
3272            crate::services::skill::SyncMethod::Copy => {
3273                if is_chinese() {
3274                    "仅复制"
3275                } else {
3276                    "Copy only"
3277                }
3278            }
3279        }
3280    }
3281
3282    pub fn tui_skills_installed_summary(installed: usize, enabled: usize, app: &str) -> String {
3283        if is_chinese() {
3284            format!("已安装: {installed}   当前应用({app})已启用: {enabled}")
3285        } else {
3286            format!("Installed: {installed}   Enabled for {app}: {enabled}")
3287        }
3288    }
3289
3290    pub fn tui_skills_installed_counts(
3291        claude: usize,
3292        codex: usize,
3293        gemini: usize,
3294        opencode: usize,
3295        openclaw: usize,
3296        hermes: usize,
3297    ) -> String {
3298        if is_chinese() {
3299            format!(
3300                "已安装 · Claude: {claude} · Codex: {codex} · Gemini: {gemini} · OpenCode: {opencode} · OpenClaw: {openclaw} · Hermes: {hermes}"
3301            )
3302        } else {
3303            format!(
3304                "Installed · Claude: {claude} · Codex: {codex} · Gemini: {gemini} · OpenCode: {opencode} · OpenClaw: {openclaw} · Hermes: {hermes}"
3305            )
3306        }
3307    }
3308
3309    pub fn tui_mcp_server_counts(
3310        claude: usize,
3311        codex: usize,
3312        gemini: usize,
3313        opencode: usize,
3314        openclaw: usize,
3315        hermes: usize,
3316    ) -> String {
3317        if is_chinese() {
3318            format!(
3319                "已安装 · Claude: {claude} · Codex: {codex} · Gemini: {gemini} · OpenCode: {opencode} · OpenClaw: {openclaw} · Hermes: {hermes}"
3320            )
3321        } else {
3322            format!(
3323                "Installed · Claude: {claude} · Codex: {codex} · Gemini: {gemini} · OpenCode: {opencode} · OpenClaw: {openclaw} · Hermes: {hermes}"
3324            )
3325        }
3326    }
3327
3328    pub fn tui_mcp_action_import_existing() -> &'static str {
3329        if is_chinese() {
3330            "导入已有"
3331        } else {
3332            "Import Existing"
3333        }
3334    }
3335
3336    pub fn tui_mcp_live_header() -> &'static str {
3337        "Live"
3338    }
3339
3340    pub fn tui_mcp_live_drift_summary(
3341        changed: usize,
3342        live_only: usize,
3343        db_only: usize,
3344        invalid: usize,
3345    ) -> String {
3346        let mut parts = Vec::new();
3347        if changed > 0 {
3348            parts.push(if is_chinese() {
3349                format!("{changed} 已变更")
3350            } else {
3351                format!("{changed} changed")
3352            });
3353        }
3354        if live_only > 0 {
3355            parts.push(if is_chinese() {
3356                format!("{live_only} 仅 live")
3357            } else {
3358                format!("{live_only} live-only")
3359            });
3360        }
3361        if db_only > 0 {
3362            parts.push(if is_chinese() {
3363                format!("{db_only} 缺少 live")
3364            } else {
3365                format!("{db_only} db-only")
3366            });
3367        }
3368        if invalid > 0 {
3369            parts.push(if is_chinese() {
3370                "live 配置无效".to_string()
3371            } else {
3372                "live invalid".to_string()
3373            });
3374        }
3375
3376        if is_chinese() {
3377            format!("Live 漂移:{}", parts.join("、"))
3378        } else {
3379            format!("Live drift: {}", parts.join(", "))
3380        }
3381    }
3382
3383    pub fn tui_mcp_live_drift_resolve_title() -> &'static str {
3384        if is_chinese() {
3385            "解决 MCP Live 漂移"
3386        } else {
3387            "Resolve MCP Live Drift"
3388        }
3389    }
3390
3391    pub fn tui_mcp_live_drift_import_live() -> &'static str {
3392        if is_chinese() {
3393            "从 live 导入到 cc-switch"
3394        } else {
3395            "Import live into cc-switch"
3396        }
3397    }
3398
3399    pub fn tui_mcp_live_drift_push_db() -> &'static str {
3400        if is_chinese() {
3401            "用 cc-switch 覆盖 live"
3402        } else {
3403            "Push cc-switch to live"
3404        }
3405    }
3406
3407    pub fn tui_mcp_live_drift_cancel() -> &'static str {
3408        if is_chinese() {
3409            "暂不处理"
3410        } else {
3411            "Cancel"
3412        }
3413    }
3414
3415    pub fn tui_mcp_live_drift_status(kind: &crate::services::McpLiveDriftKind) -> &'static str {
3416        match kind {
3417            crate::services::McpLiveDriftKind::Changed => {
3418                if is_chinese() {
3419                    "live changed"
3420                } else {
3421                    "live changed"
3422                }
3423            }
3424            crate::services::McpLiveDriftKind::LiveOnly => {
3425                if is_chinese() {
3426                    "live only"
3427                } else {
3428                    "live only"
3429                }
3430            }
3431            crate::services::McpLiveDriftKind::DbOnly => {
3432                if is_chinese() {
3433                    "missing live"
3434                } else {
3435                    "missing live"
3436                }
3437            }
3438            crate::services::McpLiveDriftKind::LiveInvalid => {
3439                if is_chinese() {
3440                    "live invalid"
3441                } else {
3442                    "live invalid"
3443                }
3444            }
3445            _ => {
3446                if is_chinese() {
3447                    "in sync"
3448                } else {
3449                    "in sync"
3450                }
3451            }
3452        }
3453    }
3454
3455    pub fn tui_skills_action_import_existing() -> &'static str {
3456        if is_chinese() {
3457            "导入已有"
3458        } else {
3459            "Import Existing"
3460        }
3461    }
3462
3463    pub fn tui_skills_action_import_agent() -> &'static str {
3464        if is_chinese() {
3465            "从智能体导入"
3466        } else {
3467            "Import from Agent"
3468        }
3469    }
3470
3471    pub fn tui_skills_empty_title() -> &'static str {
3472        if is_chinese() {
3473            "暂无已安装的技能"
3474        } else {
3475            "No installed skills"
3476        }
3477    }
3478
3479    pub fn tui_skills_empty_subtitle() -> &'static str {
3480        if is_chinese() {
3481            "从仓库发现并安装技能,或导入已有技能。"
3482        } else {
3483            "Discover and install skills from repositories, or import existing skills."
3484        }
3485    }
3486
3487    pub fn tui_skills_empty_hint() -> &'static str {
3488        if is_chinese() {
3489            "暂无已安装技能。按 f 发现新技能,或按 i 导入已有技能。"
3490        } else {
3491            "No installed skills. Press f to discover skills, or i to import existing skills."
3492        }
3493    }
3494
3495    pub fn tui_config_item_export() -> &'static str {
3496        if is_chinese() {
3497            "导出配置"
3498        } else {
3499            "Export Config"
3500        }
3501    }
3502
3503    pub fn tui_config_item_import() -> &'static str {
3504        if is_chinese() {
3505            "导入配置"
3506        } else {
3507            "Import Config"
3508        }
3509    }
3510
3511    pub fn tui_config_item_backup() -> &'static str {
3512        if is_chinese() {
3513            "备份配置"
3514        } else {
3515            "Backup Config"
3516        }
3517    }
3518
3519    pub fn tui_config_item_restore() -> &'static str {
3520        if is_chinese() {
3521            "恢复配置"
3522        } else {
3523            "Restore Config"
3524        }
3525    }
3526
3527    pub fn tui_config_item_validate() -> &'static str {
3528        if is_chinese() {
3529            "验证配置"
3530        } else {
3531            "Validate Config"
3532        }
3533    }
3534
3535    pub fn tui_config_item_common_snippet() -> &'static str {
3536        if is_chinese() {
3537            "通用配置片段"
3538        } else {
3539            "Common Config Snippet"
3540        }
3541    }
3542
3543    pub fn tui_config_item_proxy() -> &'static str {
3544        if is_chinese() {
3545            "本地代理"
3546        } else {
3547            "Local Proxy"
3548        }
3549    }
3550
3551    pub fn tui_config_item_openclaw_env() -> &'static str {
3552        if is_chinese() {
3553            "环境变量"
3554        } else {
3555            "Env Variables"
3556        }
3557    }
3558
3559    pub fn tui_config_item_openclaw_workspace() -> &'static str {
3560        if is_chinese() {
3561            "Workspace 文件管理"
3562        } else {
3563            "Workspace Files"
3564        }
3565    }
3566
3567    pub fn tui_config_item_openclaw_tools() -> &'static str {
3568        if is_chinese() {
3569            "工具权限"
3570        } else {
3571            "Tool Permissions"
3572        }
3573    }
3574
3575    pub fn tui_config_item_openclaw_agents() -> &'static str {
3576        if is_chinese() {
3577            "Agents 配置"
3578        } else {
3579            "Agents Config"
3580        }
3581    }
3582
3583    pub fn tui_config_item_webdav_sync() -> &'static str {
3584        if is_chinese() {
3585            "WebDAV 同步"
3586        } else {
3587            "WebDAV Sync"
3588        }
3589    }
3590
3591    pub fn tui_config_item_webdav_settings() -> &'static str {
3592        if is_chinese() {
3593            "WebDAV 同步设置(JSON)"
3594        } else {
3595            "WebDAV Sync Settings (JSON)"
3596        }
3597    }
3598
3599    pub fn tui_config_item_webdav_check_connection() -> &'static str {
3600        if is_chinese() {
3601            "WebDAV 检查连接"
3602        } else {
3603            "WebDAV Check Connection"
3604        }
3605    }
3606
3607    pub fn tui_config_item_webdav_upload() -> &'static str {
3608        if is_chinese() {
3609            "WebDAV 上传到远端"
3610        } else {
3611            "WebDAV Upload to Remote"
3612        }
3613    }
3614
3615    pub fn tui_config_item_webdav_download() -> &'static str {
3616        if is_chinese() {
3617            "WebDAV 下载到本地"
3618        } else {
3619            "WebDAV Download to Local"
3620        }
3621    }
3622
3623    pub fn tui_config_item_webdav_reset() -> &'static str {
3624        if is_chinese() {
3625            "重置 WebDAV 配置"
3626        } else {
3627            "Reset WebDAV Settings"
3628        }
3629    }
3630
3631    pub fn tui_config_item_webdav_jianguoyun_quick_setup() -> &'static str {
3632        if is_chinese() {
3633            "坚果云一键配置"
3634        } else {
3635            "Jianguoyun Quick Setup"
3636        }
3637    }
3638
3639    pub fn tui_webdav_settings_editor_title() -> &'static str {
3640        if is_chinese() {
3641            "编辑 WebDAV 同步设置(JSON)"
3642        } else {
3643            "Edit WebDAV Sync Settings (JSON)"
3644        }
3645    }
3646
3647    pub fn tui_config_webdav_title() -> &'static str {
3648        if is_chinese() {
3649            "WebDAV 同步"
3650        } else {
3651            "WebDAV Sync"
3652        }
3653    }
3654
3655    pub fn tui_openclaw_config_env_title() -> &'static str {
3656        tui_config_item_openclaw_env()
3657    }
3658
3659    pub fn tui_openclaw_workspace_title() -> &'static str {
3660        tui_config_item_openclaw_workspace()
3661    }
3662
3663    pub fn tui_openclaw_workspace_files_block_title() -> &'static str {
3664        if is_chinese() {
3665            "Workspace 文件"
3666        } else {
3667            "Workspace Files"
3668        }
3669    }
3670
3671    pub fn tui_openclaw_workspace_directory_label() -> &'static str {
3672        if is_chinese() {
3673            "工作区目录"
3674        } else {
3675            "Workspace directory"
3676        }
3677    }
3678
3679    pub fn tui_openclaw_workspace_daily_memory_label() -> &'static str {
3680        if is_chinese() {
3681            "Daily Memory"
3682        } else {
3683            "Daily Memory"
3684        }
3685    }
3686
3687    pub fn tui_openclaw_workspace_daily_memory_count(count: usize) -> String {
3688        if is_chinese() {
3689            format!("{count} 个文件")
3690        } else if count == 1 {
3691            "1 file".to_string()
3692        } else {
3693            format!("{count} files")
3694        }
3695    }
3696
3697    pub fn tui_openclaw_workspace_status_exists() -> &'static str {
3698        if is_chinese() {
3699            "已存在"
3700        } else {
3701            "Exists"
3702        }
3703    }
3704
3705    pub fn tui_openclaw_workspace_status_missing() -> &'static str {
3706        if is_chinese() {
3707            "缺失"
3708        } else {
3709            "Missing"
3710        }
3711    }
3712
3713    pub fn tui_openclaw_config_tools_title() -> &'static str {
3714        tui_config_item_openclaw_tools()
3715    }
3716
3717    pub fn tui_openclaw_tools_description() -> &'static str {
3718        if is_chinese() {
3719            "管理 openclaw.json 中的工具权限配置(允许/拒绝列表)"
3720        } else {
3721            "Manage tool permissions in openclaw.json (allow/deny lists)"
3722        }
3723    }
3724
3725    pub fn tui_openclaw_tools_profile_block_title() -> &'static str {
3726        if is_chinese() {
3727            "权限档位"
3728        } else {
3729            "Permission Profile"
3730        }
3731    }
3732
3733    pub fn tui_openclaw_tools_rules_block_title() -> &'static str {
3734        if is_chinese() {
3735            "规则列表"
3736        } else {
3737            "Rule Lists"
3738        }
3739    }
3740
3741    pub fn tui_openclaw_tools_profile_label() -> &'static str {
3742        if is_chinese() {
3743            "配置档位"
3744        } else {
3745            "Profile"
3746        }
3747    }
3748
3749    pub fn tui_openclaw_tools_profile_unset() -> &'static str {
3750        if is_chinese() {
3751            "未设置"
3752        } else {
3753            "Not set"
3754        }
3755    }
3756
3757    pub fn tui_openclaw_tools_profile_minimal() -> &'static str {
3758        if is_chinese() {
3759            "最小权限"
3760        } else {
3761            "Minimal"
3762        }
3763    }
3764
3765    pub fn tui_openclaw_tools_profile_coding() -> &'static str {
3766        if is_chinese() {
3767            "编码"
3768        } else {
3769            "Coding"
3770        }
3771    }
3772
3773    pub fn tui_openclaw_tools_profile_messaging() -> &'static str {
3774        if is_chinese() {
3775            "对话"
3776        } else {
3777            "Messaging"
3778        }
3779    }
3780
3781    pub fn tui_openclaw_tools_profile_full() -> &'static str {
3782        if is_chinese() {
3783            "完全访问"
3784        } else {
3785            "Full"
3786        }
3787    }
3788
3789    pub fn tui_openclaw_tools_unsupported_profile_title() -> &'static str {
3790        if is_chinese() {
3791            "检测到不受支持的工具配置"
3792        } else {
3793            "Unsupported tools profile detected"
3794        }
3795    }
3796
3797    pub fn tui_openclaw_tools_unsupported_profile_description(value: &str) -> String {
3798        if is_chinese() {
3799            format!(
3800                "当前 tools.profile 的值“{value}”不在 OpenClaw 支持列表内。在你手动选择新值之前,它会被保留。"
3801            )
3802        } else {
3803            format!(
3804                "The current tools.profile value '{value}' is not in the supported OpenClaw list. It will be preserved until you choose a new value."
3805            )
3806        }
3807    }
3808
3809    pub fn tui_openclaw_tools_unsupported_profile_label() -> &'static str {
3810        if is_chinese() {
3811            "不受支持"
3812        } else {
3813            "unsupported"
3814        }
3815    }
3816
3817    pub fn tui_openclaw_tools_allow_list_label() -> &'static str {
3818        if is_chinese() {
3819            "允许列表"
3820        } else {
3821            "Allow List"
3822        }
3823    }
3824
3825    pub fn tui_openclaw_tools_deny_list_label() -> &'static str {
3826        if is_chinese() {
3827            "拒绝列表"
3828        } else {
3829            "Deny List"
3830        }
3831    }
3832
3833    pub fn tui_openclaw_tools_pattern_placeholder() -> &'static str {
3834        if is_chinese() {
3835            "工具名称或模式"
3836        } else {
3837            "Tool name or pattern"
3838        }
3839    }
3840
3841    pub fn tui_openclaw_tools_add_allow_rule() -> &'static str {
3842        if is_chinese() {
3843            "+ 添加允许规则"
3844        } else {
3845            "+ Add allow rule"
3846        }
3847    }
3848
3849    pub fn tui_openclaw_tools_add_deny_rule() -> &'static str {
3850        if is_chinese() {
3851            "+ 添加拒绝规则"
3852        } else {
3853            "+ Add deny rule"
3854        }
3855    }
3856
3857    pub fn tui_openclaw_tools_extra_fields_label() -> &'static str {
3858        if is_chinese() {
3859            "保留的其他字段"
3860        } else {
3861            "Preserved extra fields"
3862        }
3863    }
3864
3865    pub fn tui_openclaw_tools_save_label() -> &'static str {
3866        if is_chinese() {
3867            "保存"
3868        } else {
3869            "Save"
3870        }
3871    }
3872
3873    pub fn tui_openclaw_tools_load_failed_message() -> &'static str {
3874        if is_chinese() {
3875            "当前 tools 配置无法加载;请先修复上方解析警告,再编辑工具权限。"
3876        } else {
3877            "The current tools section could not be loaded. Fix the parse warning above before editing tool permissions."
3878        }
3879    }
3880
3881    pub fn tui_toast_openclaw_tools_save_result(success: bool) -> &'static str {
3882        if success {
3883            if is_chinese() {
3884                "工具权限已保存"
3885            } else {
3886                "Tool permissions saved"
3887            }
3888        } else if is_chinese() {
3889            "保存工具权限失败"
3890        } else {
3891            "Failed to save tool permissions"
3892        }
3893    }
3894
3895    pub fn tui_toast_openclaw_tools_save_failed_detail(err: &str) -> String {
3896        if is_chinese() {
3897            format!("保存工具权限失败: {err}")
3898        } else {
3899            format!("Failed to save tool permissions: {err}")
3900        }
3901    }
3902
3903    pub fn tui_toast_openclaw_tools_save_blocked_parse_error() -> &'static str {
3904        if is_chinese() {
3905            "请先修复 OpenClaw 工具配置解析警告,再保存工具权限"
3906        } else {
3907            "Fix OpenClaw tools parse warnings before saving tool permissions"
3908        }
3909    }
3910
3911    pub fn tui_toast_openclaw_tools_rule_empty() -> &'static str {
3912        if is_chinese() {
3913            "工具规则不能为空"
3914        } else {
3915            "Tool rule cannot be empty"
3916        }
3917    }
3918
3919    pub fn tui_openclaw_agents_description() -> &'static str {
3920        if is_chinese() {
3921            "管理 openclaw.json 中的 agents.defaults 配置(默认模型、运行参数等)"
3922        } else {
3923            "Manage agents.defaults in openclaw.json (default model, runtime parameters, etc.)"
3924        }
3925    }
3926
3927    pub fn tui_openclaw_agents_model_section() -> &'static str {
3928        if is_chinese() {
3929            "模型配置"
3930        } else {
3931            "Model Configuration"
3932        }
3933    }
3934
3935    pub fn tui_openclaw_agents_primary_model() -> &'static str {
3936        if is_chinese() {
3937            "默认模型"
3938        } else {
3939            "Default Model"
3940        }
3941    }
3942
3943    pub fn tui_openclaw_agents_not_set() -> &'static str {
3944        if is_chinese() {
3945            "未设置"
3946        } else {
3947            "Not set"
3948        }
3949    }
3950
3951    pub fn tui_openclaw_agents_fallback_models() -> &'static str {
3952        if is_chinese() {
3953            "回退模型"
3954        } else {
3955            "Fallback Models"
3956        }
3957    }
3958
3959    pub fn tui_openclaw_agents_add_fallback() -> &'static str {
3960        if is_chinese() {
3961            "添加回退模型"
3962        } else {
3963            "Add fallback model"
3964        }
3965    }
3966
3967    pub fn tui_openclaw_agents_add_fallback_disabled() -> &'static str {
3968        if is_chinese() {
3969            "没有可添加的回退模型了"
3970        } else {
3971            "No fallback models available to add"
3972        }
3973    }
3974
3975    pub fn tui_openclaw_agents_not_configured_suffix() -> &'static str {
3976        if is_chinese() {
3977            "供应商未配置"
3978        } else {
3979            "not configured"
3980        }
3981    }
3982
3983    pub fn tui_openclaw_agents_not_in_list(value: &str) -> String {
3984        if is_chinese() {
3985            format!("{value} (供应商未配置)")
3986        } else {
3987            format!("{value} (not configured)")
3988        }
3989    }
3990
3991    pub fn tui_openclaw_agents_runtime_section() -> &'static str {
3992        if is_chinese() {
3993            "运行参数"
3994        } else {
3995            "Runtime Parameters"
3996        }
3997    }
3998
3999    pub fn tui_openclaw_agents_workspace() -> &'static str {
4000        if is_chinese() {
4001            "工作区路径"
4002        } else {
4003            "Workspace Path"
4004        }
4005    }
4006
4007    pub fn tui_openclaw_agents_timeout() -> &'static str {
4008        if is_chinese() {
4009            "超时时间(秒)"
4010        } else {
4011            "Timeout (seconds)"
4012        }
4013    }
4014
4015    pub fn tui_openclaw_agents_context_tokens() -> &'static str {
4016        if is_chinese() {
4017            "上下文 Token 数"
4018        } else {
4019            "Context Tokens"
4020        }
4021    }
4022
4023    pub fn tui_openclaw_agents_max_concurrent() -> &'static str {
4024        if is_chinese() {
4025            "最大并发数"
4026        } else {
4027            "Max Concurrent"
4028        }
4029    }
4030
4031    pub fn tui_openclaw_agents_preserved_non_standard_value(value: &str) -> String {
4032        if is_chinese() {
4033            format!("{value}(已保留的非标准值)")
4034        } else {
4035            format!("{value} (preserved non-standard value)")
4036        }
4037    }
4038
4039    pub fn tui_openclaw_agents_preserved_runtime_notice() -> &'static str {
4040        if is_chinese() {
4041            "非标准运行参数会在你替换它们之前保持原样保存。"
4042        } else {
4043            "Non-standard runtime values are preserved until you replace them."
4044        }
4045    }
4046
4047    pub fn tui_openclaw_agents_preserved_fields_label() -> &'static str {
4048        if is_chinese() {
4049            "保留字段"
4050        } else {
4051            "Preserved Fields"
4052        }
4053    }
4054
4055    pub fn tui_openclaw_agents_legacy_timeout_title() -> &'static str {
4056        if is_chinese() {
4057            "检测到旧版超时字段"
4058        } else {
4059            "Legacy timeout detected"
4060        }
4061    }
4062
4063    pub fn tui_openclaw_agents_legacy_timeout_description() -> &'static str {
4064        if is_chinese() {
4065            "当前配置仍在使用 agents.defaults.timeout。保存本页面时会迁移为 timeoutSeconds。"
4066        } else {
4067            "This config still uses agents.defaults.timeout. Saving here will migrate it to timeoutSeconds."
4068        }
4069    }
4070
4071    pub fn tui_openclaw_agents_legacy_timeout_invalid_description() -> &'static str {
4072        if is_chinese() {
4073            "当前配置仍在使用 agents.defaults.timeout,但该值无法自动迁移。请先改为数字,或清空该字段后再保存。"
4074        } else {
4075            "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."
4076        }
4077    }
4078
4079    pub fn tui_openclaw_agents_load_failed_message() -> &'static str {
4080        if is_chinese() {
4081            "当前 agents.defaults 配置无法加载;请先修复上方解析警告,再编辑 Agents 配置。"
4082        } else {
4083            "The current agents.defaults section could not be loaded. Fix the parse warning above before editing agents defaults."
4084        }
4085    }
4086
4087    pub fn tui_openclaw_agents_save_label() -> &'static str {
4088        if is_chinese() {
4089            "保存"
4090        } else {
4091            "Save"
4092        }
4093    }
4094
4095    pub fn tui_toast_openclaw_agents_save_result(success: bool) -> &'static str {
4096        if success {
4097            if is_chinese() {
4098                "Agents 配置已保存"
4099            } else {
4100                "Agents config saved"
4101            }
4102        } else if is_chinese() {
4103            "保存 Agents 配置失败"
4104        } else {
4105            "Failed to save agents config"
4106        }
4107    }
4108
4109    pub fn tui_toast_openclaw_agents_save_failed_detail(err: &str) -> String {
4110        if is_chinese() {
4111            format!("保存 Agents 配置失败: {err}")
4112        } else {
4113            format!("Failed to save agents config: {err}")
4114        }
4115    }
4116
4117    pub fn tui_toast_openclaw_agents_save_blocked_parse_error() -> &'static str {
4118        if is_chinese() {
4119            "请先修复 OpenClaw agents.defaults 解析警告,再保存 Agents 配置"
4120        } else {
4121            "Fix OpenClaw agents parse warnings before saving agents defaults"
4122        }
4123    }
4124
4125    pub fn tui_toast_openclaw_agents_save_blocked_legacy_timeout() -> &'static str {
4126        if is_chinese() {
4127            "请先处理 agents.defaults.timeout,再保存 Agents 配置"
4128        } else {
4129            "Resolve agents.defaults.timeout before saving agents config"
4130        }
4131    }
4132
4133    pub fn tui_openclaw_config_agents_title() -> &'static str {
4134        tui_config_item_openclaw_agents()
4135    }
4136
4137    pub fn tui_openclaw_config_env_editor_title() -> &'static str {
4138        if is_chinese() {
4139            "编辑环境变量 (JSON)"
4140        } else {
4141            "Edit Env Variables (JSON)"
4142        }
4143    }
4144
4145    pub fn tui_openclaw_config_env_description() -> &'static str {
4146        if is_chinese() {
4147            "管理 openclaw.json 中的环境变量映射;保存时会写回 env.vars。"
4148        } else {
4149            "Manage the environment variable map in openclaw.json; saving writes back to env.vars."
4150        }
4151    }
4152
4153    pub fn tui_openclaw_config_env_empty() -> &'static str {
4154        if is_chinese() {
4155            "未配置环境变量"
4156        } else {
4157            "No environment variables configured"
4158        }
4159    }
4160
4161    pub fn tui_openclaw_config_tools_editor_title() -> &'static str {
4162        if is_chinese() {
4163            "编辑工具权限 (JSON)"
4164        } else {
4165            "Edit Tool Permissions (JSON)"
4166        }
4167    }
4168
4169    pub fn tui_openclaw_config_agents_editor_title() -> &'static str {
4170        if is_chinese() {
4171            "编辑 Agents 配置 (JSON)"
4172        } else {
4173            "Edit Agents Config (JSON)"
4174        }
4175    }
4176
4177    pub fn tui_openclaw_config_warning_title() -> &'static str {
4178        if is_chinese() {
4179            "OpenClaw 配置告警"
4180        } else {
4181            "OpenClaw Health Warnings"
4182        }
4183    }
4184
4185    pub fn tui_openclaw_config_file_label() -> &'static str {
4186        if is_chinese() {
4187            "配置文件"
4188        } else {
4189            "Config file"
4190        }
4191    }
4192
4193    pub fn tui_openclaw_config_section_label() -> &'static str {
4194        if is_chinese() {
4195            "当前配置"
4196        } else {
4197            "Section"
4198        }
4199    }
4200
4201    pub fn tui_openclaw_config_warning_state_label() -> &'static str {
4202        if is_chinese() {
4203            "告警状态"
4204        } else {
4205            "Warnings"
4206        }
4207    }
4208
4209    pub fn tui_openclaw_config_warning_present() -> &'static str {
4210        if is_chinese() {
4211            "发现告警"
4212        } else {
4213            "Warnings detected"
4214        }
4215    }
4216
4217    pub fn tui_openclaw_config_warning_clean() -> &'static str {
4218        if is_chinese() {
4219            "正常"
4220        } else {
4221            "Healthy"
4222        }
4223    }
4224
4225    pub fn tui_openclaw_config_path_not_available() -> &'static str {
4226        if is_chinese() {
4227            "不可用"
4228        } else {
4229            "n/a"
4230        }
4231    }
4232
4233    pub fn tui_toast_openclaw_config_saved(section: &str) -> String {
4234        if is_chinese() {
4235            format!("已保存 {section}")
4236        } else {
4237            format!("Saved {section}")
4238        }
4239    }
4240
4241    pub fn tui_openclaw_workspace_editor_title(filename: &str) -> String {
4242        if is_chinese() {
4243            format!("编辑 Workspace 文件: {filename}")
4244        } else {
4245            format!("Edit Workspace File: {filename}")
4246        }
4247    }
4248
4249    pub fn tui_openclaw_workspace_saved(filename: &str) -> String {
4250        if is_chinese() {
4251            format!("已保存 Workspace 文件: {filename}")
4252        } else {
4253            format!("Saved workspace file: {filename}")
4254        }
4255    }
4256
4257    pub fn tui_openclaw_workspace_open_failed(filename: &str, detail: &str) -> String {
4258        if is_chinese() {
4259            format!("打开 Workspace 文件失败 {filename}: {detail}")
4260        } else {
4261            format!("Failed to open workspace file {filename}: {detail}")
4262        }
4263    }
4264
4265    pub fn tui_openclaw_workspace_save_failed(filename: &str, detail: &str) -> String {
4266        if is_chinese() {
4267            format!("保存 Workspace 文件失败 {filename}: {detail}")
4268        } else {
4269            format!("Failed to save workspace file {filename}: {detail}")
4270        }
4271    }
4272
4273    pub fn tui_openclaw_workspace_refresh_failed(detail: &str) -> String {
4274        if is_chinese() {
4275            format!("刷新 Workspace 状态失败: {detail}")
4276        } else {
4277            format!("Failed to refresh workspace state: {detail}")
4278        }
4279    }
4280
4281    pub fn tui_openclaw_workspace_directory_open_failed(detail: &str) -> String {
4282        if is_chinese() {
4283            format!("打开 Workspace 目录失败: {detail}")
4284        } else {
4285            format!("Failed to open workspace directory: {detail}")
4286        }
4287    }
4288
4289    pub fn tui_openclaw_daily_memory_title() -> &'static str {
4290        if is_chinese() {
4291            "Daily Memory"
4292        } else {
4293            "Daily Memory"
4294        }
4295    }
4296
4297    pub fn tui_openclaw_daily_memory_directory_label() -> &'static str {
4298        if is_chinese() {
4299            "Memory 目录"
4300        } else {
4301            "Memory directory"
4302        }
4303    }
4304
4305    pub fn tui_openclaw_daily_memory_create_title() -> &'static str {
4306        if is_chinese() {
4307            "新建 Daily Memory"
4308        } else {
4309            "Create Daily Memory"
4310        }
4311    }
4312
4313    pub fn tui_openclaw_daily_memory_create_prompt() -> &'static str {
4314        if is_chinese() {
4315            "输入文件名(YYYY-MM-DD.md):"
4316        } else {
4317            "Enter a filename (YYYY-MM-DD.md):"
4318        }
4319    }
4320
4321    pub fn tui_openclaw_daily_memory_invalid_filename() -> &'static str {
4322        if is_chinese() {
4323            "文件名无效,请使用 YYYY-MM-DD.md。"
4324        } else {
4325            "Invalid filename. Use YYYY-MM-DD.md."
4326        }
4327    }
4328
4329    pub fn tui_openclaw_daily_memory_editor_title(filename: &str) -> String {
4330        if is_chinese() {
4331            format!("编辑 Daily Memory: {filename}")
4332        } else {
4333            format!("Edit Daily Memory: {filename}")
4334        }
4335    }
4336
4337    pub fn tui_openclaw_daily_memory_saved(filename: &str) -> String {
4338        if is_chinese() {
4339            format!("已保存 Daily Memory: {filename}")
4340        } else {
4341            format!("Saved daily memory: {filename}")
4342        }
4343    }
4344
4345    pub fn tui_openclaw_daily_memory_open_failed(filename: &str, detail: &str) -> String {
4346        if is_chinese() {
4347            format!("打开 Daily Memory 失败 {filename}: {detail}")
4348        } else {
4349            format!("Failed to open daily memory {filename}: {detail}")
4350        }
4351    }
4352
4353    pub fn tui_openclaw_daily_memory_save_failed(filename: &str, detail: &str) -> String {
4354        if is_chinese() {
4355            format!("保存 Daily Memory 失败 {filename}: {detail}")
4356        } else {
4357            format!("Failed to save daily memory {filename}: {detail}")
4358        }
4359    }
4360
4361    pub fn tui_openclaw_daily_memory_deleted(filename: &str) -> String {
4362        if is_chinese() {
4363            format!("已删除 Daily Memory: {filename}")
4364        } else {
4365            format!("Deleted daily memory: {filename}")
4366        }
4367    }
4368
4369    pub fn tui_openclaw_daily_memory_delete_failed(filename: &str, detail: &str) -> String {
4370        if is_chinese() {
4371            format!("删除 Daily Memory 失败 {filename}: {detail}")
4372        } else {
4373            format!("Failed to delete daily memory {filename}: {detail}")
4374        }
4375    }
4376
4377    pub fn tui_openclaw_daily_memory_search_failed(detail: &str) -> String {
4378        if is_chinese() {
4379            format!("搜索 Daily Memory 失败: {detail}")
4380        } else {
4381            format!("Failed to search daily memory: {detail}")
4382        }
4383    }
4384
4385    pub fn tui_openclaw_daily_memory_refresh_failed(detail: &str) -> String {
4386        if is_chinese() {
4387            format!("刷新 Daily Memory 列表失败: {detail}")
4388        } else {
4389            format!("Failed to refresh daily memory list: {detail}")
4390        }
4391    }
4392
4393    pub fn tui_openclaw_daily_memory_delete_title() -> &'static str {
4394        if is_chinese() {
4395            "删除 Daily Memory"
4396        } else {
4397            "Delete Daily Memory"
4398        }
4399    }
4400
4401    pub fn tui_openclaw_daily_memory_delete_message(filename: &str) -> String {
4402        if is_chinese() {
4403            format!("确认删除 {filename}?")
4404        } else {
4405            format!("Delete {filename}?")
4406        }
4407    }
4408
4409    pub fn tui_openclaw_memory_directory_open_failed(detail: &str) -> String {
4410        if is_chinese() {
4411            format!("打开 Memory 目录失败: {detail}")
4412        } else {
4413            format!("Failed to open memory directory: {detail}")
4414        }
4415    }
4416
4417    pub fn tui_openclaw_daily_memory_empty() -> &'static str {
4418        if is_chinese() {
4419            "还没有 Daily Memory 文件。按 a 新建。"
4420        } else {
4421            "No daily memory files yet. Press a to create one."
4422        }
4423    }
4424
4425    pub fn tui_openclaw_daily_memory_search_empty() -> &'static str {
4426        if is_chinese() {
4427            "没有匹配的 Daily Memory 文件。"
4428        } else {
4429            "No matching daily memory files."
4430        }
4431    }
4432
4433    pub fn tui_webdav_jianguoyun_setup_title() -> &'static str {
4434        if is_chinese() {
4435            "坚果云一键配置"
4436        } else {
4437            "Jianguoyun Quick Setup"
4438        }
4439    }
4440
4441    pub fn tui_webdav_jianguoyun_username_prompt() -> &'static str {
4442        if is_chinese() {
4443            "请输入坚果云账号(通常是邮箱):"
4444        } else {
4445            "Enter your Jianguoyun account (usually email):"
4446        }
4447    }
4448
4449    pub fn tui_webdav_jianguoyun_app_password_prompt() -> &'static str {
4450        if is_chinese() {
4451            "请输入坚果云第三方应用密码:"
4452        } else {
4453            "Enter your Jianguoyun app password:"
4454        }
4455    }
4456
4457    pub fn tui_webdav_loading_title_check_connection() -> &'static str {
4458        if is_chinese() {
4459            "WebDAV 检查连接"
4460        } else {
4461            "WebDAV Check Connection"
4462        }
4463    }
4464
4465    pub fn tui_webdav_loading_title_upload() -> &'static str {
4466        if is_chinese() {
4467            "WebDAV 上传"
4468        } else {
4469            "WebDAV Upload"
4470        }
4471    }
4472
4473    pub fn tui_webdav_loading_title_download() -> &'static str {
4474        if is_chinese() {
4475            "WebDAV 下载"
4476        } else {
4477            "WebDAV Download"
4478        }
4479    }
4480
4481    pub fn tui_webdav_loading_title_quick_setup() -> &'static str {
4482        if is_chinese() {
4483            "坚果云一键配置"
4484        } else {
4485            "Jianguoyun Quick Setup"
4486        }
4487    }
4488
4489    pub fn tui_webdav_loading_message() -> &'static str {
4490        if is_chinese() {
4491            "正在处理 WebDAV 请求,请稍候…"
4492        } else {
4493            "Processing WebDAV request, please wait..."
4494        }
4495    }
4496
4497    pub fn tui_config_item_reset() -> &'static str {
4498        if is_chinese() {
4499            "重置配置"
4500        } else {
4501            "Reset Config"
4502        }
4503    }
4504
4505    pub fn tui_config_item_show_full() -> &'static str {
4506        if is_chinese() {
4507            "查看完整配置"
4508        } else {
4509            "Show Full Config"
4510        }
4511    }
4512
4513    pub fn tui_config_item_show_path() -> &'static str {
4514        if is_chinese() {
4515            "显示配置路径"
4516        } else {
4517            "Show Config Path"
4518        }
4519    }
4520
4521    pub fn tui_hint_esc_close() -> &'static str {
4522        if is_chinese() {
4523            "Esc = 关闭"
4524        } else {
4525            "Esc = Close"
4526        }
4527    }
4528
4529    pub fn tui_hint_enter_submit_esc_cancel() -> &'static str {
4530        if is_chinese() {
4531            "Enter = 提交, Esc = 取消"
4532        } else {
4533            "Enter = Submit, Esc = Cancel"
4534        }
4535    }
4536
4537    pub fn tui_hint_enter_restore_esc_cancel() -> &'static str {
4538        if is_chinese() {
4539            "Enter = 恢复, Esc = 取消"
4540        } else {
4541            "Enter = restore, Esc = cancel"
4542        }
4543    }
4544
4545    pub fn tui_backup_picker_title() -> &'static str {
4546        if is_chinese() {
4547            "选择备份(Enter 恢复)"
4548        } else {
4549            "Select Backup (Enter to restore)"
4550        }
4551    }
4552
4553    pub fn tui_speedtest_running(url: &str) -> String {
4554        if is_chinese() {
4555            format!("正在测速: {}", url)
4556        } else {
4557            format!("Running: {}", url)
4558        }
4559    }
4560
4561    pub fn tui_speedtest_title_with_url(url: &str) -> String {
4562        if is_chinese() {
4563            format!("测速: {}", url)
4564        } else {
4565            format!("Speedtest: {}", url)
4566        }
4567    }
4568
4569    pub fn tui_stream_check_running(provider_name: &str) -> String {
4570        if is_chinese() {
4571            format!("正在检查: {}", provider_name)
4572        } else {
4573            format!("Checking: {}", provider_name)
4574        }
4575    }
4576
4577    pub fn tui_stream_check_title_with_provider(provider_name: &str) -> String {
4578        if is_chinese() {
4579            format!("健康检查: {}", provider_name)
4580        } else {
4581            format!("Stream Check: {}", provider_name)
4582        }
4583    }
4584
4585    pub fn tui_toast_provider_already_in_use() -> &'static str {
4586        if is_chinese() {
4587            "已在使用该供应商。"
4588        } else {
4589            "Already using this provider."
4590        }
4591    }
4592
4593    pub fn tui_toast_provider_cannot_delete_current() -> &'static str {
4594        if is_chinese() {
4595            "不能删除当前供应商。"
4596        } else {
4597            "Cannot delete current provider."
4598        }
4599    }
4600
4601    pub fn tui_toast_provider_cannot_remove_default_model() -> &'static str {
4602        if is_chinese() {
4603            "被当前默认模型引用的供应商不能直接从配置中移除。"
4604        } else {
4605            "A provider referenced by the current default model cannot be removed from config directly."
4606        }
4607    }
4608
4609    pub fn tui_toast_provider_default_requires_live_config() -> &'static str {
4610        if is_chinese() {
4611            "请先将该供应商添加到配置中,再设为默认。"
4612        } else {
4613            "Add this provider to config before setting it as default."
4614        }
4615    }
4616
4617    pub fn tui_toast_provider_default_model_missing() -> &'static str {
4618        if is_chinese() {
4619            "该供应商缺少可设为默认的主模型。"
4620        } else {
4621            "This provider has no primary model to set as default."
4622        }
4623    }
4624
4625    pub fn tui_toast_provider_removed_from_config() -> &'static str {
4626        if is_chinese() {
4627            "已从当前 OpenClaw 配置中移除该供应商。"
4628        } else {
4629            "Provider removed from the current OpenClaw config."
4630        }
4631    }
4632
4633    pub fn tui_toast_provider_added_to_app_config(app: &str) -> String {
4634        if is_chinese() {
4635            format!("已将该供应商添加到当前 {app} 配置。")
4636        } else {
4637            format!("Provider added to the current {app} config.")
4638        }
4639    }
4640
4641    pub fn tui_toast_provider_removed_from_app_config(app: &str) -> String {
4642        if is_chinese() {
4643            format!("已从当前 {app} 配置中移除该供应商。")
4644        } else {
4645            format!("Provider removed from the current {app} config.")
4646        }
4647    }
4648
4649    pub fn tui_toast_provider_set_as_default(model: &str) -> String {
4650        if is_chinese() {
4651            format!("已设为默认模型: {}", model)
4652        } else {
4653            format!("Set default model: {}", model)
4654        }
4655    }
4656
4657    pub fn tui_temp_launch_failed(message: &str) -> String {
4658        if is_chinese() {
4659            format!("临时启动失败: {}", message)
4660        } else {
4661            format!("Temporary launch failed: {}", message)
4662        }
4663    }
4664
4665    pub fn tui_confirm_delete_provider_title() -> &'static str {
4666        if is_chinese() {
4667            "删除供应商"
4668        } else {
4669            "Delete Provider"
4670        }
4671    }
4672
4673    pub fn tui_confirm_delete_provider_message(name: &str, id: &str) -> String {
4674        if is_chinese() {
4675            format!("确定删除供应商 '{}' ({})?", name, id)
4676        } else {
4677            format!("Delete provider '{}' ({})?", name, id)
4678        }
4679    }
4680
4681    pub fn tui_mcp_add_title() -> &'static str {
4682        if is_chinese() {
4683            "新增 MCP 服务器"
4684        } else {
4685            "Add MCP Server"
4686        }
4687    }
4688
4689    pub fn tui_mcp_edit_title(name: &str) -> String {
4690        if is_chinese() {
4691            format!("编辑 MCP 服务器: {}", name)
4692        } else {
4693            format!("Edit MCP Server: {}", name)
4694        }
4695    }
4696
4697    pub fn tui_mcp_apps_title(name: &str) -> String {
4698        if is_chinese() {
4699            format!("选择 MCP 应用: {}", name)
4700        } else {
4701            format!("Select MCP Apps: {}", name)
4702        }
4703    }
4704
4705    pub fn tui_mcp_type_title() -> &'static str {
4706        if is_chinese() {
4707            "选择 MCP 连接类型"
4708        } else {
4709            "Select MCP Transport"
4710        }
4711    }
4712
4713    pub fn tui_mcp_env_title() -> &'static str {
4714        if is_chinese() {
4715            "MCP 环境变量"
4716        } else {
4717            "MCP Env"
4718        }
4719    }
4720
4721    pub fn tui_mcp_env_add_entry_title() -> &'static str {
4722        if is_chinese() {
4723            "新增环境变量"
4724        } else {
4725            "Add Env Entry"
4726        }
4727    }
4728
4729    pub fn tui_mcp_env_edit_entry_title() -> &'static str {
4730        if is_chinese() {
4731            "编辑环境变量"
4732        } else {
4733            "Edit Env Entry"
4734        }
4735    }
4736
4737    pub fn tui_mcp_env_empty_state() -> &'static str {
4738        if is_chinese() {
4739            "暂无环境变量,按 a 新增。"
4740        } else {
4741            "No env entries yet. Press a to add one."
4742        }
4743    }
4744
4745    pub fn tui_skill_apps_title(name: &str) -> String {
4746        if is_chinese() {
4747            format!("选择 Skill 应用: {}", name)
4748        } else {
4749            format!("Select Skill Apps: {}", name)
4750        }
4751    }
4752
4753    pub fn tui_skills_batch_selection_name(count: usize) -> String {
4754        if is_chinese() {
4755            format!("已选择 {count} 个 Skill")
4756        } else {
4757            format!("{count} selected Skills")
4758        }
4759    }
4760
4761    pub fn tui_toast_provider_no_api_url() -> &'static str {
4762        if is_chinese() {
4763            "该供应商未配置 API URL。"
4764        } else {
4765            "No API URL configured for this provider."
4766        }
4767    }
4768
4769    pub fn tui_confirm_delete_mcp_title() -> &'static str {
4770        if is_chinese() {
4771            "删除 MCP 服务器"
4772        } else {
4773            "Delete MCP Server"
4774        }
4775    }
4776
4777    pub fn tui_confirm_delete_mcp_message(name: &str, id: &str) -> String {
4778        if is_chinese() {
4779            format!("确定删除 MCP 服务器 '{}' ({})?", name, id)
4780        } else {
4781            format!("Delete MCP server '{}' ({})?", name, id)
4782        }
4783    }
4784
4785    pub fn tui_prompt_title(name: &str) -> String {
4786        if is_chinese() {
4787            format!("提示词: {}", name)
4788        } else {
4789            format!("Prompt: {}", name)
4790        }
4791    }
4792
4793    pub fn tui_prompt_rename_title() -> &'static str {
4794        if is_chinese() {
4795            "重命名提示词"
4796        } else {
4797            "Rename Prompt"
4798        }
4799    }
4800
4801    pub fn tui_prompt_create_title() -> &'static str {
4802        if is_chinese() {
4803            "创建提示词"
4804        } else {
4805            "Create Prompt"
4806        }
4807    }
4808
4809    pub fn tui_prompt_create_prompt() -> &'static str {
4810        if is_chinese() {
4811            "输入提示词名称:"
4812        } else {
4813            "Enter a prompt name:"
4814        }
4815    }
4816
4817    pub fn tui_prompt_rename_prompt() -> &'static str {
4818        if is_chinese() {
4819            "输入新的提示词名称:"
4820        } else {
4821            "Enter a new prompt name:"
4822        }
4823    }
4824
4825    pub fn tui_toast_prompt_no_active_to_deactivate() -> &'static str {
4826        if is_chinese() {
4827            "没有可停用的活动提示词。"
4828        } else {
4829            "No active prompt to deactivate."
4830        }
4831    }
4832
4833    pub fn tui_toast_prompt_cannot_delete_active() -> &'static str {
4834        if is_chinese() {
4835            "不能删除正在启用的提示词。"
4836        } else {
4837            "Cannot delete the active prompt."
4838        }
4839    }
4840
4841    pub fn tui_confirm_delete_prompt_title() -> &'static str {
4842        if is_chinese() {
4843            "删除提示词"
4844        } else {
4845            "Delete Prompt"
4846        }
4847    }
4848
4849    pub fn tui_confirm_delete_prompt_message(name: &str, id: &str) -> String {
4850        if is_chinese() {
4851            format!("确定删除提示词 '{}' ({})?", name, id)
4852        } else {
4853            format!("Delete prompt '{}' ({})?", name, id)
4854        }
4855    }
4856
4857    pub fn tui_toast_prompt_edit_finished() -> &'static str {
4858        if is_chinese() {
4859            "提示词编辑完成"
4860        } else {
4861            "Prompt edit finished"
4862        }
4863    }
4864
4865    pub fn tui_toast_prompt_name_empty() -> &'static str {
4866        if is_chinese() {
4867            "提示词名称不能为空。"
4868        } else {
4869            "Prompt name cannot be empty."
4870        }
4871    }
4872
4873    pub fn tui_toast_prompt_not_found(id: &str) -> String {
4874        if is_chinese() {
4875            format!("未找到提示词:{}", id)
4876        } else {
4877            format!("Prompt not found: {}", id)
4878        }
4879    }
4880
4881    pub fn tui_config_paths_title() -> &'static str {
4882        if is_chinese() {
4883            "配置路径"
4884        } else {
4885            "Configuration Paths"
4886        }
4887    }
4888
4889    pub fn tui_config_paths_config_file(path: &str) -> String {
4890        if is_chinese() {
4891            format!("配置文件: {}", path)
4892        } else {
4893            format!("Config file: {}", path)
4894        }
4895    }
4896
4897    pub fn tui_config_paths_config_dir(path: &str) -> String {
4898        if is_chinese() {
4899            format!("配置目录:  {}", path)
4900        } else {
4901            format!("Config dir:  {}", path)
4902        }
4903    }
4904
4905    pub fn tui_error_failed_to_read_config(e: &str) -> String {
4906        if is_chinese() {
4907            format!("读取配置失败: {e}")
4908        } else {
4909            format!("Failed to read config: {e}")
4910        }
4911    }
4912
4913    pub fn tui_config_export_title() -> &'static str {
4914        if is_chinese() {
4915            "导出配置"
4916        } else {
4917            "Export Configuration"
4918        }
4919    }
4920
4921    pub fn tui_config_export_prompt() -> &'static str {
4922        if is_chinese() {
4923            "导出路径:"
4924        } else {
4925            "Export path:"
4926        }
4927    }
4928
4929    pub fn tui_config_import_title() -> &'static str {
4930        if is_chinese() {
4931            "导入配置"
4932        } else {
4933            "Import Configuration"
4934        }
4935    }
4936
4937    pub fn tui_config_import_prompt() -> &'static str {
4938        if is_chinese() {
4939            "从路径导入:"
4940        } else {
4941            "Import from path:"
4942        }
4943    }
4944
4945    pub fn tui_config_backup_title() -> &'static str {
4946        if is_chinese() {
4947            "备份配置"
4948        } else {
4949            "Backup Configuration"
4950        }
4951    }
4952
4953    pub fn tui_config_backup_prompt() -> &'static str {
4954        if is_chinese() {
4955            "可选名称(留空使用默认值):"
4956        } else {
4957            "Optional name (empty for default):"
4958        }
4959    }
4960
4961    pub fn tui_toast_no_backups_found() -> &'static str {
4962        if is_chinese() {
4963            "未找到备份。"
4964        } else {
4965            "No backups found."
4966        }
4967    }
4968
4969    pub fn tui_error_failed_to_read(e: &str) -> String {
4970        if is_chinese() {
4971            format!("读取失败: {e}")
4972        } else {
4973            format!("Failed to read: {e}")
4974        }
4975    }
4976
4977    pub fn tui_common_snippet_title(app: &str) -> String {
4978        if is_chinese() {
4979            format!("通用片段 ({})", app)
4980        } else {
4981            format!("Common Snippet ({})", app)
4982        }
4983    }
4984
4985    pub fn tui_config_reset_title() -> &'static str {
4986        if is_chinese() {
4987            "重置配置"
4988        } else {
4989            "Reset Configuration"
4990        }
4991    }
4992
4993    pub fn tui_config_reset_message() -> &'static str {
4994        if is_chinese() {
4995            "重置为默认配置?(这将覆盖当前配置)"
4996        } else {
4997            "Reset to default configuration? (This will overwrite your current config)"
4998        }
4999    }
5000
5001    pub fn tui_toast_export_path_empty() -> &'static str {
5002        if is_chinese() {
5003            "导出路径为空。"
5004        } else {
5005            "Export path is empty."
5006        }
5007    }
5008
5009    pub fn tui_toast_import_path_empty() -> &'static str {
5010        if is_chinese() {
5011            "导入路径为空。"
5012        } else {
5013            "Import path is empty."
5014        }
5015    }
5016
5017    pub fn tui_confirm_import_message(path: &str) -> String {
5018        if is_chinese() {
5019            format!("确认从 '{}' 导入?", path)
5020        } else {
5021            format!("Import from '{}'?", path)
5022        }
5023    }
5024
5025    pub fn tui_toast_command_empty() -> &'static str {
5026        if is_chinese() {
5027            "命令为空。"
5028        } else {
5029            "Command is empty."
5030        }
5031    }
5032
5033    pub fn tui_toast_url_empty() -> &'static str {
5034        if is_chinese() {
5035            "URL 为空。"
5036        } else {
5037            "URL is empty."
5038        }
5039    }
5040
5041    pub fn tui_toast_mcp_env_key_empty() -> &'static str {
5042        if is_chinese() {
5043            "环境变量 Key 不能为空。"
5044        } else {
5045            "Env key cannot be empty."
5046        }
5047    }
5048
5049    pub fn tui_toast_mcp_env_duplicate_key(key: &str) -> String {
5050        if is_chinese() {
5051            format!("环境变量 Key '{}' 已存在。", key)
5052        } else {
5053            format!("Env key '{key}' already exists.")
5054        }
5055    }
5056
5057    pub fn tui_confirm_restore_backup_title() -> &'static str {
5058        if is_chinese() {
5059            "恢复备份"
5060        } else {
5061            "Restore Backup"
5062        }
5063    }
5064
5065    pub fn tui_confirm_restore_backup_message(name: &str) -> String {
5066        if is_chinese() {
5067            format!("确认从备份 '{}' 恢复?", name)
5068        } else {
5069            format!("Restore from backup '{}'?", name)
5070        }
5071    }
5072
5073    pub fn tui_speedtest_line_url(url: &str) -> String {
5074        format!("URL: {}", url)
5075    }
5076
5077    pub fn tui_stream_check_line_provider(provider_name: &str) -> String {
5078        if is_chinese() {
5079            format!("供应商: {provider_name}")
5080        } else {
5081            format!("Provider: {provider_name}")
5082        }
5083    }
5084
5085    pub fn tui_stream_check_line_status(status: &str) -> String {
5086        if is_chinese() {
5087            format!("状态:   {status}")
5088        } else {
5089            format!("Status:  {status}")
5090        }
5091    }
5092
5093    pub fn tui_stream_check_line_response_time(response_time: &str) -> String {
5094        if is_chinese() {
5095            format!("耗时:   {response_time}")
5096        } else {
5097            format!("Time:    {response_time}")
5098        }
5099    }
5100
5101    pub fn tui_stream_check_line_http_status(status: &str) -> String {
5102        if is_chinese() {
5103            format!("HTTP:   {status}")
5104        } else {
5105            format!("HTTP:    {status}")
5106        }
5107    }
5108
5109    pub fn tui_stream_check_line_model(model: &str) -> String {
5110        if is_chinese() {
5111            format!("模型:   {model}")
5112        } else {
5113            format!("Model:   {model}")
5114        }
5115    }
5116
5117    pub fn tui_stream_check_line_retries(retries: &str) -> String {
5118        if is_chinese() {
5119            format!("重试:   {retries}")
5120        } else {
5121            format!("Retries: {retries}")
5122        }
5123    }
5124
5125    pub fn tui_stream_check_line_message(message: &str) -> String {
5126        if is_chinese() {
5127            format!("信息:   {message}")
5128        } else {
5129            format!("Message: {message}")
5130        }
5131    }
5132
5133    pub fn tui_speedtest_line_latency(latency: &str) -> String {
5134        if is_chinese() {
5135            format!("延迟:   {latency}")
5136        } else {
5137            format!("Latency: {latency}")
5138        }
5139    }
5140
5141    pub fn tui_speedtest_line_status(status: &str) -> String {
5142        if is_chinese() {
5143            format!("状态:   {status}")
5144        } else {
5145            format!("Status:  {status}")
5146        }
5147    }
5148
5149    pub fn tui_speedtest_line_error(err: &str) -> String {
5150        if is_chinese() {
5151            format!("错误:   {err}")
5152        } else {
5153            format!("Error:   {err}")
5154        }
5155    }
5156
5157    pub fn tui_toast_speedtest_finished() -> &'static str {
5158        if is_chinese() {
5159            "测速完成。"
5160        } else {
5161            "Speedtest finished."
5162        }
5163    }
5164
5165    pub fn tui_toast_speedtest_failed(err: &str) -> String {
5166        if is_chinese() {
5167            format!("测速失败: {err}")
5168        } else {
5169            format!("Speedtest failed: {err}")
5170        }
5171    }
5172
5173    pub fn tui_toast_speedtest_unavailable(err: &str) -> String {
5174        if is_chinese() {
5175            format!("测速不可用: {err}")
5176        } else {
5177            format!("Speedtest unavailable: {err}")
5178        }
5179    }
5180
5181    pub fn tui_toast_speedtest_disabled() -> &'static str {
5182        if is_chinese() {
5183            "本次会话测速不可用。"
5184        } else {
5185            "Speedtest is disabled for this session."
5186        }
5187    }
5188
5189    pub fn tui_toast_local_env_check_unavailable(err: &str) -> String {
5190        if is_chinese() {
5191            format!("本地环境检查不可用: {err}")
5192        } else {
5193            format!("Local environment check unavailable: {err}")
5194        }
5195    }
5196
5197    pub fn tui_toast_local_env_check_disabled() -> &'static str {
5198        if is_chinese() {
5199            "本次会话本地环境检查不可用。"
5200        } else {
5201            "Local environment check is disabled for this session."
5202        }
5203    }
5204
5205    pub fn tui_toast_local_env_check_request_failed(err: &str) -> String {
5206        if is_chinese() {
5207            format!("本地环境检查刷新请求失败: {err}")
5208        } else {
5209            format!("Failed to enqueue local environment check: {err}")
5210        }
5211    }
5212
5213    pub fn tui_toast_speedtest_request_failed(err: &str) -> String {
5214        if is_chinese() {
5215            format!("测速请求失败: {err}")
5216        } else {
5217            format!("Failed to enqueue speedtest: {err}")
5218        }
5219    }
5220
5221    pub fn tui_toast_stream_check_finished() -> &'static str {
5222        if is_chinese() {
5223            "健康检查完成。"
5224        } else {
5225            "Stream check finished."
5226        }
5227    }
5228
5229    pub fn tui_toast_stream_check_failed(err: &str) -> String {
5230        if is_chinese() {
5231            format!("健康检查失败: {err}")
5232        } else {
5233            format!("Stream check failed: {err}")
5234        }
5235    }
5236
5237    pub fn tui_toast_stream_check_unavailable(err: &str) -> String {
5238        if is_chinese() {
5239            format!("健康检查不可用: {err}")
5240        } else {
5241            format!("Stream check unavailable: {err}")
5242        }
5243    }
5244
5245    pub fn tui_toast_stream_check_disabled() -> &'static str {
5246        if is_chinese() {
5247            "本次会话健康检查不可用。"
5248        } else {
5249            "Stream check is disabled for this session."
5250        }
5251    }
5252
5253    pub fn tui_toast_stream_check_request_failed(err: &str) -> String {
5254        if is_chinese() {
5255            format!("健康检查请求失败: {err}")
5256        } else {
5257            format!("Failed to enqueue stream check: {err}")
5258        }
5259    }
5260
5261    pub fn tui_toast_quota_not_available() -> &'static str {
5262        if is_chinese() {
5263            "当前供应商没有官方额度查询。"
5264        } else {
5265            "This provider has no official quota query."
5266        }
5267    }
5268
5269    pub fn tui_toast_quota_worker_unavailable(err: &str) -> String {
5270        if is_chinese() {
5271            format!("额度查询后台任务不可用: {err}")
5272        } else {
5273            format!("Quota worker unavailable: {err}")
5274        }
5275    }
5276
5277    pub fn tui_toast_quota_refresh_started(provider: &str) -> String {
5278        if is_chinese() {
5279            format!("正在刷新额度: {provider}")
5280        } else {
5281            format!("Refreshing quota: {provider}")
5282        }
5283    }
5284
5285    pub fn tui_toast_quota_refresh_finished(provider: &str) -> String {
5286        if is_chinese() {
5287            format!("额度已刷新: {provider}")
5288        } else {
5289            format!("Quota refreshed: {provider}")
5290        }
5291    }
5292
5293    pub fn tui_toast_quota_refresh_failed(err: &str) -> String {
5294        if is_chinese() {
5295            format!("额度刷新失败: {err}")
5296        } else {
5297            format!("Quota refresh failed: {err}")
5298        }
5299    }
5300
5301    pub fn tui_toast_skills_worker_unavailable(err: &str) -> String {
5302        if is_chinese() {
5303            format!("Skills 后台任务不可用: {err}")
5304        } else {
5305            format!("Skills worker unavailable: {err}")
5306        }
5307    }
5308
5309    pub fn tui_toast_webdav_worker_unavailable(err: &str) -> String {
5310        if is_chinese() {
5311            format!("WebDAV 后台任务不可用: {err}")
5312        } else {
5313            format!("WebDAV worker unavailable: {err}")
5314        }
5315    }
5316
5317    pub fn tui_toast_model_fetch_worker_unavailable(err: &str) -> String {
5318        if is_chinese() {
5319            format!("模型获取后台任务不可用: {err}")
5320        } else {
5321            format!("Model fetch worker unavailable: {err}")
5322        }
5323    }
5324
5325    pub fn tui_toast_model_fetch_worker_disabled() -> &'static str {
5326        if is_chinese() {
5327            "本次会话模型获取后台任务不可用。"
5328        } else {
5329            "Model fetch worker is disabled for this session."
5330        }
5331    }
5332
5333    pub fn tui_toast_webdav_worker_disabled() -> &'static str {
5334        if is_chinese() {
5335            "本次会话 WebDAV 后台任务不可用。"
5336        } else {
5337            "WebDAV worker is disabled for this session."
5338        }
5339    }
5340
5341    pub fn tui_error_skills_worker_unavailable() -> &'static str {
5342        if is_chinese() {
5343            "Skills 后台任务不可用。"
5344        } else {
5345            "Skills worker unavailable."
5346        }
5347    }
5348
5349    pub fn tui_toast_skills_discover_finished(count: usize) -> String {
5350        if is_chinese() {
5351            format!("发现完成:{count} 个结果。")
5352        } else {
5353            format!("Discover finished: {count} result(s).")
5354        }
5355    }
5356
5357    pub fn tui_toast_skills_discover_failed(err: &str) -> String {
5358        if is_chinese() {
5359            format!("发现失败: {err}")
5360        } else {
5361            format!("Discover failed: {err}")
5362        }
5363    }
5364
5365    pub fn tui_toast_skill_installed(directory: &str) -> String {
5366        if is_chinese() {
5367            format!("已安装: {directory}")
5368        } else {
5369            format!("Installed: {directory}")
5370        }
5371    }
5372
5373    pub fn tui_toast_skill_install_failed(spec: &str, err: &str) -> String {
5374        if is_chinese() {
5375            format!("安装失败({spec}): {err}")
5376        } else {
5377            format!("Install failed ({spec}): {err}")
5378        }
5379    }
5380
5381    pub fn tui_toast_skill_already_installed() -> &'static str {
5382        if is_chinese() {
5383            "该 Skill 已安装。"
5384        } else {
5385            "Skill already installed."
5386        }
5387    }
5388
5389    pub fn tui_toast_skill_spec_empty() -> &'static str {
5390        if is_chinese() {
5391            "Skill 不能为空。"
5392        } else {
5393            "Skill spec is empty."
5394        }
5395    }
5396
5397    pub fn tui_toast_skill_toggled(directory: &str, enabled: bool) -> String {
5398        if is_chinese() {
5399            format!("{} {directory}", if enabled { "已启用" } else { "已禁用" })
5400        } else {
5401            format!(
5402                "{} {directory}",
5403                if enabled { "Enabled" } else { "Disabled" }
5404            )
5405        }
5406    }
5407
5408    pub fn tui_toast_skills_toggled(count: usize, enabled: bool) -> String {
5409        if is_chinese() {
5410            format!(
5411                "已{} {count} 个 Skill",
5412                if enabled { "启用" } else { "禁用" }
5413            )
5414        } else {
5415            format!(
5416                "{} {count} Skills",
5417                if enabled { "Enabled" } else { "Disabled" }
5418            )
5419        }
5420    }
5421
5422    pub fn tui_toast_skill_uninstalled(directory: &str) -> String {
5423        if is_chinese() {
5424            format!("已卸载: {directory}")
5425        } else {
5426            format!("Uninstalled: {directory}")
5427        }
5428    }
5429
5430    pub fn tui_toast_skills_uninstalled(count: usize) -> String {
5431        if is_chinese() {
5432            format!("已卸载 {count} 个 Skill")
5433        } else {
5434            format!("Uninstalled {count} Skills")
5435        }
5436    }
5437
5438    pub fn tui_toast_skill_apps_updated() -> &'static str {
5439        if is_chinese() {
5440            "Skill 应用已更新。"
5441        } else {
5442            "Skill apps updated."
5443        }
5444    }
5445
5446    pub fn tui_toast_skills_synced() -> &'static str {
5447        if is_chinese() {
5448            "Skills 同步完成。"
5449        } else {
5450            "Skills synced."
5451        }
5452    }
5453
5454    pub fn tui_toast_skills_sync_method_set(method: &str) -> String {
5455        if is_chinese() {
5456            format!("同步方式已设置为:{method}。重新同步后会应用到已有技能。")
5457        } else {
5458            format!("Sync method set to: {method}. Re-sync to apply it to existing skills.")
5459        }
5460    }
5461
5462    pub fn tui_toast_repo_spec_empty() -> &'static str {
5463        if is_chinese() {
5464            "仓库不能为空。"
5465        } else {
5466            "Repository is empty."
5467        }
5468    }
5469
5470    pub fn tui_error_repo_spec_empty() -> &'static str {
5471        if is_chinese() {
5472            "仓库不能为空。"
5473        } else {
5474            "Repository cannot be empty."
5475        }
5476    }
5477
5478    pub fn tui_error_repo_spec_invalid() -> &'static str {
5479        if is_chinese() {
5480            "仓库格式无效。请使用 owner/name 或 https://github.com/owner/name"
5481        } else {
5482            "Invalid repo format. Use owner/name or https://github.com/owner/name"
5483        }
5484    }
5485
5486    pub fn tui_toast_repo_added() -> &'static str {
5487        if is_chinese() {
5488            "仓库已添加。"
5489        } else {
5490            "Repository added."
5491        }
5492    }
5493
5494    pub fn tui_toast_repo_removed() -> &'static str {
5495        if is_chinese() {
5496            "仓库已移除。"
5497        } else {
5498            "Repository removed."
5499        }
5500    }
5501
5502    pub fn tui_toast_repo_toggled(enabled: bool) -> String {
5503        if is_chinese() {
5504            if enabled {
5505                "仓库已启用。".to_string()
5506            } else {
5507                "仓库已禁用。".to_string()
5508            }
5509        } else {
5510            if enabled {
5511                "Repository enabled.".to_string()
5512            } else {
5513                "Repository disabled.".to_string()
5514            }
5515        }
5516    }
5517
5518    pub fn tui_toast_skip_claude_onboarding_toggled(enabled: bool) -> String {
5519        if is_chinese() {
5520            if enabled {
5521                "已跳过 Claude Code 初次安装确认。".to_string()
5522            } else {
5523                "已恢复 Claude Code 初次安装确认。".to_string()
5524            }
5525        } else {
5526            if enabled {
5527                "Claude Code onboarding confirmation will be skipped.".to_string()
5528            } else {
5529                "Claude Code onboarding confirmation restored.".to_string()
5530            }
5531        }
5532    }
5533
5534    pub fn tui_toast_claude_plugin_integration_toggled(enabled: bool) -> String {
5535        if is_chinese() {
5536            if enabled {
5537                "已启用 Claude Code for VSCode 插件联动。".to_string()
5538            } else {
5539                "已关闭 Claude Code for VSCode 插件联动。".to_string()
5540            }
5541        } else {
5542            if enabled {
5543                "Claude Code for VSCode integration enabled.".to_string()
5544            } else {
5545                "Claude Code for VSCode integration disabled.".to_string()
5546            }
5547        }
5548    }
5549
5550    pub fn tui_toast_claude_plugin_sync_failed(err: &str) -> String {
5551        if is_chinese() {
5552            format!("同步 Claude Code for VSCode 插件失败: {err}")
5553        } else {
5554            format!("Failed to sync Claude Code for VSCode integration: {err}")
5555        }
5556    }
5557
5558    pub fn tui_toast_unmanaged_scanned(count: usize) -> String {
5559        if is_chinese() {
5560            format!("扫描完成:发现 {count} 个可导入技能。")
5561        } else {
5562            format!("Scan finished: found {count} skill(s) available to import.")
5563        }
5564    }
5565
5566    pub fn tui_toast_no_unmanaged_selected() -> &'static str {
5567        if is_chinese() {
5568            "请至少选择一个要导入的技能。"
5569        } else {
5570            "Select at least one skill to import."
5571        }
5572    }
5573
5574    pub fn tui_toast_unmanaged_imported(count: usize) -> String {
5575        if is_chinese() {
5576            format!("已导入 {count} 个技能。")
5577        } else {
5578            format!("Imported {count} skill(s).")
5579        }
5580    }
5581
5582    pub fn tui_toast_provider_deleted() -> &'static str {
5583        if is_chinese() {
5584            "供应商已删除。"
5585        } else {
5586            "Provider deleted."
5587        }
5588    }
5589
5590    pub fn tui_toast_provider_add_finished() -> &'static str {
5591        if is_chinese() {
5592            "供应商新增流程已完成。"
5593        } else {
5594            "Provider add flow finished."
5595        }
5596    }
5597
5598    pub fn tui_toast_provider_add_missing_fields() -> &'static str {
5599        if is_chinese() {
5600            "请填写 name,id 会自动生成。"
5601        } else {
5602            "Please fill in name. id will be generated automatically."
5603        }
5604    }
5605
5606    pub fn tui_toast_provider_missing_name() -> &'static str {
5607        if is_chinese() {
5608            "请填写 name,id 会自动生成。"
5609        } else {
5610            "Please fill in name. id will be generated automatically."
5611        }
5612    }
5613
5614    pub fn tui_toast_provider_add_failed() -> &'static str {
5615        if is_chinese() {
5616            "新增供应商失败。"
5617        } else {
5618            "Failed to add provider."
5619        }
5620    }
5621
5622    pub fn tui_toast_provider_edit_finished() -> &'static str {
5623        if is_chinese() {
5624            "供应商编辑流程已完成。"
5625        } else {
5626            "Provider edit flow finished."
5627        }
5628    }
5629
5630    pub fn tui_toast_mcp_updated() -> &'static str {
5631        if is_chinese() {
5632            "MCP 已更新。"
5633        } else {
5634            "MCP updated."
5635        }
5636    }
5637
5638    pub fn tui_toast_mcp_upserted() -> &'static str {
5639        if is_chinese() {
5640            "MCP 服务器已保存。"
5641        } else {
5642            "MCP server saved."
5643        }
5644    }
5645
5646    pub fn tui_toast_mcp_missing_fields() -> &'static str {
5647        if is_chinese() {
5648            "请在 JSON 中填写 id 和 name。"
5649        } else {
5650            "Please fill in id and name in JSON."
5651        }
5652    }
5653
5654    pub fn tui_toast_mcp_server_deleted() -> &'static str {
5655        if is_chinese() {
5656            "MCP 服务器已删除。"
5657        } else {
5658            "MCP server deleted."
5659        }
5660    }
5661
5662    pub fn tui_toast_mcp_server_not_found() -> &'static str {
5663        if is_chinese() {
5664            "未找到 MCP 服务器。"
5665        } else {
5666            "MCP server not found."
5667        }
5668    }
5669
5670    pub fn tui_toast_mcp_imported(count: usize) -> String {
5671        if is_chinese() {
5672            format!("已导入 {count} 个 MCP 服务器。")
5673        } else {
5674            format!("Imported {count} MCP server(s).")
5675        }
5676    }
5677
5678    pub fn tui_toast_mcp_live_imported() -> &'static str {
5679        if is_chinese() {
5680            "已从 live 导入 MCP 服务器。"
5681        } else {
5682            "Imported MCP server from live config."
5683        }
5684    }
5685
5686    pub fn tui_toast_mcp_live_pushed() -> &'static str {
5687        if is_chinese() {
5688            "已用 cc-switch MCP 配置覆盖 live。"
5689        } else {
5690            "Pushed cc-switch MCP server to live config."
5691        }
5692    }
5693
5694    pub fn tui_toast_live_sync_skipped_uninitialized(app: &str) -> String {
5695        if is_chinese() {
5696            format!(
5697                "未检测到 {app} 客户端本地配置,已跳过写入 live 文件;先运行一次 {app} 初始化后再试。"
5698            )
5699        } else {
5700            format!("Live sync skipped: {app} client not initialized; run it once to initialize, then retry.")
5701        }
5702    }
5703
5704    pub fn tui_toast_mcp_updated_live_sync_skipped(apps: &[&str]) -> String {
5705        let list = if is_chinese() {
5706            apps.join("、")
5707        } else {
5708            apps.join(", ")
5709        };
5710
5711        if is_chinese() {
5712            format!(
5713                "MCP 已更新,但以下客户端未初始化,已跳过写入 live 文件:{list};先运行一次对应客户端初始化后再试。"
5714            )
5715        } else {
5716            format!(
5717                "MCP updated, but live sync skipped for uninitialized client(s): {list}; run them once to initialize, then retry."
5718            )
5719        }
5720    }
5721
5722    pub fn tui_toast_prompt_activated() -> &'static str {
5723        if is_chinese() {
5724            "提示词已启用。"
5725        } else {
5726            "Prompt activated."
5727        }
5728    }
5729
5730    pub fn tui_toast_prompt_deactivated() -> &'static str {
5731        if is_chinese() {
5732            "提示词已停用。"
5733        } else {
5734            "Prompt deactivated."
5735        }
5736    }
5737
5738    pub fn tui_toast_prompt_deleted() -> &'static str {
5739        if is_chinese() {
5740            "提示词已删除。"
5741        } else {
5742            "Prompt deleted."
5743        }
5744    }
5745
5746    pub fn tui_toast_prompt_created() -> &'static str {
5747        if is_chinese() {
5748            "提示词已创建。"
5749        } else {
5750            "Prompt created."
5751        }
5752    }
5753
5754    pub fn tui_toast_prompt_renamed() -> &'static str {
5755        if is_chinese() {
5756            "提示词已重命名。"
5757        } else {
5758            "Prompt renamed."
5759        }
5760    }
5761
5762    pub fn tui_toast_exported_to(path: &str) -> String {
5763        if is_chinese() {
5764            format!("已导出到 {}", path)
5765        } else {
5766            format!("Exported to {}", path)
5767        }
5768    }
5769
5770    pub fn tui_error_import_file_not_found(path: &str) -> String {
5771        if is_chinese() {
5772            format!("导入文件不存在: {}", path)
5773        } else {
5774            format!("Import file not found: {}", path)
5775        }
5776    }
5777
5778    pub fn tui_toast_imported_config() -> &'static str {
5779        if is_chinese() {
5780            "配置已导入。"
5781        } else {
5782            "Imported config."
5783        }
5784    }
5785
5786    pub fn tui_toast_imported_with_backup(backup_id: &str) -> String {
5787        if is_chinese() {
5788            format!("已导入(备份: {backup_id})")
5789        } else {
5790            format!("Imported (backup: {backup_id})")
5791        }
5792    }
5793
5794    pub fn tui_toast_no_config_file_to_backup() -> &'static str {
5795        if is_chinese() {
5796            "没有可备份的配置文件。"
5797        } else {
5798            "No config file to backup."
5799        }
5800    }
5801
5802    pub fn tui_toast_backup_created(id: &str) -> String {
5803        if is_chinese() {
5804            format!("备份已创建: {id}")
5805        } else {
5806            format!("Backup created: {id}")
5807        }
5808    }
5809
5810    pub fn tui_toast_restored_from_backup() -> &'static str {
5811        if is_chinese() {
5812            "已从备份恢复。"
5813        } else {
5814            "Restored from backup."
5815        }
5816    }
5817
5818    pub fn tui_toast_restored_with_pre_backup(pre_backup: &str) -> String {
5819        if is_chinese() {
5820            format!("已恢复(恢复前备份: {pre_backup})")
5821        } else {
5822            format!("Restored (pre-backup: {pre_backup})")
5823        }
5824    }
5825
5826    pub fn tui_toast_webdav_settings_saved() -> &'static str {
5827        if is_chinese() {
5828            "WebDAV 同步设置已保存。"
5829        } else {
5830            "WebDAV sync settings saved."
5831        }
5832    }
5833
5834    pub fn tui_toast_proxy_takeover_requires_running() -> &'static str {
5835        if is_chinese() {
5836            "前台代理未运行,请先启动 `cc-switch proxy serve`。"
5837        } else {
5838            "Foreground proxy is not running. Start `cc-switch proxy serve` first."
5839        }
5840    }
5841
5842    pub fn tui_toast_proxy_takeover_updated(app: &str, enabled: bool) -> String {
5843        if is_chinese() {
5844            if enabled {
5845                format!("已将 {app} 接管到前台代理。")
5846            } else {
5847                format!("已将 {app} 恢复到 live 配置。")
5848            }
5849        } else if enabled {
5850            format!("{app} now uses the foreground proxy.")
5851        } else {
5852            format!("{app} restored to its live config.")
5853        }
5854    }
5855
5856    pub fn tui_toast_proxy_managed_current_app_updated(app: &str, enabled: bool) -> String {
5857        if is_chinese() {
5858            if enabled {
5859                format!("{app} 已走 cc-switch 代理。")
5860            } else {
5861                format!("{app} 已恢复 live 配置。")
5862            }
5863        } else if enabled {
5864            format!("{app} now routes through cc-switch.")
5865        } else {
5866            format!("{app} restored to its live config.")
5867        }
5868    }
5869
5870    pub fn tui_toast_proxy_worker_unavailable(err: &str) -> String {
5871        if is_chinese() {
5872            format!("代理任务不可用:{err}")
5873        } else {
5874            format!("Proxy worker unavailable: {err}")
5875        }
5876    }
5877
5878    pub fn tui_toast_proxy_request_failed(err: &str) -> String {
5879        if is_chinese() {
5880            format!("代理请求发送失败:{err}")
5881        } else {
5882            format!("Proxy request failed: {err}")
5883        }
5884    }
5885
5886    pub fn tui_error_proxy_worker_unavailable() -> &'static str {
5887        if is_chinese() {
5888            "代理任务不可用。"
5889        } else {
5890            "Proxy worker unavailable."
5891        }
5892    }
5893
5894    pub fn tui_toast_webdav_settings_cleared() -> &'static str {
5895        if is_chinese() {
5896            "WebDAV 同步设置已清空。"
5897        } else {
5898            "WebDAV sync settings cleared."
5899        }
5900    }
5901
5902    pub fn tui_toast_webdav_connection_ok() -> &'static str {
5903        if is_chinese() {
5904            "WebDAV 连接检查通过。"
5905        } else {
5906            "WebDAV connection check passed."
5907        }
5908    }
5909
5910    pub fn tui_toast_webdav_upload_ok() -> &'static str {
5911        if is_chinese() {
5912            "WebDAV 上传完成。"
5913        } else {
5914            "WebDAV upload completed."
5915        }
5916    }
5917
5918    pub fn tui_toast_webdav_download_ok() -> &'static str {
5919        if is_chinese() {
5920            "WebDAV 下载完成。"
5921        } else {
5922            "WebDAV download completed."
5923        }
5924    }
5925
5926    pub fn tui_webdav_v1_migration_title() -> &'static str {
5927        if is_chinese() {
5928            "发现旧版同步数据"
5929        } else {
5930            "Legacy sync data detected"
5931        }
5932    }
5933
5934    pub fn tui_webdav_v1_migration_message() -> &'static str {
5935        if is_chinese() {
5936            "远端存在 V1 格式的同步数据,是否迁移到 V2?\n迁移将下载旧数据、应用到本地、重新上传为新格式,并清理旧数据。"
5937        } else {
5938            "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."
5939        }
5940    }
5941
5942    pub fn tui_webdav_loading_title_v1_migration() -> &'static str {
5943        if is_chinese() {
5944            "V1 → V2 迁移"
5945        } else {
5946            "V1 → V2 Migration"
5947        }
5948    }
5949
5950    pub fn tui_toast_webdav_v1_migration_ok() -> &'static str {
5951        if is_chinese() {
5952            "V1 → V2 迁移完成,旧数据已清理。"
5953        } else {
5954            "V1 → V2 migration completed, old data cleaned up."
5955        }
5956    }
5957
5958    pub fn tui_toast_webdav_jianguoyun_configured() -> &'static str {
5959        if is_chinese() {
5960            "坚果云一键配置完成,连接检查通过。"
5961        } else {
5962            "Jianguoyun quick setup completed and connection verified."
5963        }
5964    }
5965
5966    pub fn tui_toast_webdav_username_empty() -> &'static str {
5967        if is_chinese() {
5968            "请输入 WebDAV 用户名。"
5969        } else {
5970            "Please enter a WebDAV username."
5971        }
5972    }
5973
5974    pub fn tui_toast_webdav_password_empty() -> &'static str {
5975        if is_chinese() {
5976            "请输入 WebDAV 第三方应用密码。"
5977        } else {
5978            "Please enter a WebDAV app password."
5979        }
5980    }
5981
5982    pub fn tui_toast_webdav_request_failed(err: &str) -> String {
5983        if is_chinese() {
5984            format!("WebDAV 请求提交失败: {err}")
5985        } else {
5986            format!("Failed to enqueue WebDAV request: {err}")
5987        }
5988    }
5989
5990    pub fn tui_toast_webdav_action_failed(action: &str, err: &str) -> String {
5991        if is_chinese() {
5992            format!("{action} 失败: {err}")
5993        } else {
5994            format!("{action} failed: {err}")
5995        }
5996    }
5997
5998    pub fn tui_toast_webdav_quick_setup_failed(err: &str) -> String {
5999        if is_chinese() {
6000            format!("坚果云一键配置已保存,但连接检查失败: {err}")
6001        } else {
6002            format!("Jianguoyun quick setup was saved, but connection check failed: {err}")
6003        }
6004    }
6005
6006    pub fn tui_toast_config_file_does_not_exist() -> &'static str {
6007        if is_chinese() {
6008            "配置文件不存在。"
6009        } else {
6010            "Config file does not exist."
6011        }
6012    }
6013
6014    pub fn tui_config_validation_title() -> &'static str {
6015        if is_chinese() {
6016            "配置校验"
6017        } else {
6018            "Config Validation"
6019        }
6020    }
6021
6022    pub fn tui_config_validation_failed_title() -> &'static str {
6023        if is_chinese() {
6024            "配置校验失败"
6025        } else {
6026            "Config Validation Failed"
6027        }
6028    }
6029
6030    pub fn tui_config_validation_ok() -> &'static str {
6031        if is_chinese() {
6032            "✓ 配置是有效的 JSON"
6033        } else {
6034            "✓ Configuration is valid JSON"
6035        }
6036    }
6037
6038    pub fn tui_config_validation_provider_count(app: &str, count: usize) -> String {
6039        if is_chinese() {
6040            format!("{app} 供应商:  {count}")
6041        } else {
6042            format!("{app} providers:  {count}")
6043        }
6044    }
6045
6046    pub fn tui_config_validation_mcp_servers(count: usize) -> String {
6047        if is_chinese() {
6048            format!("MCP 服务器:       {count}")
6049        } else {
6050            format!("MCP servers:       {count}")
6051        }
6052    }
6053
6054    pub fn tui_toast_validation_passed() -> &'static str {
6055        if is_chinese() {
6056            "校验通过。"
6057        } else {
6058            "Validation passed."
6059        }
6060    }
6061
6062    pub fn tui_toast_config_reset_to_defaults() -> &'static str {
6063        if is_chinese() {
6064            "配置已重置为默认值。"
6065        } else {
6066            "Config reset to defaults."
6067        }
6068    }
6069
6070    pub fn tui_toast_config_reset_with_backup(backup_id: &str) -> String {
6071        if is_chinese() {
6072            format!("配置已重置(备份: {backup_id})")
6073        } else {
6074            format!("Config reset (backup: {backup_id})")
6075        }
6076    }
6077
6078    pub fn menu_home() -> &'static str {
6079        let (en, zh) = menu_home_variants();
6080        if is_chinese() {
6081            zh
6082        } else {
6083            en
6084        }
6085    }
6086
6087    pub fn menu_home_variants() -> (&'static str, &'static str) {
6088        ("🏠 Home", "🏠 首页")
6089    }
6090
6091    pub fn menu_manage_providers() -> &'static str {
6092        let (en, zh) = menu_manage_providers_variants();
6093        if is_chinese() {
6094            zh
6095        } else {
6096            en
6097        }
6098    }
6099
6100    pub fn menu_manage_providers_variants() -> (&'static str, &'static str) {
6101        ("🔑 Providers", "🔑 供应商")
6102    }
6103
6104    pub fn menu_manage_mcp() -> &'static str {
6105        let (en, zh) = menu_manage_mcp_variants();
6106        if is_chinese() {
6107            zh
6108        } else {
6109            en
6110        }
6111    }
6112
6113    pub fn menu_manage_mcp_variants() -> (&'static str, &'static str) {
6114        ("🔌 MCP Servers", "🔌 MCP 服务器")
6115    }
6116
6117    pub fn menu_manage_prompts() -> &'static str {
6118        let (en, zh) = menu_manage_prompts_variants();
6119        if is_chinese() {
6120            zh
6121        } else {
6122            en
6123        }
6124    }
6125
6126    pub fn menu_manage_prompts_variants() -> (&'static str, &'static str) {
6127        ("💬 Prompts", "💬 提示词")
6128    }
6129
6130    pub fn menu_manage_config() -> &'static str {
6131        let (en, zh) = menu_manage_config_variants();
6132        if is_chinese() {
6133            zh
6134        } else {
6135            en
6136        }
6137    }
6138
6139    pub fn menu_manage_config_variants() -> (&'static str, &'static str) {
6140        ("📋 Configuration", "📋 配置")
6141    }
6142
6143    pub fn menu_manage_skills() -> &'static str {
6144        let (en, zh) = menu_manage_skills_variants();
6145        if is_chinese() {
6146            zh
6147        } else {
6148            en
6149        }
6150    }
6151
6152    pub fn menu_manage_skills_variants() -> (&'static str, &'static str) {
6153        ("🧩 Skills", "🧩 技能")
6154    }
6155
6156    pub fn menu_openclaw_workspace() -> &'static str {
6157        let (en, zh) = menu_openclaw_workspace_variants();
6158        if is_chinese() {
6159            zh
6160        } else {
6161            en
6162        }
6163    }
6164
6165    pub fn menu_openclaw_workspace_variants() -> (&'static str, &'static str) {
6166        ("📁 Workspace Files", "📁 Workspace 文件管理")
6167    }
6168
6169    pub fn menu_openclaw_env() -> &'static str {
6170        let (en, zh) = menu_openclaw_env_variants();
6171        if is_chinese() {
6172            zh
6173        } else {
6174            en
6175        }
6176    }
6177
6178    pub fn menu_openclaw_env_variants() -> (&'static str, &'static str) {
6179        ("🌱 Env Variables", "🌱 环境变量")
6180    }
6181
6182    pub fn menu_openclaw_tools() -> &'static str {
6183        let (en, zh) = menu_openclaw_tools_variants();
6184        if is_chinese() {
6185            zh
6186        } else {
6187            en
6188        }
6189    }
6190
6191    pub fn menu_openclaw_tools_variants() -> (&'static str, &'static str) {
6192        ("🔐 Tool Permissions", "🔐 工具权限")
6193    }
6194
6195    pub fn menu_openclaw_agents() -> &'static str {
6196        let (en, zh) = menu_openclaw_agents_variants();
6197        if is_chinese() {
6198            zh
6199        } else {
6200            en
6201        }
6202    }
6203
6204    pub fn menu_openclaw_agents_variants() -> (&'static str, &'static str) {
6205        ("🤖 Agents Config", "🤖 Agents 配置")
6206    }
6207
6208    pub fn menu_settings() -> &'static str {
6209        let (en, zh) = menu_settings_variants();
6210        if is_chinese() {
6211            zh
6212        } else {
6213            en
6214        }
6215    }
6216
6217    pub fn menu_settings_variants() -> (&'static str, &'static str) {
6218        ("🔧 Settings", "🔧 设置")
6219    }
6220
6221    pub fn menu_exit() -> &'static str {
6222        let (en, zh) = menu_exit_variants();
6223        if is_chinese() {
6224            zh
6225        } else {
6226            en
6227        }
6228    }
6229
6230    pub fn menu_exit_variants() -> (&'static str, &'static str) {
6231        ("🚪 Exit", "🚪 退出")
6232    }
6233
6234    // ============================================
6235    // SKILLS (Skills)
6236    // ============================================
6237
6238    pub fn skills_management() -> &'static str {
6239        if is_chinese() {
6240            "技能管理"
6241        } else {
6242            "Skills Management"
6243        }
6244    }
6245
6246    pub fn no_skills_installed() -> &'static str {
6247        if is_chinese() {
6248            "未安装任何 Skills。"
6249        } else {
6250            "No skills installed."
6251        }
6252    }
6253
6254    pub fn skills_discover() -> &'static str {
6255        if is_chinese() {
6256            "🔎 发现/搜索 Skills"
6257        } else {
6258            "🔎 Discover/Search Skills"
6259        }
6260    }
6261
6262    pub fn skills_install() -> &'static str {
6263        if is_chinese() {
6264            "⬇️  安装 Skill"
6265        } else {
6266            "⬇️  Install Skill"
6267        }
6268    }
6269
6270    pub fn skills_uninstall() -> &'static str {
6271        if is_chinese() {
6272            "🗑️  卸载 Skill"
6273        } else {
6274            "🗑️  Uninstall Skill"
6275        }
6276    }
6277
6278    pub fn skills_toggle_for_app() -> &'static str {
6279        if is_chinese() {
6280            "✅ 启用/禁用(当前应用)"
6281        } else {
6282            "✅ Enable/Disable (Current App)"
6283        }
6284    }
6285
6286    pub fn skills_show_info() -> &'static str {
6287        if is_chinese() {
6288            "ℹ️  查看 Skill 信息"
6289        } else {
6290            "ℹ️  Skill Info"
6291        }
6292    }
6293
6294    pub fn skills_sync_now() -> &'static str {
6295        if is_chinese() {
6296            "🔄 同步 Skills 到本地"
6297        } else {
6298            "🔄 Sync Skills to Live"
6299        }
6300    }
6301
6302    pub fn skills_sync_method() -> &'static str {
6303        if is_chinese() {
6304            "🔗 同步方式(auto/symlink/copy)"
6305        } else {
6306            "🔗 Sync Method (auto/symlink/copy)"
6307        }
6308    }
6309
6310    pub fn skills_select_sync_method() -> &'static str {
6311        if is_chinese() {
6312            "选择同步方式:"
6313        } else {
6314            "Select sync method:"
6315        }
6316    }
6317
6318    pub fn skills_current_sync_method(method: &str) -> String {
6319        if is_chinese() {
6320            format!("当前同步方式:{method}")
6321        } else {
6322            format!("Current sync method: {method}")
6323        }
6324    }
6325
6326    pub fn skills_current_app_note(app: &str) -> String {
6327        if is_chinese() {
6328            format!("提示:启用/禁用将作用于当前应用({app})。")
6329        } else {
6330            format!("Note: Enable/Disable applies to the current app ({app}).")
6331        }
6332    }
6333
6334    pub fn skills_scan_unmanaged() -> &'static str {
6335        if is_chinese() {
6336            "🕵️  查找已有技能"
6337        } else {
6338            "🕵️  Find Existing Skills"
6339        }
6340    }
6341
6342    pub fn skills_import_from_apps() -> &'static str {
6343        if is_chinese() {
6344            "📥 导入已有技能"
6345        } else {
6346            "📥 Import Existing Skills"
6347        }
6348    }
6349
6350    pub fn skills_manage_repos() -> &'static str {
6351        if is_chinese() {
6352            "📦 管理技能仓库"
6353        } else {
6354            "📦 Manage Skill Repos"
6355        }
6356    }
6357
6358    pub fn skills_enter_query() -> &'static str {
6359        if is_chinese() {
6360            "输入搜索关键词(可选):"
6361        } else {
6362            "Enter search query (optional):"
6363        }
6364    }
6365
6366    pub fn skills_enter_install_spec() -> &'static str {
6367        if is_chinese() {
6368            "输入技能目录,或完整标识(owner/name:directory):"
6369        } else {
6370            "Enter a skill directory, or a full key (owner/name:directory):"
6371        }
6372    }
6373
6374    pub fn skills_select_skill() -> &'static str {
6375        if is_chinese() {
6376            "选择一个 Skill:"
6377        } else {
6378            "Select a skill:"
6379        }
6380    }
6381
6382    pub fn skills_confirm_install(name: &str, app: &str) -> String {
6383        if is_chinese() {
6384            format!("确认安装 '{name}' 并启用到 {app}?")
6385        } else {
6386            format!("Install '{name}' and enable for {app}?")
6387        }
6388    }
6389
6390    pub fn skills_confirm_uninstall(name: &str) -> String {
6391        if is_chinese() {
6392            format!("确认卸载 '{name}'?")
6393        } else {
6394            format!("Uninstall '{name}'?")
6395        }
6396    }
6397
6398    pub fn skills_confirm_toggle(name: &str, app: &str, enabled: bool) -> String {
6399        if is_chinese() {
6400            if enabled {
6401                format!("确认启用 '{name}' 到 {app}?")
6402            } else {
6403                format!("确认在 {app} 禁用 '{name}'?")
6404            }
6405        } else if enabled {
6406            format!("Enable '{name}' for {app}?")
6407        } else {
6408            format!("Disable '{name}' for {app}?")
6409        }
6410    }
6411
6412    pub fn skills_no_unmanaged_found() -> &'static str {
6413        if is_chinese() {
6414            "未发现可导入的技能。所有技能已在 CC Switch 中统一管理。"
6415        } else {
6416            "No skills to import found. All skills are already managed by CC Switch."
6417        }
6418    }
6419
6420    pub fn skills_no_agent_installed_found() -> &'static str {
6421        if is_chinese() {
6422            "未发现可导入的智能体技能。已管理技能会自动同步实际启用状态。"
6423        } else {
6424            "No agent skills found to import. Managed skills automatically reflect live app enablement."
6425        }
6426    }
6427
6428    pub fn skills_select_unmanaged_to_import() -> &'static str {
6429        if is_chinese() {
6430            "选择要导入的技能:"
6431        } else {
6432            "Select skills to import:"
6433        }
6434    }
6435
6436    pub fn skills_repos_management() -> &'static str {
6437        if is_chinese() {
6438            "技能仓库管理"
6439        } else {
6440            "Skill Repos"
6441        }
6442    }
6443
6444    pub fn skills_repo_list() -> &'static str {
6445        if is_chinese() {
6446            "📋 查看仓库列表"
6447        } else {
6448            "📋 List Repos"
6449        }
6450    }
6451
6452    pub fn skills_repo_add() -> &'static str {
6453        if is_chinese() {
6454            "➕ 添加仓库"
6455        } else {
6456            "➕ Add Repo"
6457        }
6458    }
6459
6460    pub fn skills_repo_remove() -> &'static str {
6461        if is_chinese() {
6462            "➖ 移除仓库"
6463        } else {
6464            "➖ Remove Repo"
6465        }
6466    }
6467
6468    pub fn skills_repo_enter_spec() -> &'static str {
6469        if is_chinese() {
6470            "输入 GitHub 仓库(owner/name,可选 @branch)或完整 URL:"
6471        } else {
6472            "Enter a GitHub repository (owner/name, optional @branch) or a full URL:"
6473        }
6474    }
6475
6476    // ============================================
6477    // PROVIDER MANAGEMENT (供应商管理)
6478    // ============================================
6479
6480    pub fn provider_management() -> &'static str {
6481        if is_chinese() {
6482            "🔌 供应商管理"
6483        } else {
6484            "🔌 Provider Management"
6485        }
6486    }
6487
6488    pub fn no_providers() -> &'static str {
6489        if is_chinese() {
6490            "未找到供应商。"
6491        } else {
6492            "No providers found."
6493        }
6494    }
6495
6496    pub fn view_current_provider() -> &'static str {
6497        if is_chinese() {
6498            "📋 查看当前供应商详情"
6499        } else {
6500            "📋 View Current Provider Details"
6501        }
6502    }
6503
6504    pub fn switch_provider() -> &'static str {
6505        if is_chinese() {
6506            "🔄 切换供应商"
6507        } else {
6508            "🔄 Switch Provider"
6509        }
6510    }
6511
6512    pub fn add_provider() -> &'static str {
6513        if is_chinese() {
6514            "➕ 新增供应商"
6515        } else {
6516            "➕ Add Provider"
6517        }
6518    }
6519
6520    pub fn add_official_provider() -> &'static str {
6521        if is_chinese() {
6522            "添加官方供应商"
6523        } else {
6524            "Add Official Provider"
6525        }
6526    }
6527
6528    pub fn add_third_party_provider() -> &'static str {
6529        if is_chinese() {
6530            "添加第三方供应商"
6531        } else {
6532            "Add Third-Party Provider"
6533        }
6534    }
6535
6536    pub fn select_provider_add_mode() -> &'static str {
6537        if is_chinese() {
6538            "请选择供应商类型:"
6539        } else {
6540            "Select provider type:"
6541        }
6542    }
6543
6544    pub fn delete_provider() -> &'static str {
6545        if is_chinese() {
6546            "🗑️  删除供应商"
6547        } else {
6548            "🗑️  Delete Provider"
6549        }
6550    }
6551
6552    pub fn back_to_main() -> &'static str {
6553        if is_chinese() {
6554            "⬅️  返回主菜单"
6555        } else {
6556            "⬅️  Back to Main Menu"
6557        }
6558    }
6559
6560    pub fn choose_action() -> &'static str {
6561        if is_chinese() {
6562            "选择操作:"
6563        } else {
6564            "Choose an action:"
6565        }
6566    }
6567
6568    pub fn esc_to_go_back_help() -> &'static str {
6569        if is_chinese() {
6570            "Esc 返回上一步"
6571        } else {
6572            "Esc to go back"
6573        }
6574    }
6575
6576    pub fn select_filter_help() -> &'static str {
6577        if is_chinese() {
6578            "Esc 返回;输入可过滤"
6579        } else {
6580            "Esc to go back; type to filter"
6581        }
6582    }
6583
6584    pub fn current_provider_details() -> &'static str {
6585        if is_chinese() {
6586            "当前供应商详情"
6587        } else {
6588            "Current Provider Details"
6589        }
6590    }
6591
6592    pub fn only_one_provider() -> &'static str {
6593        if is_chinese() {
6594            "只有一个供应商,无法切换。"
6595        } else {
6596            "Only one provider available. Cannot switch."
6597        }
6598    }
6599
6600    pub fn no_other_providers() -> &'static str {
6601        if is_chinese() {
6602            "没有其他供应商可切换。"
6603        } else {
6604            "No other providers to switch to."
6605        }
6606    }
6607
6608    pub fn select_provider_to_switch() -> &'static str {
6609        if is_chinese() {
6610            "选择要切换到的供应商:"
6611        } else {
6612            "Select provider to switch to:"
6613        }
6614    }
6615
6616    pub fn switched_to_provider(id: &str) -> String {
6617        if is_chinese() {
6618            format!("✓ 已切换到供应商 '{}'", id)
6619        } else {
6620            format!("✓ Switched to provider '{}'", id)
6621        }
6622    }
6623
6624    pub fn provider_added_to_app_config(id: &str, app: &str) -> String {
6625        if is_chinese() {
6626            format!("✓ 已将供应商 '{}' 添加到 {} 配置", id, app)
6627        } else {
6628            format!("✓ Added provider '{}' to {} config", id, app)
6629        }
6630    }
6631
6632    pub fn restart_note() -> &'static str {
6633        if is_chinese() {
6634            "注意:请重启 CLI 客户端以应用更改。"
6635        } else {
6636            "Note: Restart your CLI client to apply the changes."
6637        }
6638    }
6639
6640    pub fn live_sync_skipped_uninitialized_warning(app: &str) -> String {
6641        if is_chinese() {
6642            format!("⚠ 未检测到 {app} 客户端本地配置,已跳过写入 live 文件;先运行一次 {app} 初始化后再试。")
6643        } else {
6644            format!("⚠ Live sync skipped: {app} client not initialized; run it once to initialize, then retry.")
6645        }
6646    }
6647
6648    pub fn no_deletable_providers() -> &'static str {
6649        if is_chinese() {
6650            "没有可删除的供应商(无法删除当前供应商)。"
6651        } else {
6652            "No providers available for deletion (cannot delete current provider)."
6653        }
6654    }
6655
6656    pub fn select_provider_to_delete() -> &'static str {
6657        if is_chinese() {
6658            "选择要删除的供应商:"
6659        } else {
6660            "Select provider to delete:"
6661        }
6662    }
6663
6664    pub fn confirm_delete(id: &str) -> String {
6665        if is_chinese() {
6666            format!("确定要删除供应商 '{}' 吗?", id)
6667        } else {
6668            format!("Are you sure you want to delete provider '{}'?", id)
6669        }
6670    }
6671
6672    pub fn cancelled() -> &'static str {
6673        if is_chinese() {
6674            "已取消。"
6675        } else {
6676            "Cancelled."
6677        }
6678    }
6679
6680    pub fn selection_cancelled() -> &'static str {
6681        if is_chinese() {
6682            "已取消选择"
6683        } else {
6684            "Selection cancelled"
6685        }
6686    }
6687
6688    pub fn invalid_selection() -> &'static str {
6689        if is_chinese() {
6690            "选择无效"
6691        } else {
6692            "Invalid selection"
6693        }
6694    }
6695
6696    pub fn available_backups() -> &'static str {
6697        if is_chinese() {
6698            "可用备份"
6699        } else {
6700            "Available Backups"
6701        }
6702    }
6703
6704    pub fn no_backups_found() -> &'static str {
6705        if is_chinese() {
6706            "未找到备份。"
6707        } else {
6708            "No backups found."
6709        }
6710    }
6711
6712    pub fn create_backup_first_hint() -> &'static str {
6713        if is_chinese() {
6714            "请先创建备份:cc-switch config backup"
6715        } else {
6716            "Create a backup first: cc-switch config backup"
6717        }
6718    }
6719
6720    pub fn found_backups(count: usize) -> String {
6721        if is_chinese() {
6722            format!("找到 {} 个备份:", count)
6723        } else {
6724            format!("Found {} backup(s):", count)
6725        }
6726    }
6727
6728    pub fn select_backup_to_restore() -> &'static str {
6729        if is_chinese() {
6730            "选择要恢复的备份:"
6731        } else {
6732            "Select backup to restore:"
6733        }
6734    }
6735
6736    pub fn warning_title() -> &'static str {
6737        if is_chinese() {
6738            "警告:"
6739        } else {
6740            "Warning:"
6741        }
6742    }
6743
6744    pub fn config_restore_warning_replace() -> &'static str {
6745        if is_chinese() {
6746            "这将用所选备份替换你当前的配置。"
6747        } else {
6748            "This will replace your current configuration with the selected backup."
6749        }
6750    }
6751
6752    pub fn config_restore_warning_pre_backup() -> &'static str {
6753        if is_chinese() {
6754            "系统会先创建一次当前状态的备份。"
6755        } else {
6756            "A backup of the current state will be created first."
6757        }
6758    }
6759
6760    pub fn config_restore_confirm_prompt() -> &'static str {
6761        if is_chinese() {
6762            "确认继续恢复?"
6763        } else {
6764            "Continue with restore?"
6765        }
6766    }
6767
6768    pub fn deleted_provider(id: &str) -> String {
6769        if is_chinese() {
6770            format!("✓ 已删除供应商 '{}'", id)
6771        } else {
6772            format!("✓ Deleted provider '{}'", id)
6773        }
6774    }
6775
6776    // Provider Input - Basic Fields
6777    pub fn provider_name_label() -> &'static str {
6778        if is_chinese() {
6779            "供应商名称:"
6780        } else {
6781            "Provider Name:"
6782        }
6783    }
6784
6785    pub fn provider_name_help() -> &'static str {
6786        if is_chinese() {
6787            "必填,用于显示的友好名称"
6788        } else {
6789            "Required, friendly display name"
6790        }
6791    }
6792
6793    pub fn provider_name_help_edit() -> &'static str {
6794        if is_chinese() {
6795            "必填,直接回车保持原值"
6796        } else {
6797            "Required, press Enter to keep"
6798        }
6799    }
6800
6801    pub fn provider_name_placeholder() -> &'static str {
6802        "OpenAI"
6803    }
6804
6805    pub fn provider_name_empty_error() -> &'static str {
6806        if is_chinese() {
6807            "供应商名称不能为空"
6808        } else {
6809            "Provider name cannot be empty"
6810        }
6811    }
6812
6813    pub fn website_url_label() -> &'static str {
6814        if is_chinese() {
6815            "官网 URL(可选):"
6816        } else {
6817            "Website URL (opt.):"
6818        }
6819    }
6820
6821    pub fn website_url_help() -> &'static str {
6822        if is_chinese() {
6823            "供应商的网站地址,直接回车跳过"
6824        } else {
6825            "Provider's website, press Enter to skip"
6826        }
6827    }
6828
6829    pub fn website_url_help_edit() -> &'static str {
6830        if is_chinese() {
6831            "留空则不修改,直接回车跳过"
6832        } else {
6833            "Leave blank to keep, Enter to skip"
6834        }
6835    }
6836
6837    pub fn website_url_placeholder() -> &'static str {
6838        "https://openai.com"
6839    }
6840
6841    // Provider Commands
6842    pub fn no_providers_hint() -> &'static str {
6843        "Use 'cc-switch provider add' to create a new provider."
6844    }
6845
6846    pub fn app_config_not_found(app: &str) -> String {
6847        if is_chinese() {
6848            format!("应用 {} 配置不存在", app)
6849        } else {
6850            format!("Application {} configuration not found", app)
6851        }
6852    }
6853
6854    pub fn provider_not_found(id: &str) -> String {
6855        if is_chinese() {
6856            format!("供应商不存在: {}", id)
6857        } else {
6858            format!("Provider not found: {}", id)
6859        }
6860    }
6861
6862    pub fn generated_id(id: &str) -> String {
6863        if is_chinese() {
6864            format!("生成的 ID: {}", id)
6865        } else {
6866            format!("Generated ID: {}", id)
6867        }
6868    }
6869
6870    pub fn configure_optional_fields_prompt() -> &'static str {
6871        if is_chinese() {
6872            "配置可选字段(备注、排序索引)?"
6873        } else {
6874            "Configure optional fields (notes, sort index)?"
6875        }
6876    }
6877
6878    pub fn current_config_header() -> &'static str {
6879        if is_chinese() {
6880            "当前配置:"
6881        } else {
6882            "Current Configuration:"
6883        }
6884    }
6885
6886    pub fn modify_provider_config_prompt() -> &'static str {
6887        if is_chinese() {
6888            "修改供应商配置(API Key, Base URL 等)?"
6889        } else {
6890            "Modify provider configuration (API Key, Base URL, etc.)?"
6891        }
6892    }
6893
6894    pub fn modify_optional_fields_prompt() -> &'static str {
6895        if is_chinese() {
6896            "修改可选字段(备注、排序索引)?"
6897        } else {
6898            "Modify optional fields (notes, sort index)?"
6899        }
6900    }
6901
6902    pub fn current_provider_synced_warning() -> &'static str {
6903        if is_chinese() {
6904            "⚠ 此供应商当前已激活,修改已同步到 live 配置"
6905        } else {
6906            "⚠ This provider is currently active, changes synced to live config"
6907        }
6908    }
6909
6910    pub fn input_failed_error(err: &str) -> String {
6911        if is_chinese() {
6912            format!("输入失败: {}", err)
6913        } else {
6914            format!("Input failed: {}", err)
6915        }
6916    }
6917
6918    pub fn cannot_delete_current_provider() -> &'static str {
6919        "Cannot delete the current active provider. Please switch to another provider first."
6920    }
6921
6922    // Provider Input - Basic Fields
6923    pub fn provider_name_prompt() -> &'static str {
6924        if is_chinese() {
6925            "供应商名称:"
6926        } else {
6927            "Provider Name:"
6928        }
6929    }
6930
6931    // Provider Input - Claude Configuration
6932    pub fn config_claude_header() -> &'static str {
6933        if is_chinese() {
6934            "配置 Claude 供应商:"
6935        } else {
6936            "Configure Claude Provider:"
6937        }
6938    }
6939
6940    pub fn api_key_label() -> &'static str {
6941        if is_chinese() {
6942            "API Key:"
6943        } else {
6944            "API Key:"
6945        }
6946    }
6947
6948    pub fn api_key_help() -> &'static str {
6949        if is_chinese() {
6950            "留空使用默认值"
6951        } else {
6952            "Leave empty to use default"
6953        }
6954    }
6955
6956    pub fn base_url_label() -> &'static str {
6957        if is_chinese() {
6958            "Base URL:"
6959        } else {
6960            "Base URL:"
6961        }
6962    }
6963
6964    pub fn base_url_empty_error() -> &'static str {
6965        if is_chinese() {
6966            "API 请求地址不能为空"
6967        } else {
6968            "API URL cannot be empty"
6969        }
6970    }
6971
6972    pub fn base_url_placeholder() -> &'static str {
6973        if is_chinese() {
6974            "如 https://api.anthropic.com"
6975        } else {
6976            "e.g., https://api.anthropic.com"
6977        }
6978    }
6979
6980    pub fn configure_model_names_prompt() -> &'static str {
6981        if is_chinese() {
6982            "配置模型名称?"
6983        } else {
6984            "Configure model names?"
6985        }
6986    }
6987
6988    pub fn model_default_label() -> &'static str {
6989        if is_chinese() {
6990            "默认模型:"
6991        } else {
6992            "Default Model:"
6993        }
6994    }
6995
6996    pub fn model_default_help() -> &'static str {
6997        if is_chinese() {
6998            "留空使用 Claude Code 默认模型"
6999        } else {
7000            "Leave empty to use Claude Code default"
7001        }
7002    }
7003
7004    pub fn model_haiku_label() -> &'static str {
7005        if is_chinese() {
7006            "Haiku 模型:"
7007        } else {
7008            "Haiku Model:"
7009        }
7010    }
7011
7012    pub fn model_haiku_placeholder() -> &'static str {
7013        if is_chinese() {
7014            "如 claude-3-5-haiku-20241022"
7015        } else {
7016            "e.g., claude-3-5-haiku-20241022"
7017        }
7018    }
7019
7020    pub fn model_sonnet_label() -> &'static str {
7021        if is_chinese() {
7022            "Sonnet 模型:"
7023        } else {
7024            "Sonnet Model:"
7025        }
7026    }
7027
7028    pub fn model_sonnet_placeholder() -> &'static str {
7029        if is_chinese() {
7030            "如 claude-3-5-sonnet-20241022"
7031        } else {
7032            "e.g., claude-3-5-sonnet-20241022"
7033        }
7034    }
7035
7036    pub fn model_opus_label() -> &'static str {
7037        if is_chinese() {
7038            "Opus 模型:"
7039        } else {
7040            "Opus Model:"
7041        }
7042    }
7043
7044    pub fn model_opus_placeholder() -> &'static str {
7045        if is_chinese() {
7046            "如 claude-3-opus-20240229"
7047        } else {
7048            "e.g., claude-3-opus-20240229"
7049        }
7050    }
7051
7052    // Provider Input - Codex Configuration
7053    pub fn config_codex_header() -> &'static str {
7054        if is_chinese() {
7055            "配置 Codex 供应商:"
7056        } else {
7057            "Configure Codex Provider:"
7058        }
7059    }
7060
7061    pub fn openai_api_key_label() -> &'static str {
7062        if is_chinese() {
7063            "OpenAI API Key:"
7064        } else {
7065            "OpenAI API Key:"
7066        }
7067    }
7068
7069    pub fn anthropic_api_key_label() -> &'static str {
7070        if is_chinese() {
7071            "Anthropic API Key:"
7072        } else {
7073            "Anthropic API Key:"
7074        }
7075    }
7076
7077    pub fn config_toml_label() -> &'static str {
7078        if is_chinese() {
7079            "配置内容 (TOML):"
7080        } else {
7081            "Config Content (TOML):"
7082        }
7083    }
7084
7085    pub fn config_toml_help() -> &'static str {
7086        if is_chinese() {
7087            "按 Esc 后 Enter 提交"
7088        } else {
7089            "Press Esc then Enter to submit"
7090        }
7091    }
7092
7093    pub fn config_toml_placeholder() -> &'static str {
7094        if is_chinese() {
7095            "留空使用默认配置"
7096        } else {
7097            "Leave empty to use default config"
7098        }
7099    }
7100
7101    // Codex 0.64+ Configuration
7102    pub fn codex_auth_mode_info() -> &'static str {
7103        if is_chinese() {
7104            "⚠ 请选择 Codex 的鉴权方式(决定 API Key 从哪里读取)"
7105        } else {
7106            "⚠ Choose how Codex authenticates (where the API key is read from)"
7107        }
7108    }
7109
7110    pub fn codex_auth_mode_label() -> &'static str {
7111        if is_chinese() {
7112            "认证方式:"
7113        } else {
7114            "Auth Mode:"
7115        }
7116    }
7117
7118    pub fn codex_auth_mode_help() -> &'static str {
7119        if is_chinese() {
7120            "OpenAI 认证:使用 auth.json/凭据存储;环境变量:使用 env_key 指定的变量(未设置会报错)"
7121        } else {
7122            "OpenAI auth uses auth.json/credential store; env var mode uses env_key (missing env var will error)"
7123        }
7124    }
7125
7126    pub fn codex_auth_mode_openai() -> &'static str {
7127        if is_chinese() {
7128            "OpenAI 认证(推荐,无需环境变量)"
7129        } else {
7130            "OpenAI auth (recommended, no env var)"
7131        }
7132    }
7133
7134    pub fn codex_auth_mode_env_var() -> &'static str {
7135        if is_chinese() {
7136            "环境变量(env_key,需要手动 export)"
7137        } else {
7138            "Environment variable (env_key, requires export)"
7139        }
7140    }
7141
7142    pub fn codex_official_provider_tip() -> &'static str {
7143        if is_chinese() {
7144            "提示:官方供应商将使用 Codex 官方登录保存的凭证(codex login 可能会打开浏览器),无需填写 API Key"
7145        } else {
7146            "Tip: Official provider uses Codex login credentials (`codex login` may open a browser); no API key required"
7147        }
7148    }
7149
7150    pub fn codex_env_key_info() -> &'static str {
7151        if is_chinese() {
7152            "⚠ 环境变量模式:Codex 将从指定的环境变量读取 API Key"
7153        } else {
7154            "⚠ Env var mode: Codex will read the API key from the specified environment variable"
7155        }
7156    }
7157
7158    pub fn codex_env_key_label() -> &'static str {
7159        if is_chinese() {
7160            "环境变量名称:"
7161        } else {
7162            "Environment Variable Name:"
7163        }
7164    }
7165
7166    pub fn codex_env_key_help() -> &'static str {
7167        if is_chinese() {
7168            "Codex 将从此环境变量读取 API 密钥(默认: OPENAI_API_KEY)"
7169        } else {
7170            "Codex will read API key from this env var (default: OPENAI_API_KEY)"
7171        }
7172    }
7173
7174    pub fn codex_wire_api_label() -> &'static str {
7175        if is_chinese() {
7176            "API 格式:"
7177        } else {
7178            "API Format:"
7179        }
7180    }
7181
7182    pub fn codex_wire_api_help() -> &'static str {
7183        if is_chinese() {
7184            "chat = Chat Completions API (大多数第三方), responses = OpenAI Responses API"
7185        } else {
7186            "chat = Chat Completions API (most providers), responses = OpenAI Responses API"
7187        }
7188    }
7189
7190    pub fn codex_env_reminder(env_key: &str) -> String {
7191        if is_chinese() {
7192            format!(
7193                "⚠ 请确保已设置环境变量 {} 并包含您的 API 密钥\n  例如: export {}=\"your-api-key\"",
7194                env_key, env_key
7195            )
7196        } else {
7197            format!(
7198                "⚠ Make sure to set the {} environment variable with your API key\n  Example: export {}=\"your-api-key\"",
7199                env_key, env_key
7200            )
7201        }
7202    }
7203
7204    pub fn codex_openai_auth_info() -> &'static str {
7205        if is_chinese() {
7206            "✓ OpenAI 认证模式:Codex 将使用 auth.json/系统凭据存储,无需设置 OPENAI_API_KEY 环境变量"
7207        } else {
7208            "✓ OpenAI auth mode: Codex will use auth.json/credential store; no OPENAI_API_KEY env var required"
7209        }
7210    }
7211
7212    pub fn codex_dual_write_info(env_key: &str, _api_key: &str) -> String {
7213        if is_chinese() {
7214            format!(
7215                "✓ 双写模式已启用(兼容所有 Codex 版本)\n\
7216                  • 旧版本 Codex: 将使用 auth.json 中的 API Key\n\
7217                  • Codex 0.64+: 可使用环境变量 {} (更安全)\n\
7218                    例如: export {}=\"your-api-key\"",
7219                env_key, env_key
7220            )
7221        } else {
7222            format!(
7223                "✓ Dual-write mode enabled (compatible with all Codex versions)\n\
7224                  • Legacy Codex: Will use API Key from auth.json\n\
7225                  • Codex 0.64+: Can use env variable {} (more secure)\n\
7226                    Example: export {}=\"your-api-key\"",
7227                env_key, env_key
7228            )
7229        }
7230    }
7231
7232    pub fn use_current_config_prompt() -> &'static str {
7233        if is_chinese() {
7234            "使用当前配置?"
7235        } else {
7236            "Use current configuration?"
7237        }
7238    }
7239
7240    pub fn use_current_config_help() -> &'static str {
7241        if is_chinese() {
7242            "选择 No 将进入自定义输入模式"
7243        } else {
7244            "Select No to enter custom input mode"
7245        }
7246    }
7247
7248    pub fn input_toml_config() -> &'static str {
7249        if is_chinese() {
7250            "输入 TOML 配置(多行,输入空行结束):"
7251        } else {
7252            "Enter TOML config (multiple lines, empty line to finish):"
7253        }
7254    }
7255
7256    pub fn direct_enter_to_finish() -> &'static str {
7257        if is_chinese() {
7258            "直接回车结束输入"
7259        } else {
7260            "Press Enter to finish"
7261        }
7262    }
7263
7264    pub fn current_config_label() -> &'static str {
7265        if is_chinese() {
7266            "当前配置:"
7267        } else {
7268            "Current Config:"
7269        }
7270    }
7271
7272    pub fn config_toml_header() -> &'static str {
7273        if is_chinese() {
7274            "Config.toml 配置:"
7275        } else {
7276            "Config.toml Configuration:"
7277        }
7278    }
7279
7280    // Provider Input - Gemini Configuration
7281    pub fn config_gemini_header() -> &'static str {
7282        if is_chinese() {
7283            "配置 Gemini 供应商:"
7284        } else {
7285            "Configure Gemini Provider:"
7286        }
7287    }
7288
7289    pub fn auth_type_label() -> &'static str {
7290        if is_chinese() {
7291            "认证类型:"
7292        } else {
7293            "Auth Type:"
7294        }
7295    }
7296
7297    pub fn auth_type_api_key() -> &'static str {
7298        if is_chinese() {
7299            "API Key"
7300        } else {
7301            "API Key"
7302        }
7303    }
7304
7305    pub fn auth_type_service_account() -> &'static str {
7306        if is_chinese() {
7307            "Service Account (ADC)"
7308        } else {
7309            "Service Account (ADC)"
7310        }
7311    }
7312
7313    pub fn gemini_api_key_label() -> &'static str {
7314        if is_chinese() {
7315            "Gemini API Key:"
7316        } else {
7317            "Gemini API Key:"
7318        }
7319    }
7320
7321    pub fn gemini_base_url_label() -> &'static str {
7322        if is_chinese() {
7323            "Base URL:"
7324        } else {
7325            "Base URL:"
7326        }
7327    }
7328
7329    pub fn gemini_base_url_help() -> &'static str {
7330        if is_chinese() {
7331            "留空使用官方 API"
7332        } else {
7333            "Leave empty to use official API"
7334        }
7335    }
7336
7337    pub fn gemini_base_url_placeholder() -> &'static str {
7338        if is_chinese() {
7339            "如 https://generativelanguage.googleapis.com"
7340        } else {
7341            "e.g., https://generativelanguage.googleapis.com"
7342        }
7343    }
7344
7345    pub fn adc_project_id_label() -> &'static str {
7346        if is_chinese() {
7347            "GCP Project ID:"
7348        } else {
7349            "GCP Project ID:"
7350        }
7351    }
7352
7353    pub fn adc_location_label() -> &'static str {
7354        if is_chinese() {
7355            "GCP Location:"
7356        } else {
7357            "GCP Location:"
7358        }
7359    }
7360
7361    pub fn adc_location_placeholder() -> &'static str {
7362        if is_chinese() {
7363            "如 us-central1"
7364        } else {
7365            "e.g., us-central1"
7366        }
7367    }
7368
7369    pub fn google_oauth_official() -> &'static str {
7370        if is_chinese() {
7371            "Google OAuth(官方)"
7372        } else {
7373            "Google OAuth (Official)"
7374        }
7375    }
7376
7377    pub fn packycode_api_key() -> &'static str {
7378        if is_chinese() {
7379            "PackyCode API Key"
7380        } else {
7381            "PackyCode API Key"
7382        }
7383    }
7384
7385    pub fn generic_api_key() -> &'static str {
7386        if is_chinese() {
7387            "通用 API Key"
7388        } else {
7389            "Generic API Key"
7390        }
7391    }
7392
7393    pub fn select_auth_method_help() -> &'static str {
7394        if is_chinese() {
7395            "选择 Gemini 的认证方式"
7396        } else {
7397            "Select authentication method for Gemini"
7398        }
7399    }
7400
7401    pub fn use_google_oauth_warning() -> &'static str {
7402        if is_chinese() {
7403            "使用 Google OAuth,将清空 API Key 配置"
7404        } else {
7405            "Using Google OAuth, API Key config will be cleared"
7406        }
7407    }
7408
7409    pub fn packycode_api_key_help() -> &'static str {
7410        if is_chinese() {
7411            "从 PackyCode 获取的 API Key"
7412        } else {
7413            "API Key obtained from PackyCode"
7414        }
7415    }
7416
7417    pub fn packycode_endpoint_help() -> &'static str {
7418        if is_chinese() {
7419            "PackyCode API 端点"
7420        } else {
7421            "PackyCode API endpoint"
7422        }
7423    }
7424
7425    pub fn generic_api_key_help() -> &'static str {
7426        if is_chinese() {
7427            "通用的 Gemini API Key"
7428        } else {
7429            "Generic Gemini API Key"
7430        }
7431    }
7432
7433    // Provider Input - Optional Fields
7434    pub fn notes_label() -> &'static str {
7435        if is_chinese() {
7436            "备注:"
7437        } else {
7438            "Notes:"
7439        }
7440    }
7441
7442    pub fn notes_placeholder() -> &'static str {
7443        if is_chinese() {
7444            "可选的备注信息"
7445        } else {
7446            "Optional notes"
7447        }
7448    }
7449
7450    pub fn sort_index_label() -> &'static str {
7451        if is_chinese() {
7452            "排序索引:"
7453        } else {
7454            "Sort Index:"
7455        }
7456    }
7457
7458    pub fn sort_index_help() -> &'static str {
7459        if is_chinese() {
7460            "数字越小越靠前,留空使用创建时间排序"
7461        } else {
7462            "Lower numbers appear first, leave empty to sort by creation time"
7463        }
7464    }
7465
7466    pub fn sort_index_placeholder() -> &'static str {
7467        if is_chinese() {
7468            "如 1, 2, 3..."
7469        } else {
7470            "e.g., 1, 2, 3..."
7471        }
7472    }
7473
7474    pub fn invalid_sort_index() -> &'static str {
7475        if is_chinese() {
7476            "排序索引必须是有效的数字"
7477        } else {
7478            "Sort index must be a valid number"
7479        }
7480    }
7481
7482    pub fn optional_fields_config() -> &'static str {
7483        if is_chinese() {
7484            "可选字段配置:"
7485        } else {
7486            "Optional Fields Configuration:"
7487        }
7488    }
7489
7490    pub fn notes_example_placeholder() -> &'static str {
7491        if is_chinese() {
7492            "自定义供应商,用于测试"
7493        } else {
7494            "Custom provider for testing"
7495        }
7496    }
7497
7498    pub fn notes_help_edit() -> &'static str {
7499        if is_chinese() {
7500            "关于此供应商的额外说明,直接回车保持原值"
7501        } else {
7502            "Additional notes about this provider, press Enter to keep current value"
7503        }
7504    }
7505
7506    pub fn notes_help_new() -> &'static str {
7507        if is_chinese() {
7508            "关于此供应商的额外说明,直接回车跳过"
7509        } else {
7510            "Additional notes about this provider, press Enter to skip"
7511        }
7512    }
7513
7514    pub fn sort_index_help_edit() -> &'static str {
7515        if is_chinese() {
7516            "数字,用于控制显示顺序,直接回车保持原值"
7517        } else {
7518            "Number for display order, press Enter to keep current value"
7519        }
7520    }
7521
7522    pub fn sort_index_help_new() -> &'static str {
7523        if is_chinese() {
7524            "数字,用于控制显示顺序,直接回车跳过"
7525        } else {
7526            "Number for display order, press Enter to skip"
7527        }
7528    }
7529
7530    pub fn invalid_sort_index_number() -> &'static str {
7531        if is_chinese() {
7532            "排序索引必须是数字"
7533        } else {
7534            "Sort index must be a number"
7535        }
7536    }
7537
7538    pub fn provider_config_summary() -> &'static str {
7539        if is_chinese() {
7540            "=== 供应商配置摘要 ==="
7541        } else {
7542            "=== Provider Configuration Summary ==="
7543        }
7544    }
7545
7546    pub fn id_label() -> &'static str {
7547        if is_chinese() {
7548            "ID"
7549        } else {
7550            "ID"
7551        }
7552    }
7553
7554    pub fn website_label() -> &'static str {
7555        if is_chinese() {
7556            "官网"
7557        } else {
7558            "Website"
7559        }
7560    }
7561
7562    pub fn core_config_label() -> &'static str {
7563        if is_chinese() {
7564            "核心配置:"
7565        } else {
7566            "Core Configuration:"
7567        }
7568    }
7569
7570    pub fn model_label() -> &'static str {
7571        if is_chinese() {
7572            "模型"
7573        } else {
7574            "Model"
7575        }
7576    }
7577
7578    pub fn config_toml_lines(count: usize) -> String {
7579        if is_chinese() {
7580            format!("Config (TOML): {} 行", count)
7581        } else {
7582            format!("Config (TOML): {} lines", count)
7583        }
7584    }
7585
7586    pub fn optional_fields_label() -> &'static str {
7587        if is_chinese() {
7588            "可选字段:"
7589        } else {
7590            "Optional Fields:"
7591        }
7592    }
7593
7594    pub fn notes_label_colon() -> &'static str {
7595        if is_chinese() {
7596            "备注"
7597        } else {
7598            "Notes"
7599        }
7600    }
7601
7602    pub fn sort_index_label_colon() -> &'static str {
7603        if is_chinese() {
7604            "排序索引"
7605        } else {
7606            "Sort Index"
7607        }
7608    }
7609
7610    pub fn id_label_colon() -> &'static str {
7611        if is_chinese() {
7612            "ID"
7613        } else {
7614            "ID"
7615        }
7616    }
7617
7618    pub fn url_label_colon() -> &'static str {
7619        if is_chinese() {
7620            "网址"
7621        } else {
7622            "URL"
7623        }
7624    }
7625
7626    pub fn api_url_label_colon() -> &'static str {
7627        if is_chinese() {
7628            "API 地址"
7629        } else {
7630            "API URL"
7631        }
7632    }
7633
7634    pub fn summary_divider() -> &'static str {
7635        "======================"
7636    }
7637
7638    // Provider Input - Summary Display
7639    pub fn basic_info_header() -> &'static str {
7640        if is_chinese() {
7641            "基本信息"
7642        } else {
7643            "Basic Info"
7644        }
7645    }
7646
7647    pub fn name_display_label() -> &'static str {
7648        if is_chinese() {
7649            "名称"
7650        } else {
7651            "Name"
7652        }
7653    }
7654
7655    pub fn app_display_label() -> &'static str {
7656        if is_chinese() {
7657            "应用"
7658        } else {
7659            "App"
7660        }
7661    }
7662
7663    pub fn notes_display_label() -> &'static str {
7664        if is_chinese() {
7665            "备注"
7666        } else {
7667            "Notes"
7668        }
7669    }
7670
7671    pub fn sort_index_display_label() -> &'static str {
7672        if is_chinese() {
7673            "排序"
7674        } else {
7675            "Sort Index"
7676        }
7677    }
7678
7679    pub fn config_info_header() -> &'static str {
7680        if is_chinese() {
7681            "配置信息"
7682        } else {
7683            "Configuration"
7684        }
7685    }
7686
7687    pub fn api_key_display_label() -> &'static str {
7688        if is_chinese() {
7689            "API Key"
7690        } else {
7691            "API Key"
7692        }
7693    }
7694
7695    pub fn base_url_display_label() -> &'static str {
7696        if is_chinese() {
7697            "Base URL"
7698        } else {
7699            "Base URL"
7700        }
7701    }
7702
7703    pub fn model_config_header() -> &'static str {
7704        if is_chinese() {
7705            "模型配置"
7706        } else {
7707            "Model Configuration"
7708        }
7709    }
7710
7711    pub fn default_model_display() -> &'static str {
7712        if is_chinese() {
7713            "默认"
7714        } else {
7715            "Default"
7716        }
7717    }
7718
7719    pub fn haiku_model_display() -> &'static str {
7720        if is_chinese() {
7721            "Haiku"
7722        } else {
7723            "Haiku"
7724        }
7725    }
7726
7727    pub fn sonnet_model_display() -> &'static str {
7728        if is_chinese() {
7729            "Sonnet"
7730        } else {
7731            "Sonnet"
7732        }
7733    }
7734
7735    pub fn opus_model_display() -> &'static str {
7736        if is_chinese() {
7737            "Opus"
7738        } else {
7739            "Opus"
7740        }
7741    }
7742
7743    pub fn auth_type_display_label() -> &'static str {
7744        if is_chinese() {
7745            "认证"
7746        } else {
7747            "Auth Type"
7748        }
7749    }
7750
7751    pub fn project_id_display_label() -> &'static str {
7752        if is_chinese() {
7753            "项目 ID"
7754        } else {
7755            "Project ID"
7756        }
7757    }
7758
7759    pub fn location_display_label() -> &'static str {
7760        if is_chinese() {
7761            "位置"
7762        } else {
7763            "Location"
7764        }
7765    }
7766
7767    // Interactive Provider - Menu Options
7768    pub fn edit_provider_menu() -> &'static str {
7769        if is_chinese() {
7770            "➕ 编辑供应商"
7771        } else {
7772            "➕ Edit Provider"
7773        }
7774    }
7775
7776    pub fn no_editable_providers() -> &'static str {
7777        if is_chinese() {
7778            "没有可编辑的供应商"
7779        } else {
7780            "No providers available for editing"
7781        }
7782    }
7783
7784    pub fn select_provider_to_edit() -> &'static str {
7785        if is_chinese() {
7786            "选择要编辑的供应商:"
7787        } else {
7788            "Select provider to edit:"
7789        }
7790    }
7791
7792    pub fn choose_edit_mode() -> &'static str {
7793        if is_chinese() {
7794            "选择编辑模式:"
7795        } else {
7796            "Choose edit mode:"
7797        }
7798    }
7799
7800    pub fn select_config_file_to_edit() -> &'static str {
7801        if is_chinese() {
7802            "选择要编辑的配置文件:"
7803        } else {
7804            "Select config file to edit:"
7805        }
7806    }
7807
7808    pub fn provider_missing_auth_field() -> &'static str {
7809        if is_chinese() {
7810            "settings_config 中缺少 'auth' 字段"
7811        } else {
7812            "Missing 'auth' field in settings_config"
7813        }
7814    }
7815
7816    pub fn provider_missing_or_invalid_config_field() -> &'static str {
7817        if is_chinese() {
7818            "settings_config 中缺少或无效的 'config' 字段"
7819        } else {
7820            "Missing or invalid 'config' field in settings_config"
7821        }
7822    }
7823
7824    pub fn edit_mode_interactive() -> &'static str {
7825        if is_chinese() {
7826            "📝 交互式编辑 (分步提示)"
7827        } else {
7828            "📝 Interactive editing (step-by-step prompts)"
7829        }
7830    }
7831
7832    pub fn edit_mode_json_editor() -> &'static str {
7833        if is_chinese() {
7834            "✏️  JSON 编辑 (使用外部编辑器)"
7835        } else {
7836            "✏️  JSON editing (use external editor)"
7837        }
7838    }
7839
7840    pub fn cancel() -> &'static str {
7841        if is_chinese() {
7842            "❌ 取消"
7843        } else {
7844            "❌ Cancel"
7845        }
7846    }
7847
7848    pub fn opening_external_editor() -> &'static str {
7849        if is_chinese() {
7850            "正在打开外部编辑器..."
7851        } else {
7852            "Opening external editor..."
7853        }
7854    }
7855
7856    pub fn invalid_json_syntax() -> &'static str {
7857        if is_chinese() {
7858            "无效的 JSON 语法"
7859        } else {
7860            "Invalid JSON syntax"
7861        }
7862    }
7863
7864    pub fn invalid_provider_structure() -> &'static str {
7865        if is_chinese() {
7866            "无效的供应商结构"
7867        } else {
7868            "Invalid provider structure"
7869        }
7870    }
7871
7872    pub fn provider_id_cannot_be_changed() -> &'static str {
7873        if is_chinese() {
7874            "供应商 ID 不能被修改"
7875        } else {
7876            "Provider ID cannot be changed"
7877        }
7878    }
7879
7880    pub fn retry_editing() -> &'static str {
7881        if is_chinese() {
7882            "是否重新编辑?"
7883        } else {
7884            "Retry editing?"
7885        }
7886    }
7887
7888    pub fn no_changes_detected() -> &'static str {
7889        if is_chinese() {
7890            "未检测到任何更改"
7891        } else {
7892            "No changes detected"
7893        }
7894    }
7895
7896    pub fn provider_summary() -> &'static str {
7897        if is_chinese() {
7898            "供应商信息摘要"
7899        } else {
7900            "Provider Summary"
7901        }
7902    }
7903
7904    pub fn confirm_save_changes() -> &'static str {
7905        if is_chinese() {
7906            "确认保存更改?"
7907        } else {
7908            "Save changes?"
7909        }
7910    }
7911
7912    pub fn editor_failed() -> &'static str {
7913        if is_chinese() {
7914            "编辑器失败"
7915        } else {
7916            "Editor failed"
7917        }
7918    }
7919
7920    pub fn invalid_selection_format() -> &'static str {
7921        if is_chinese() {
7922            "无效的选择格式"
7923        } else {
7924            "Invalid selection format"
7925        }
7926    }
7927
7928    // Provider Display Labels (for show_current and view_provider_detail)
7929    pub fn basic_info_section_header() -> &'static str {
7930        if is_chinese() {
7931            "基本信息 / Basic Info"
7932        } else {
7933            "Basic Info"
7934        }
7935    }
7936
7937    pub fn name_label_with_colon() -> &'static str {
7938        if is_chinese() {
7939            "名称"
7940        } else {
7941            "Name"
7942        }
7943    }
7944
7945    pub fn app_label_with_colon() -> &'static str {
7946        if is_chinese() {
7947            "应用"
7948        } else {
7949            "App"
7950        }
7951    }
7952
7953    pub fn api_config_section_header() -> &'static str {
7954        if is_chinese() {
7955            "API 配置 / API Configuration"
7956        } else {
7957            "API Configuration"
7958        }
7959    }
7960
7961    pub fn model_config_section_header() -> &'static str {
7962        if is_chinese() {
7963            "模型配置 / Model Configuration"
7964        } else {
7965            "Model Configuration"
7966        }
7967    }
7968
7969    pub fn main_model_label_with_colon() -> &'static str {
7970        if is_chinese() {
7971            "主模型"
7972        } else {
7973            "Main Model"
7974        }
7975    }
7976
7977    pub fn updated_config_header() -> &'static str {
7978        if is_chinese() {
7979            "修改后配置:"
7980        } else {
7981            "Updated Configuration:"
7982        }
7983    }
7984
7985    // Provider Add/Edit Messages
7986    pub fn generated_id_message(id: &str) -> String {
7987        if is_chinese() {
7988            format!("生成的 ID: {}", id)
7989        } else {
7990            format!("Generated ID: {}", id)
7991        }
7992    }
7993
7994    pub fn edit_fields_instruction() -> &'static str {
7995        if is_chinese() {
7996            "逐个编辑字段(直接回车保留当前值):\n"
7997        } else {
7998            "Edit fields one by one (press Enter to keep current value):\n"
7999        }
8000    }
8001
8002    // ============================================
8003    // MCP SERVER MANAGEMENT (MCP 服务器管理)
8004    // ============================================
8005
8006    pub fn mcp_management() -> &'static str {
8007        if is_chinese() {
8008            "🛠️  MCP 服务器管理"
8009        } else {
8010            "🛠️  MCP Server Management"
8011        }
8012    }
8013
8014    pub fn no_mcp_servers() -> &'static str {
8015        if is_chinese() {
8016            "未找到 MCP 服务器。"
8017        } else {
8018            "No MCP servers found."
8019        }
8020    }
8021
8022    pub fn sync_all_servers() -> &'static str {
8023        if is_chinese() {
8024            "🔄 同步所有服务器"
8025        } else {
8026            "🔄 Sync All Servers"
8027        }
8028    }
8029
8030    pub fn synced_successfully() -> &'static str {
8031        if is_chinese() {
8032            "✓ 所有 MCP 服务器同步成功"
8033        } else {
8034            "✓ All MCP servers synced successfully"
8035        }
8036    }
8037
8038    // ============================================
8039    // PROMPT MANAGEMENT (提示词管理)
8040    // ============================================
8041
8042    pub fn prompts_management() -> &'static str {
8043        if is_chinese() {
8044            "💬 提示词管理"
8045        } else {
8046            "💬 Prompt Management"
8047        }
8048    }
8049
8050    pub fn no_prompts() -> &'static str {
8051        if is_chinese() {
8052            "未找到提示词预设。"
8053        } else {
8054            "No prompt presets found."
8055        }
8056    }
8057
8058    pub fn switch_active_prompt() -> &'static str {
8059        if is_chinese() {
8060            "🔄 切换活动提示词"
8061        } else {
8062            "🔄 Switch Active Prompt"
8063        }
8064    }
8065
8066    pub fn no_prompts_available() -> &'static str {
8067        if is_chinese() {
8068            "没有可用的提示词。"
8069        } else {
8070            "No prompts available."
8071        }
8072    }
8073
8074    pub fn select_prompt_to_activate() -> &'static str {
8075        if is_chinese() {
8076            "选择要激活的提示词:"
8077        } else {
8078            "Select prompt to activate:"
8079        }
8080    }
8081
8082    pub fn activated_prompt(id: &str) -> String {
8083        if is_chinese() {
8084            format!("✓ 已激活提示词 '{}'", id)
8085        } else {
8086            format!("✓ Activated prompt '{}'", id)
8087        }
8088    }
8089
8090    pub fn deactivated_prompt(id: &str) -> String {
8091        if is_chinese() {
8092            format!("✓ 已取消激活提示词 '{}'", id)
8093        } else {
8094            format!("✓ Deactivated prompt '{}'", id)
8095        }
8096    }
8097
8098    pub fn prompt_cleared_note() -> &'static str {
8099        if is_chinese() {
8100            "实时文件已清空"
8101        } else {
8102            "Live prompt file has been cleared"
8103        }
8104    }
8105
8106    pub fn prompt_synced_note() -> &'static str {
8107        if is_chinese() {
8108            "注意:提示词已同步到实时配置文件。"
8109        } else {
8110            "Note: The prompt has been synced to the live configuration file."
8111        }
8112    }
8113
8114    // Configuration View
8115    pub fn current_configuration() -> &'static str {
8116        if is_chinese() {
8117            "👁️  当前配置"
8118        } else {
8119            "👁️  Current Configuration"
8120        }
8121    }
8122
8123    pub fn provider_label() -> &'static str {
8124        if is_chinese() {
8125            "供应商:"
8126        } else {
8127            "Provider:"
8128        }
8129    }
8130
8131    pub fn mcp_servers_label() -> &'static str {
8132        if is_chinese() {
8133            "MCP 服务器:"
8134        } else {
8135            "MCP Servers:"
8136        }
8137    }
8138
8139    pub fn tui_label_mcp_short() -> &'static str {
8140        "MCP:"
8141    }
8142
8143    pub fn tui_label_skills() -> &'static str {
8144        if is_chinese() {
8145            "技能:"
8146        } else {
8147            "Skills:"
8148        }
8149    }
8150
8151    pub fn prompts_label() -> &'static str {
8152        if is_chinese() {
8153            "提示词:"
8154        } else {
8155            "Prompts:"
8156        }
8157    }
8158
8159    pub fn total() -> &'static str {
8160        if is_chinese() {
8161            "总计"
8162        } else {
8163            "Total"
8164        }
8165    }
8166
8167    pub fn enabled() -> &'static str {
8168        if is_chinese() {
8169            "启用"
8170        } else {
8171            "Enabled"
8172        }
8173    }
8174
8175    pub fn disabled() -> &'static str {
8176        if is_chinese() {
8177            "禁用"
8178        } else {
8179            "Disabled"
8180        }
8181    }
8182
8183    pub fn active() -> &'static str {
8184        if is_chinese() {
8185            "活动"
8186        } else {
8187            "Active"
8188        }
8189    }
8190
8191    pub fn none() -> &'static str {
8192        if is_chinese() {
8193            "无"
8194        } else {
8195            "None"
8196        }
8197    }
8198
8199    // Settings
8200    pub fn settings_title() -> &'static str {
8201        if is_chinese() {
8202            "⚙️  设置"
8203        } else {
8204            "⚙️  Settings"
8205        }
8206    }
8207
8208    pub fn change_language() -> &'static str {
8209        if is_chinese() {
8210            "🌐 切换语言"
8211        } else {
8212            "🌐 Change Language"
8213        }
8214    }
8215
8216    pub fn current_language_label() -> &'static str {
8217        if is_chinese() {
8218            "当前语言"
8219        } else {
8220            "Current Language"
8221        }
8222    }
8223
8224    pub fn select_language() -> &'static str {
8225        if is_chinese() {
8226            "选择语言:"
8227        } else {
8228            "Select language:"
8229        }
8230    }
8231
8232    pub fn language_changed() -> &'static str {
8233        if is_chinese() {
8234            "✓ 语言已更改"
8235        } else {
8236            "✓ Language changed"
8237        }
8238    }
8239
8240    pub fn skip_claude_onboarding() -> &'static str {
8241        if is_chinese() {
8242            "🚫 跳过 Claude Code 初次安装确认"
8243        } else {
8244            "🚫 Skip Claude Code onboarding confirmation"
8245        }
8246    }
8247
8248    pub fn skip_claude_onboarding_label() -> &'static str {
8249        if is_chinese() {
8250            "跳过 Claude Code 初次安装确认"
8251        } else {
8252            "Skip Claude Code onboarding confirmation"
8253        }
8254    }
8255
8256    pub fn skip_claude_onboarding_confirm(enable: bool, path: &str) -> String {
8257        if is_chinese() {
8258            if enable {
8259                format!(
8260                    "确认启用跳过 Claude Code 初次安装确认?\n将写入 {path}: hasCompletedOnboarding=true"
8261                )
8262            } else {
8263                format!(
8264                    "确认恢复 Claude Code 初次安装确认?\n将从 {path} 删除 hasCompletedOnboarding"
8265                )
8266            }
8267        } else {
8268            if enable {
8269                format!(
8270                    "Enable skipping Claude Code onboarding confirmation?\nWrites hasCompletedOnboarding=true to {path}"
8271                )
8272            } else {
8273                format!(
8274                    "Disable skipping Claude Code onboarding confirmation?\nRemoves hasCompletedOnboarding from {path}"
8275                )
8276            }
8277        }
8278    }
8279
8280    pub fn skip_claude_onboarding_changed(enable: bool) -> String {
8281        if is_chinese() {
8282            if enable {
8283                "✓ 已启用:跳过 Claude Code 初次安装确认".to_string()
8284            } else {
8285                "✓ 已恢复 Claude Code 初次安装确认".to_string()
8286            }
8287        } else {
8288            if enable {
8289                "✓ Skip Claude Code onboarding confirmation enabled".to_string()
8290            } else {
8291                "✓ Claude Code onboarding confirmation restored".to_string()
8292            }
8293        }
8294    }
8295
8296    pub fn enable_claude_plugin_integration() -> &'static str {
8297        if is_chinese() {
8298            "🔌 接管 Claude Code for VSCode 插件"
8299        } else {
8300            "🔌 Apply to Claude Code for VSCode"
8301        }
8302    }
8303
8304    pub fn enable_claude_plugin_integration_label() -> &'static str {
8305        if is_chinese() {
8306            "接管 Claude Code for VSCode 插件"
8307        } else {
8308            "Apply to Claude Code for VSCode"
8309        }
8310    }
8311
8312    pub fn enable_claude_plugin_integration_confirm(enable: bool, path: &str) -> String {
8313        if is_chinese() {
8314            if enable {
8315                format!(
8316                    "确认启用 Claude Code for VSCode 插件联动?\n将写入 {path}: primaryApiKey=\"any\""
8317                )
8318            } else {
8319                "确认关闭 Claude Code for VSCode 插件联动?".to_string()
8320            }
8321        } else {
8322            if enable {
8323                format!(
8324                    "Enable Claude Code for VSCode integration?\nWrites primaryApiKey=\"any\" to {path}"
8325                )
8326            } else {
8327                format!(
8328                    "Disable Claude Code for VSCode integration?\nRemoves primaryApiKey from {path}"
8329                )
8330            }
8331        }
8332    }
8333
8334    pub fn enable_claude_plugin_integration_changed(enable: bool) -> String {
8335        if is_chinese() {
8336            if enable {
8337                "✓ 已启用 Claude Code for VSCode 插件联动".to_string()
8338            } else {
8339                "✓ 已关闭 Claude Code for VSCode 插件联动".to_string()
8340            }
8341        } else {
8342            if enable {
8343                "✓ Claude Code for VSCode integration enabled".to_string()
8344            } else {
8345                "✓ Claude Code for VSCode integration disabled".to_string()
8346            }
8347        }
8348    }
8349
8350    pub fn claude_plugin_sync_failed_warning(err: &str) -> String {
8351        if is_chinese() {
8352            format!("⚠ Claude Code for VSCode 插件联动失败: {err}")
8353        } else {
8354            format!("⚠ Claude Code for VSCode integration failed: {err}")
8355        }
8356    }
8357
8358    // App Selection
8359    pub fn select_application() -> &'static str {
8360        if is_chinese() {
8361            "选择应用程序:"
8362        } else {
8363            "Select application:"
8364        }
8365    }
8366
8367    pub fn switched_to_app(app: &str) -> String {
8368        if is_chinese() {
8369            format!("✓ 已切换到 {}", app)
8370        } else {
8371            format!("✓ Switched to {}", app)
8372        }
8373    }
8374
8375    // Common
8376    pub fn press_enter() -> &'static str {
8377        if is_chinese() {
8378            "按 Enter 继续..."
8379        } else {
8380            "Press Enter to continue..."
8381        }
8382    }
8383
8384    pub fn error_prefix() -> &'static str {
8385        if is_chinese() {
8386            "错误"
8387        } else {
8388            "Error"
8389        }
8390    }
8391
8392    // Table Headers
8393    pub fn header_name() -> &'static str {
8394        if is_chinese() {
8395            "名称"
8396        } else {
8397            "Name"
8398        }
8399    }
8400
8401    pub fn header_category() -> &'static str {
8402        if is_chinese() {
8403            "类别"
8404        } else {
8405            "Category"
8406        }
8407    }
8408
8409    pub fn header_description() -> &'static str {
8410        if is_chinese() {
8411            "描述"
8412        } else {
8413            "Description"
8414        }
8415    }
8416
8417    // Config Management
8418    pub fn config_management() -> &'static str {
8419        if is_chinese() {
8420            "⚙️  配置文件管理"
8421        } else {
8422            "⚙️  Configuration Management"
8423        }
8424    }
8425
8426    pub fn config_export() -> &'static str {
8427        if is_chinese() {
8428            "📤 导出配置"
8429        } else {
8430            "📤 Export Config"
8431        }
8432    }
8433
8434    pub fn config_import() -> &'static str {
8435        if is_chinese() {
8436            "📥 导入配置"
8437        } else {
8438            "📥 Import Config"
8439        }
8440    }
8441
8442    pub fn config_backup() -> &'static str {
8443        if is_chinese() {
8444            "💾 备份配置"
8445        } else {
8446            "💾 Backup Config"
8447        }
8448    }
8449
8450    pub fn config_restore() -> &'static str {
8451        if is_chinese() {
8452            "♻️  恢复配置"
8453        } else {
8454            "♻️  Restore Config"
8455        }
8456    }
8457
8458    pub fn config_validate() -> &'static str {
8459        if is_chinese() {
8460            "✓ 验证配置"
8461        } else {
8462            "✓ Validate Config"
8463        }
8464    }
8465
8466    pub fn config_common_snippet() -> &'static str {
8467        if is_chinese() {
8468            "🧩 通用配置片段"
8469        } else {
8470            "🧩 Common Config Snippet"
8471        }
8472    }
8473
8474    pub fn config_common_snippet_title() -> &'static str {
8475        if is_chinese() {
8476            "通用配置片段"
8477        } else {
8478            "Common Config Snippet"
8479        }
8480    }
8481
8482    pub fn config_common_snippet_none_set() -> &'static str {
8483        if is_chinese() {
8484            "未设置通用配置片段。"
8485        } else {
8486            "No common config snippet is set."
8487        }
8488    }
8489
8490    pub fn config_common_snippet_set_for_app(app: &str) -> String {
8491        if is_chinese() {
8492            format!("✓ 已为应用 '{}' 设置通用配置片段", app)
8493        } else {
8494            format!("✓ Common config snippet set for app '{}'", app)
8495        }
8496    }
8497
8498    pub fn config_common_snippet_require_json_or_file() -> &'static str {
8499        if is_chinese() {
8500            "请提供 --json 或 --file"
8501        } else {
8502            "Please provide --json or --file"
8503        }
8504    }
8505
8506    pub fn config_reset() -> &'static str {
8507        if is_chinese() {
8508            "🔄 重置配置"
8509        } else {
8510            "🔄 Reset Config"
8511        }
8512    }
8513
8514    pub fn config_show_full() -> &'static str {
8515        if is_chinese() {
8516            "👁️  查看完整配置"
8517        } else {
8518            "👁️  Show Full Config"
8519        }
8520    }
8521
8522    pub fn config_show_path() -> &'static str {
8523        if is_chinese() {
8524            "📍 显示配置路径"
8525        } else {
8526            "📍 Show Config Path"
8527        }
8528    }
8529
8530    pub fn enter_export_path() -> &'static str {
8531        if is_chinese() {
8532            "输入导出文件路径:"
8533        } else {
8534            "Enter export file path:"
8535        }
8536    }
8537
8538    pub fn enter_import_path() -> &'static str {
8539        if is_chinese() {
8540            "输入导入文件路径:"
8541        } else {
8542            "Enter import file path:"
8543        }
8544    }
8545
8546    pub fn enter_restore_path() -> &'static str {
8547        if is_chinese() {
8548            "输入备份文件路径:"
8549        } else {
8550            "Enter backup file path:"
8551        }
8552    }
8553
8554    pub fn confirm_import() -> &'static str {
8555        if is_chinese() {
8556            "确定要导入配置吗?这将覆盖当前配置。"
8557        } else {
8558            "Are you sure you want to import? This will overwrite current configuration."
8559        }
8560    }
8561
8562    pub fn confirm_reset() -> &'static str {
8563        if is_chinese() {
8564            "确定要重置配置吗?这将删除所有自定义设置。"
8565        } else {
8566            "Are you sure you want to reset? This will delete all custom settings."
8567        }
8568    }
8569
8570    pub fn common_config_snippet_editor_prompt(app: &str) -> String {
8571        let is_codex = app == "codex";
8572        if is_chinese() {
8573            if is_codex {
8574                format!("编辑 {app} 的通用配置片段(TOML,留空则清除):")
8575            } else {
8576                format!("编辑 {app} 的通用配置片段(JSON 对象,留空则清除):")
8577            }
8578        } else {
8579            if is_codex {
8580                format!("Edit common config snippet for {app} (TOML; empty to clear):")
8581            } else {
8582                format!("Edit common config snippet for {app} (JSON object; empty to clear):")
8583            }
8584        }
8585    }
8586
8587    pub fn common_config_snippet_invalid_json(err: &str) -> String {
8588        if is_chinese() {
8589            format!("JSON 无效:{err}")
8590        } else {
8591            format!("Invalid JSON: {err}")
8592        }
8593    }
8594
8595    pub fn common_config_snippet_invalid_toml(err: &str) -> String {
8596        if is_chinese() {
8597            format!("TOML 无效:{err}")
8598        } else {
8599            format!("Invalid TOML: {err}")
8600        }
8601    }
8602
8603    pub fn failed_to_serialize_json(err: &str) -> String {
8604        if is_chinese() {
8605            format!("序列化 JSON 失败:{err}")
8606        } else {
8607            format!("Failed to serialize JSON: {err}")
8608        }
8609    }
8610
8611    pub fn common_config_snippet_not_object() -> &'static str {
8612        if is_chinese() {
8613            "通用配置必须是 JSON 对象(例如:{\"env\":{...}})"
8614        } else {
8615            "Common config must be a JSON object (e.g. {\"env\":{...}})"
8616        }
8617    }
8618
8619    pub fn common_config_snippet_saved() -> &'static str {
8620        if is_chinese() {
8621            "✓ 已保存通用配置片段"
8622        } else {
8623            "✓ Common config snippet saved"
8624        }
8625    }
8626
8627    pub fn common_config_snippet_cleared() -> &'static str {
8628        if is_chinese() {
8629            "✓ 已清除通用配置片段"
8630        } else {
8631            "✓ Common config snippet cleared"
8632        }
8633    }
8634
8635    pub fn common_config_snippet_apply_now() -> &'static str {
8636        if is_chinese() {
8637            "现在应用到当前供应商(写入 live 配置)?"
8638        } else {
8639            "Apply to current provider now (write live config)?"
8640        }
8641    }
8642
8643    pub fn common_config_snippet_no_current_provider() -> &'static str {
8644        if is_chinese() {
8645            "当前未选择供应商,已保存通用配置片段。"
8646        } else {
8647            "No current provider selected; common config snippet saved."
8648        }
8649    }
8650
8651    pub fn common_config_snippet_no_current_provider_after_clear() -> &'static str {
8652        if is_chinese() {
8653            "当前未选择供应商,已清除通用配置片段。"
8654        } else {
8655            "No current provider selected; common config snippet cleared."
8656        }
8657    }
8658
8659    pub fn common_config_snippet_applied() -> &'static str {
8660        if is_chinese() {
8661            "✓ 已在适用时刷新 live 配置(请重启对应客户端)"
8662        } else {
8663            "✓ Refreshed live config when applicable (restart the client)"
8664        }
8665    }
8666
8667    pub fn common_config_snippet_apply_hint() -> &'static str {
8668        if is_chinese() {
8669            "提示:切换一次供应商即可重新写入 live 配置。"
8670        } else {
8671            "Tip: switch provider once to re-write the live config."
8672        }
8673    }
8674
8675    pub fn common_config_snippet_apply_not_needed() -> &'static str {
8676        if is_chinese() {
8677            "当前配置已是最新,无需重新应用。"
8678        } else {
8679            "The current live config is already up to date; nothing to apply."
8680        }
8681    }
8682
8683    pub fn confirm_restore() -> &'static str {
8684        if is_chinese() {
8685            "确定要从备份恢复配置吗?"
8686        } else {
8687            "Are you sure you want to restore from backup?"
8688        }
8689    }
8690
8691    pub fn exported_to(path: &str) -> String {
8692        if is_chinese() {
8693            format!("✓ 已导出到 '{}'", path)
8694        } else {
8695            format!("✓ Exported to '{}'", path)
8696        }
8697    }
8698
8699    pub fn imported_from(path: &str) -> String {
8700        if is_chinese() {
8701            format!("✓ 已从 '{}' 导入", path)
8702        } else {
8703            format!("✓ Imported from '{}'", path)
8704        }
8705    }
8706
8707    pub fn backup_created(id: &str) -> String {
8708        if is_chinese() {
8709            format!("✓ 已创建备份,ID: {}", id)
8710        } else {
8711            format!("✓ Backup created, ID: {}", id)
8712        }
8713    }
8714
8715    pub fn restored_from(path: &str) -> String {
8716        if is_chinese() {
8717            format!("✓ 已从 '{}' 恢复", path)
8718        } else {
8719            format!("✓ Restored from '{}'", path)
8720        }
8721    }
8722
8723    pub fn config_valid() -> &'static str {
8724        if is_chinese() {
8725            "✓ 配置文件有效"
8726        } else {
8727            "✓ Configuration is valid"
8728        }
8729    }
8730
8731    pub fn config_reset_done() -> &'static str {
8732        if is_chinese() {
8733            "✓ 配置已重置为默认值"
8734        } else {
8735            "✓ Configuration reset to defaults"
8736        }
8737    }
8738
8739    pub fn file_overwrite_confirm(path: &str) -> String {
8740        if is_chinese() {
8741            format!("文件 '{}' 已存在,是否覆盖?", path)
8742        } else {
8743            format!("File '{}' exists. Overwrite?", path)
8744        }
8745    }
8746
8747    // MCP Management Additional
8748    pub fn mcp_delete_server() -> &'static str {
8749        if is_chinese() {
8750            "🗑️  删除服务器"
8751        } else {
8752            "🗑️  Delete Server"
8753        }
8754    }
8755
8756    pub fn mcp_enable_server() -> &'static str {
8757        if is_chinese() {
8758            "✅ 启用服务器"
8759        } else {
8760            "✅ Enable Server"
8761        }
8762    }
8763
8764    pub fn mcp_disable_server() -> &'static str {
8765        if is_chinese() {
8766            "❌ 禁用服务器"
8767        } else {
8768            "❌ Disable Server"
8769        }
8770    }
8771
8772    pub fn mcp_import_servers() -> &'static str {
8773        if is_chinese() {
8774            "📥 导入已有 MCP 服务器"
8775        } else {
8776            "📥 Import Existing MCP Servers"
8777        }
8778    }
8779
8780    pub fn mcp_validate_command() -> &'static str {
8781        if is_chinese() {
8782            "✓ 验证命令"
8783        } else {
8784            "✓ Validate Command"
8785        }
8786    }
8787
8788    pub fn select_server_to_delete() -> &'static str {
8789        if is_chinese() {
8790            "选择要删除的服务器:"
8791        } else {
8792            "Select server to delete:"
8793        }
8794    }
8795
8796    pub fn select_server_to_enable() -> &'static str {
8797        if is_chinese() {
8798            "选择要启用的服务器:"
8799        } else {
8800            "Select server to enable:"
8801        }
8802    }
8803
8804    pub fn select_server_to_disable() -> &'static str {
8805        if is_chinese() {
8806            "选择要禁用的服务器:"
8807        } else {
8808            "Select server to disable:"
8809        }
8810    }
8811
8812    pub fn select_apps_to_enable() -> &'static str {
8813        if is_chinese() {
8814            "选择要启用的应用:"
8815        } else {
8816            "Select apps to enable for:"
8817        }
8818    }
8819
8820    pub fn select_apps_to_disable() -> &'static str {
8821        if is_chinese() {
8822            "选择要禁用的应用:"
8823        } else {
8824            "Select apps to disable for:"
8825        }
8826    }
8827
8828    pub fn enter_command_to_validate() -> &'static str {
8829        if is_chinese() {
8830            "输入要验证的命令:"
8831        } else {
8832            "Enter command to validate:"
8833        }
8834    }
8835
8836    pub fn server_deleted(id: &str) -> String {
8837        if is_chinese() {
8838            format!("✓ 已删除服务器 '{}'", id)
8839        } else {
8840            format!("✓ Deleted server '{}'", id)
8841        }
8842    }
8843
8844    pub fn server_enabled(id: &str) -> String {
8845        if is_chinese() {
8846            format!("✓ 已启用服务器 '{}'", id)
8847        } else {
8848            format!("✓ Enabled server '{}'", id)
8849        }
8850    }
8851
8852    pub fn server_disabled(id: &str) -> String {
8853        if is_chinese() {
8854            format!("✓ 已禁用服务器 '{}'", id)
8855        } else {
8856            format!("✓ Disabled server '{}'", id)
8857        }
8858    }
8859
8860    pub fn servers_imported(count: usize) -> String {
8861        if is_chinese() {
8862            format!("✓ 已导入 {count} 个 MCP 服务器")
8863        } else {
8864            format!("✓ Imported {count} MCP server(s)")
8865        }
8866    }
8867
8868    pub fn command_valid(cmd: &str) -> String {
8869        if is_chinese() {
8870            format!("✓ 命令 '{}' 有效", cmd)
8871        } else {
8872            format!("✓ Command '{}' is valid", cmd)
8873        }
8874    }
8875
8876    pub fn command_invalid(cmd: &str) -> String {
8877        if is_chinese() {
8878            format!("✗ 命令 '{}' 未找到", cmd)
8879        } else {
8880            format!("✗ Command '{}' not found", cmd)
8881        }
8882    }
8883
8884    // Prompts Management Additional
8885    pub fn prompts_show_content() -> &'static str {
8886        if is_chinese() {
8887            "👁️  查看完整内容"
8888        } else {
8889            "👁️  View Full Content"
8890        }
8891    }
8892
8893    pub fn prompts_delete() -> &'static str {
8894        if is_chinese() {
8895            "🗑️  删除提示词"
8896        } else {
8897            "🗑️  Delete Prompt"
8898        }
8899    }
8900
8901    pub fn prompts_view_current() -> &'static str {
8902        if is_chinese() {
8903            "📋 查看当前提示词"
8904        } else {
8905            "📋 View Current Prompt"
8906        }
8907    }
8908
8909    pub fn select_prompt_to_view() -> &'static str {
8910        if is_chinese() {
8911            "选择要查看的提示词:"
8912        } else {
8913            "Select prompt to view:"
8914        }
8915    }
8916
8917    pub fn select_prompt_to_delete() -> &'static str {
8918        if is_chinese() {
8919            "选择要删除的提示词:"
8920        } else {
8921            "Select prompt to delete:"
8922        }
8923    }
8924
8925    pub fn prompt_deleted(id: &str) -> String {
8926        if is_chinese() {
8927            format!("✓ 已删除提示词 '{}'", id)
8928        } else {
8929            format!("✓ Deleted prompt '{}'", id)
8930        }
8931    }
8932
8933    pub fn no_active_prompt() -> &'static str {
8934        if is_chinese() {
8935            "当前没有激活的提示词。"
8936        } else {
8937            "No active prompt."
8938        }
8939    }
8940
8941    pub fn cannot_delete_active() -> &'static str {
8942        if is_chinese() {
8943            "无法删除当前激活的提示词。"
8944        } else {
8945            "Cannot delete the active prompt."
8946        }
8947    }
8948
8949    pub fn no_servers_to_delete() -> &'static str {
8950        if is_chinese() {
8951            "没有可删除的服务器。"
8952        } else {
8953            "No servers to delete."
8954        }
8955    }
8956
8957    pub fn no_prompts_to_delete() -> &'static str {
8958        if is_chinese() {
8959            "没有可删除的提示词。"
8960        } else {
8961            "No prompts to delete."
8962        }
8963    }
8964
8965    // Provider Speedtest
8966    pub fn speedtest_endpoint() -> &'static str {
8967        if is_chinese() {
8968            "🚀 测试端点速度"
8969        } else {
8970            "🚀 Speedtest endpoint"
8971        }
8972    }
8973
8974    pub fn back() -> &'static str {
8975        if is_chinese() {
8976            "← 返回"
8977        } else {
8978            "← Back"
8979        }
8980    }
8981
8982    // ============================================
8983    // TUI UPDATE (TUI 自更新)
8984    // ============================================
8985
8986    pub fn tui_settings_check_for_updates() -> &'static str {
8987        if is_chinese() {
8988            "检查更新"
8989        } else {
8990            "Check for Updates"
8991        }
8992    }
8993
8994    pub fn tui_update_checking_title() -> &'static str {
8995        if is_chinese() {
8996            "检查更新中"
8997        } else {
8998            "Checking for Updates"
8999        }
9000    }
9001
9002    pub fn tui_update_available_title() -> &'static str {
9003        if is_chinese() {
9004            "发现新版本"
9005        } else {
9006            "Update Available"
9007        }
9008    }
9009
9010    pub fn tui_update_downloading_title() -> &'static str {
9011        if is_chinese() {
9012            "正在更新"
9013        } else {
9014            "Updating"
9015        }
9016    }
9017
9018    pub fn tui_update_result_title() -> &'static str {
9019        if is_chinese() {
9020            "更新结果"
9021        } else {
9022            "Update Result"
9023        }
9024    }
9025
9026    pub fn tui_update_version_info(current: &str, new: &str) -> String {
9027        if is_chinese() {
9028            format!("当前: v{current}  →  最新: {new}")
9029        } else {
9030            format!("Current: v{current}  →  Latest: {new}")
9031        }
9032    }
9033
9034    pub fn tui_update_btn_update() -> &'static str {
9035        if is_chinese() {
9036            "更新"
9037        } else {
9038            "Update"
9039        }
9040    }
9041
9042    pub fn tui_update_btn_cancel() -> &'static str {
9043        if is_chinese() {
9044            "取消"
9045        } else {
9046            "Cancel"
9047        }
9048    }
9049
9050    pub fn tui_update_downloading_kb(kb: u64) -> String {
9051        if is_chinese() {
9052            format!("已下载 {kb} KB")
9053        } else {
9054            format!("Downloaded {kb} KB")
9055        }
9056    }
9057
9058    pub fn tui_update_downloading_progress(pct: u64, downloaded_kb: u64, total_kb: u64) -> String {
9059        if is_chinese() {
9060            format!("{pct}%  ({downloaded_kb} / {total_kb} KB)")
9061        } else {
9062            format!("{pct}%  ({downloaded_kb} / {total_kb} KB)")
9063        }
9064    }
9065
9066    pub fn tui_update_success(tag: &str) -> String {
9067        if is_chinese() {
9068            format!("已更新到 {tag},按 Enter 退出")
9069        } else {
9070            format!("Updated to {tag}. Press Enter to exit.")
9071        }
9072    }
9073
9074    pub fn tui_update_err_worker_unavailable() -> &'static str {
9075        if is_chinese() {
9076            "更新服务不可用"
9077        } else {
9078            "Update worker unavailable"
9079        }
9080    }
9081
9082    pub fn tui_update_err_check_first() -> &'static str {
9083        if is_chinese() {
9084            "请先检查更新"
9085        } else {
9086            "Please check for updates first"
9087        }
9088    }
9089
9090    pub fn tui_toast_already_latest(v: &str) -> String {
9091        if is_chinese() {
9092            format!("已是最新版本 v{v}")
9093        } else {
9094            format!("Already on latest v{v}")
9095        }
9096    }
9097
9098    pub fn tui_toast_update_downgrade(current: &str, target: &str) -> String {
9099        if is_chinese() {
9100            format!("当前 v{current} 比 {target} 更新")
9101        } else {
9102            format!("Current v{current} is newer than {target}")
9103        }
9104    }
9105
9106    pub fn tui_toast_update_check_failed(err: &str) -> String {
9107        if is_chinese() {
9108            format!("检查更新失败: {err}")
9109        } else {
9110            format!("Update check failed: {err}")
9111        }
9112    }
9113
9114    pub fn tui_key_hide() -> &'static str {
9115        if is_chinese() {
9116            "隐藏"
9117        } else {
9118            "hide"
9119        }
9120    }
9121
9122    pub fn tui_toast_update_bg_success(tag: &str) -> String {
9123        if is_chinese() {
9124            format!("后台更新到 {tag} 完成")
9125        } else {
9126            format!("Background update to {tag} complete")
9127        }
9128    }
9129
9130    pub fn tui_toast_update_bg_failed(err: &str) -> String {
9131        if is_chinese() {
9132            format!("后台更新失败: {err}")
9133        } else {
9134            format!("Background update failed: {err}")
9135        }
9136    }
9137
9138    pub fn tui_toast_provider_live_config_imported() -> &'static str {
9139        if is_chinese() {
9140            "已将当前 live 配置导入为供应商"
9141        } else {
9142            "Imported the current live config as a provider"
9143        }
9144    }
9145
9146    pub fn tui_toast_codex_live_config_imported() -> &'static str {
9147        if is_chinese() {
9148            "已将当前 Codex live 配置导入为供应商"
9149        } else {
9150            "Imported the current Codex live config as a provider"
9151        }
9152    }
9153
9154    pub fn tui_toast_no_live_config_imported() -> &'static str {
9155        if is_chinese() {
9156            "没有可导入的 live 供应商"
9157        } else {
9158            "No live providers were imported"
9159        }
9160    }
9161}
9162
9163#[cfg(test)]
9164mod tests {
9165    use super::{texts, use_test_language, Language};
9166    use std::sync::mpsc;
9167    use std::thread;
9168
9169    #[test]
9170    fn website_url_label_keeps_optional_with_abbrev() {
9171        let label = texts::website_url_label();
9172        assert_eq!(label, "Website URL (opt.):");
9173        assert!(label.contains("(opt.)"));
9174        assert!(!label.contains("(optional)"));
9175    }
9176
9177    #[test]
9178    fn chinese_tui_copy_avoids_key_mixed_english_labels() {
9179        let _lang = use_test_language(Language::Chinese);
9180
9181        assert_eq!(texts::tui_home_section_connection(), "连接信息");
9182        assert_eq!(texts::tui_home_status_online(), "在线");
9183        assert_eq!(texts::tui_home_status_offline(), "离线");
9184        assert_eq!(texts::tui_label_mcp_servers_active(), "已启用");
9185        assert_eq!(texts::skills_management(), "技能管理");
9186        assert_eq!(texts::menu_manage_mcp(), "🔌 MCP 服务器");
9187
9188        let help = texts::tui_help_text();
9189        assert!(help.contains("文本输入:Ctrl+A/E 行首/行尾"));
9190        assert!(help.contains("供应商:Enter 详情"));
9191        assert!(help.contains("供应商详情:Space 切换"));
9192        assert!(help.contains("提示词:c 新建,r 刷新,Enter 查看"));
9193        assert!(help.contains("技能:Enter 详情"));
9194        assert!(help.contains("配置:Enter 打开/执行"));
9195        assert!(help.contains("设置:Enter 应用"));
9196        assert!(!help.contains("Text input:"));
9197        assert!(!help.contains("Providers:"));
9198        assert!(!help.contains("Provider Detail:"));
9199        assert!(!help.contains("Skills:"));
9200        assert!(!help.contains("Config:"));
9201        assert!(!help.contains("Settings:"));
9202    }
9203
9204    #[test]
9205    fn proxy_dashboard_copy_is_fully_localized_in_chinese() {
9206        let _lang = use_test_language(Language::Chinese);
9207
9208        assert_eq!(texts::tui_home_section_connection(), "连接信息");
9209        assert_eq!(
9210            texts::tui_proxy_dashboard_failover_copy(),
9211            "仅做手动路由,不会自动切换供应商。"
9212        );
9213        assert_eq!(
9214            texts::tui_proxy_dashboard_manual_routing_copy("Claude"),
9215            "手动路由:Claude 的流量会通过 cc-switch。"
9216        );
9217    }
9218
9219    #[test]
9220    fn openclaw_provider_status_copy_is_fully_localized_in_chinese() {
9221        let _lang = use_test_language(Language::Chinese);
9222
9223        assert_eq!(texts::tui_label_openclaw_status(), "状态");
9224        assert_eq!(texts::tui_label_openclaw_model(), "模型");
9225        assert_eq!(texts::tui_openclaw_status_default(), "默认");
9226        assert_eq!(
9227            texts::tui_openclaw_status_in_config_and_saved(),
9228            "配置中 + 已保存"
9229        );
9230        assert_eq!(texts::tui_openclaw_status_live_only(), "仅当前配置");
9231        assert_eq!(texts::tui_openclaw_status_saved_only(), "仅已保存");
9232        assert_eq!(texts::tui_openclaw_status_untracked(), "未跟踪");
9233    }
9234
9235    #[test]
9236    fn test_language_override_does_not_leak_across_threads() {
9237        let _lang = use_test_language(Language::English);
9238        let (ready_tx, ready_rx) = mpsc::channel();
9239        let (release_tx, release_rx) = mpsc::channel();
9240
9241        let handle = thread::spawn(move || {
9242            let _lang = use_test_language(Language::Chinese);
9243            ready_tx.send(()).expect("signal ready");
9244            release_rx.recv().expect("wait for release");
9245        });
9246
9247        ready_rx.recv().expect("wait for child language override");
9248
9249        assert_eq!(
9250            texts::tui_home_section_connection(),
9251            "Connection Details",
9252            "child thread language override should not affect this test thread"
9253        );
9254
9255        release_tx.send(()).expect("release child thread");
9256        handle.join().expect("join child thread");
9257    }
9258}