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