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