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