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