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