dsh-remote 0.8.91 → 0.8.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.en.md +369 -368
- package/README.md +354 -353
- package/cordis.patch.yml +9 -9
- package/lib/audit.js +45 -45
- package/lib/binding.js +172 -172
- package/lib/client.js +4647 -4550
- package/lib/credential.js +270 -263
- package/lib/errors.js +141 -141
- package/lib/exec-job.js +242 -242
- package/lib/file-reference.js +457 -457
- package/lib/forwards.js +258 -258
- package/lib/host-api.js +822 -822
- package/lib/hostkey.js +108 -108
- package/lib/http-transport.js +201 -201
- package/lib/ignore.js +202 -202
- package/lib/index.js +4488 -4394
- package/lib/instructions-dynamic.js +415 -415
- package/lib/instructions.js +288 -288
- package/lib/open-folder.js +56 -56
- package/lib/openssh.js +940 -881
- package/lib/paths.js +292 -292
- package/lib/pool.js +1029 -970
- package/lib/posix-shell.cjs +34 -0
- package/lib/registry.js +296 -296
- package/lib/remote-fs.js +173 -173
- package/lib/remote-sandbox.js +183 -183
- package/lib/remote-shell-child.cjs +397 -400
- package/lib/remote-shell.js +697 -697
- package/lib/remote-skills.js +312 -0
- package/lib/routes-audit.js +58 -58
- package/lib/routes-forwards.js +72 -72
- package/lib/routes-fs.js +251 -245
- package/lib/routes-machines.js +186 -186
- package/lib/routes-misc.js +187 -150
- package/lib/routes-term.js +169 -169
- package/lib/routes-update.js +143 -143
- package/lib/routes-web-attach.js +112 -112
- package/lib/routes-workspace.js +312 -312
- package/lib/search.js +235 -235
- package/lib/sftp-surface.js +119 -119
- package/lib/sshconfig.js +779 -779
- package/lib/sync.js +350 -350
- package/lib/tasks.js +95 -95
- package/lib/telemetry.js +247 -247
- package/lib/terminal.js +205 -205
- package/lib/tui/flow.js +130 -130
- package/lib/tui/format.js +380 -380
- package/lib/tui/i18n.js +350 -350
- package/lib/tui/index.js +531 -531
- package/lib/tui/provider.js +344 -344
- package/lib/tui/scene.js +986 -986
- package/lib/update.js +490 -472
- package/lib/web-attach.js +860 -850
- package/lib/workspace-cleanup.js +337 -337
- package/package.json +103 -100
- package/node_modules/buildcheck/.eslintrc.js +0 -5
- package/node_modules/buildcheck/.github/workflows/ci.yml +0 -88
- package/node_modules/buildcheck/.github/workflows/lint.yml +0 -27
- package/node_modules/buildcheck/.npmignore +0 -3
- package/node_modules/buildcheck/LICENSE +0 -19
- package/node_modules/buildcheck/README.md +0 -106
- package/node_modules/buildcheck/deps/Find-VisualStudio.cs +0 -250
- package/node_modules/buildcheck/lib/findvs.js +0 -361
- package/node_modules/buildcheck/lib/index.js +0 -738
- package/node_modules/buildcheck/package.json +0 -36
- package/node_modules/buildcheck/test/test.js +0 -8
- package/node_modules/cpu-features/.eslintrc.js +0 -5
- package/node_modules/cpu-features/.github/workflows/ci.yml +0 -74
- package/node_modules/cpu-features/.github/workflows/lint.yml +0 -27
- package/node_modules/cpu-features/LICENSE +0 -19
- package/node_modules/cpu-features/README.md +0 -59
- package/node_modules/cpu-features/binding.gyp +0 -16
- package/node_modules/cpu-features/buildcheck.js +0 -32
- package/node_modules/cpu-features/deps/cpu_features/.clang-format +0 -4
- package/node_modules/cpu-features/deps/cpu_features/.dockerignore +0 -31
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/Dockerfile +0 -5
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/aarch64_linux_cmake.yml +0 -30
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_freebsd_cmake.yml +0 -22
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_linux_bazel.yml +0 -26
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_linux_cmake.yml +0 -31
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_macos_cmake.yml +0 -43
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_windows_cmake.yml +0 -25
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/arm_linux_cmake.yml +0 -31
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/clang_format.yml +0 -24
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/mips_linux_cmake.yml +0 -30
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/power_linux_cmake.yml +0 -29
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/riscv_linux_cmake.yml +0 -28
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/s390x_linux_cmake.yml +0 -27
- package/node_modules/cpu-features/deps/cpu_features/.grenrc.yml +0 -21
- package/node_modules/cpu-features/deps/cpu_features/BUILD.bazel +0 -329
- package/node_modules/cpu-features/deps/cpu_features/CMakeLists.txt +0 -261
- package/node_modules/cpu-features/deps/cpu_features/CONTRIBUTING.md +0 -23
- package/node_modules/cpu-features/deps/cpu_features/LICENSE +0 -230
- package/node_modules/cpu-features/deps/cpu_features/README.md +0 -272
- package/node_modules/cpu-features/deps/cpu_features/WORKSPACE +0 -19
- package/node_modules/cpu-features/deps/cpu_features/bazel/ci/README.md +0 -5
- package/node_modules/cpu-features/deps/cpu_features/bazel/platforms.bzl +0 -11
- package/node_modules/cpu-features/deps/cpu_features/cmake/CpuFeaturesConfig.cmake.in +0 -3
- package/node_modules/cpu-features/deps/cpu_features/cmake/CpuFeaturesNdkCompatConfig.cmake.in +0 -3
- package/node_modules/cpu-features/deps/cpu_features/cmake/README.md +0 -30
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/Makefile +0 -252
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/README.md +0 -40
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/docker.dot +0 -64
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/docker.svg +0 -312
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/generate_image.sh +0 -7
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/docker/amd64/Dockerfile +0 -48
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/docker/toolchain/Dockerfile +0 -34
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/sample/CMakeLists.txt +0 -22
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/sample/main.cpp +0 -11
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/vagrant/freebsd/Vagrantfile +0 -107
- package/node_modules/cpu-features/deps/cpu_features/cmake/googletest.CMakeLists.txt.in +0 -15
- package/node_modules/cpu-features/deps/cpu_features/cpu_features.gyp +0 -105
- package/node_modules/cpu-features/deps/cpu_features/include/cpu_features_cache_info.h +0 -54
- package/node_modules/cpu-features/deps/cpu_features/include/cpu_features_macros.h +0 -384
- package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_aarch64.h +0 -259
- package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_arm.h +0 -121
- package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_mips.h +0 -74
- package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_ppc.h +0 -149
- package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_riscv.h +0 -72
- package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_s390x.h +0 -108
- package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_x86.h +0 -288
- package/node_modules/cpu-features/deps/cpu_features/include/internal/bit_utils.h +0 -40
- package/node_modules/cpu-features/deps/cpu_features/include/internal/cpuid_x86.h +0 -37
- package/node_modules/cpu-features/deps/cpu_features/include/internal/filesystem.h +0 -39
- package/node_modules/cpu-features/deps/cpu_features/include/internal/hwcaps.h +0 -240
- package/node_modules/cpu-features/deps/cpu_features/include/internal/stack_line_reader.h +0 -49
- package/node_modules/cpu-features/deps/cpu_features/include/internal/string_view.h +0 -110
- package/node_modules/cpu-features/deps/cpu_features/include/internal/windows_utils.h +0 -70
- package/node_modules/cpu-features/deps/cpu_features/ndk_compat/CMakeLists.txt +0 -60
- package/node_modules/cpu-features/deps/cpu_features/ndk_compat/README.md +0 -4
- package/node_modules/cpu-features/deps/cpu_features/ndk_compat/cpu-features.c +0 -205
- package/node_modules/cpu-features/deps/cpu_features/ndk_compat/cpu-features.h +0 -320
- package/node_modules/cpu-features/deps/cpu_features/ndk_compat/ndk-compat-test.c +0 -12
- package/node_modules/cpu-features/deps/cpu_features/patches/0001-Add-Apple-Silicon-Support.patch +0 -456
- package/node_modules/cpu-features/deps/cpu_features/scripts/generate_badges.d +0 -165
- package/node_modules/cpu-features/deps/cpu_features/scripts/make_release.sh +0 -75
- package/node_modules/cpu-features/deps/cpu_features/scripts/run_integration.sh +0 -490
- package/node_modules/cpu-features/deps/cpu_features/scripts/test_integration.sh +0 -79
- package/node_modules/cpu-features/deps/cpu_features/src/copy.inl +0 -19
- package/node_modules/cpu-features/deps/cpu_features/src/define_introspection.inl +0 -86
- package/node_modules/cpu-features/deps/cpu_features/src/define_introspection_and_hwcaps.inl +0 -26
- package/node_modules/cpu-features/deps/cpu_features/src/equals.inl +0 -22
- package/node_modules/cpu-features/deps/cpu_features/src/filesystem.c +0 -62
- package/node_modules/cpu-features/deps/cpu_features/src/hwcaps.c +0 -169
- package/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64__base_implementation.inl +0 -88
- package/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_linux_or_android.c +0 -79
- package/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_macos_or_iphone.c +0 -82
- package/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_windows.c +0 -138
- package/node_modules/cpu-features/deps/cpu_features/src/impl_arm_linux_or_android.c +0 -212
- package/node_modules/cpu-features/deps/cpu_features/src/impl_mips_linux_or_android.c +0 -93
- package/node_modules/cpu-features/deps/cpu_features/src/impl_ppc_linux.c +0 -163
- package/node_modules/cpu-features/deps/cpu_features/src/impl_riscv_linux.c +0 -111
- package/node_modules/cpu-features/deps/cpu_features/src/impl_s390x_linux.c +0 -120
- package/node_modules/cpu-features/deps/cpu_features/src/impl_x86__base_implementation.inl +0 -2055
- package/node_modules/cpu-features/deps/cpu_features/src/impl_x86_freebsd.c +0 -68
- package/node_modules/cpu-features/deps/cpu_features/src/impl_x86_linux_or_android.c +0 -58
- package/node_modules/cpu-features/deps/cpu_features/src/impl_x86_macos.c +0 -57
- package/node_modules/cpu-features/deps/cpu_features/src/impl_x86_windows.c +0 -58
- package/node_modules/cpu-features/deps/cpu_features/src/stack_line_reader.c +0 -132
- package/node_modules/cpu-features/deps/cpu_features/src/string_view.c +0 -192
- package/node_modules/cpu-features/deps/cpu_features/src/utils/list_cpu_features.c +0 -461
- package/node_modules/cpu-features/deps/cpu_features/test/CMakeLists.txt +0 -114
- package/node_modules/cpu-features/deps/cpu_features/test/bit_utils_test.cc +0 -53
- package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_aarch64_test.cc +0 -396
- package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_arm_test.cc +0 -384
- package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_mips_test.cc +0 -176
- package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_ppc_test.cc +0 -131
- package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_riscv_test.cc +0 -180
- package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_s390x_test.cc +0 -82
- package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_x86_test.cc +0 -1729
- package/node_modules/cpu-features/deps/cpu_features/test/filesystem_for_testing.cc +0 -103
- package/node_modules/cpu-features/deps/cpu_features/test/filesystem_for_testing.h +0 -61
- package/node_modules/cpu-features/deps/cpu_features/test/hwcaps_for_testing.cc +0 -52
- package/node_modules/cpu-features/deps/cpu_features/test/hwcaps_for_testing.h +0 -31
- package/node_modules/cpu-features/deps/cpu_features/test/stack_line_reader_test.cc +0 -132
- package/node_modules/cpu-features/deps/cpu_features/test/string_view_test.cc +0 -202
- package/node_modules/cpu-features/lib/index.js +0 -5
- package/node_modules/cpu-features/package.json +0 -40
- package/node_modules/cpu-features/src/binding.cc +0 -151
- package/node_modules/cpu-features/test/test.js +0 -12
package/lib/tui/i18n.js
CHANGED
|
@@ -1,350 +1,350 @@
|
|
|
1
|
-
// dsh-remote TUI 文案表(中 / 英)。
|
|
2
|
-
//
|
|
3
|
-
// TUI 侧所有用户可见字符串都从这里取:场景、对话框降级流程、命令描述、页脚
|
|
4
|
-
// 校验错误。默认中文;只有显式传了英文 lang 或环境变量 `DSH_TUI_LANG=en`
|
|
5
|
-
// 时才用英文(与 dsh-tui 自身的语言开关保持同一习惯)。
|
|
6
|
-
//
|
|
7
|
-
// 约束:zh / en 两个字典必须**键集完全一致**(tui-format.test.js 会断言),
|
|
8
|
-
// 否则漏翻的一侧会静默回落到 key 本身。
|
|
9
|
-
|
|
10
|
-
const DICT = {
|
|
11
|
-
zh: {
|
|
12
|
-
// ── 通用 / 命令 ────────────────────────────────────────────────────────
|
|
13
|
-
title: 'dsh-remote · 远程服务器',
|
|
14
|
-
'cmd.description': '打开 dsh-remote 远程服务器管理页(远程工作区)',
|
|
15
|
-
'cmd.unavailable': '当前 profile 没有可用的 TUI 界面',
|
|
16
|
-
'cmd.failed': 'dsh-remote 打开失败:{err}',
|
|
17
|
-
'status.loading': '…',
|
|
18
|
-
'status.none': '未连接远程机',
|
|
19
|
-
'status.connected': '已连接 {target}',
|
|
20
|
-
'status.disconnected': '未连接 · {target}',
|
|
21
|
-
'status.detailMachine': '远程机 {name}',
|
|
22
|
-
'status.detailTarget': '{user}@{host}:{port}',
|
|
23
|
-
'status.detailRemote': '远端 {path}',
|
|
24
|
-
|
|
25
|
-
// ── 机器列表 ──────────────────────────────────────────────────────────
|
|
26
|
-
'list.hints': '↑↓ 选择 · Enter 动作 · a 新增 · c 连接 · t 探测 · b 浏览 · o 镜像 · e 编辑 · d 删除 · ←/Esc 关闭',
|
|
27
|
-
'list.empty': '还没有保存的远程机 —— 按 a 添加一台',
|
|
28
|
-
'list.count': '{count} 台机器',
|
|
29
|
-
'list.current': '当前',
|
|
30
|
-
'list.loading': '… 正在读取机器列表',
|
|
31
|
-
|
|
32
|
-
// ── 动作菜单 ──────────────────────────────────────────────────────────
|
|
33
|
-
'menu.title': '动作 · {name}',
|
|
34
|
-
'menu.connect': '连接',
|
|
35
|
-
'menu.workspaces': '工作区管理(删除/清理)',
|
|
36
|
-
'menu.edit': '编辑',
|
|
37
|
-
'menu.delete': '删除',
|
|
38
|
-
'menu.probe': '探测连接',
|
|
39
|
-
'menu.browse': '浏览远程目录',
|
|
40
|
-
'menu.hints': '↑↓ 选择 · →/Enter 执行 · ←/Esc 返回',
|
|
41
|
-
|
|
42
|
-
// ── 表单 ──────────────────────────────────────────────────────────────
|
|
43
|
-
'form.titleNew': '新增远程机',
|
|
44
|
-
'form.titleEdit': '编辑远程机 · {name}',
|
|
45
|
-
'form.name': '名称',
|
|
46
|
-
'form.host': '主机 / 别名',
|
|
47
|
-
'form.useSshConfig': '使用 ~/.ssh/config 别名',
|
|
48
|
-
'form.port': '端口',
|
|
49
|
-
'form.username': '用户名',
|
|
50
|
-
'form.auth': '认证方式',
|
|
51
|
-
'form.password': '密码',
|
|
52
|
-
'form.privateKeyPath': '私钥路径',
|
|
53
|
-
'form.passphrase': '私钥口令',
|
|
54
|
-
'form.group': '分组',
|
|
55
|
-
'form.passwordUnchanged': '(留空表示不修改)',
|
|
56
|
-
'form.passwordPlaceholder': '(不保存密码)',
|
|
57
|
-
'form.passphrasePlaceholder': '(无口令)',
|
|
58
|
-
'form.hints': 'Tab/↓ 下一项 · Shift+Tab/↑ 上一项 · Space/←→ 切换 · Enter 保存 · Esc 取消',
|
|
59
|
-
'form.required': '必填',
|
|
60
|
-
'form.optional': '可选',
|
|
61
|
-
'form.errHostRequired': '主机不能为空',
|
|
62
|
-
'form.errHostInvalid': '主机格式不正确(不要包含空格、/ 或 @)',
|
|
63
|
-
'form.errAliasInvalid': '~/.ssh/config 别名格式不正确',
|
|
64
|
-
'form.errPortRange': '端口必须是 1-65535 的整数',
|
|
65
|
-
'form.errAuth': '认证方式无效',
|
|
66
|
-
'form.errKeyPath': '私钥认证需要填写私钥路径',
|
|
67
|
-
|
|
68
|
-
// ── 认证方式 ──────────────────────────────────────────────────────────
|
|
69
|
-
'auth.password': '密码',
|
|
70
|
-
'auth.key': '私钥',
|
|
71
|
-
'auth.agent': 'SSH Agent',
|
|
72
|
-
|
|
73
|
-
// ── 删除确认 ──────────────────────────────────────────────────────────
|
|
74
|
-
'confirm.deleteTitle': '删除远程机',
|
|
75
|
-
'confirm.delete': '确定删除「{name}」?只删除本机保存的记录,不会改动远程文件。',
|
|
76
|
-
'confirm.hints': 'y / → / Enter 确认 · n / ← / Esc 取消',
|
|
77
|
-
|
|
78
|
-
// ── 远程目录浏览 ──────────────────────────────────────────────────────
|
|
79
|
-
'browse.title': '远程目录 · {path}',
|
|
80
|
-
'browse.loading': '… 正在读取目录',
|
|
81
|
-
'browse.empty': '(空目录)',
|
|
82
|
-
'browse.hints': '↑↓ 选择 · →/Enter 进入 · ←/Backspace 上级 · w 设为工作区 · Esc 返回',
|
|
83
|
-
'browse.noSelection': '没有可进入的子目录',
|
|
84
|
-
|
|
85
|
-
// ── 远程工作区清理 ────────────────────────────────────────────────────
|
|
86
|
-
'ws.title': '工作区 · {name}',
|
|
87
|
-
'ws.hints': '↑↓ 选择 · d 删除工作区(含镜像/对话)· x 仅删除对话 · r 移出最近列表 · ←/Esc 返回',
|
|
88
|
-
'ws.empty': '这台机器还没有本地镜像工作区',
|
|
89
|
-
'ws.sessions': '{n} 个对话',
|
|
90
|
-
'ws.live': '{n} 个使用中',
|
|
91
|
-
'ws.size': '镜像 {size}',
|
|
92
|
-
'ws.registered': '已登记',
|
|
93
|
-
'ws.recent': '最近',
|
|
94
|
-
'ws.confirmTitleDelete': '删除工作区「{name}」?',
|
|
95
|
-
'ws.confirmDelete': '将删除本地镜像目录、工作区登记和 {n} 个对话,并从最近列表移除该远端路径;不可恢复。',
|
|
96
|
-
'ws.confirmTitleSessions': '删除「{name}」下的对话?',
|
|
97
|
-
'ws.confirmSessions': '将删除 {n} 个对话,保留本地镜像目录与工作区登记;不可恢复。',
|
|
98
|
-
'ws.confirmTitleRecent': '从最近列表移除「{name}」?',
|
|
99
|
-
'ws.confirmRecent': '只从每台机器的「最近工作区」移除该远端路径(重启后不会再自动重建),本地镜像与台账保留。',
|
|
100
|
-
'ws.confirmHints': 'y / → / Enter 确认 · n / ← / Esc 取消',
|
|
101
|
-
'ws.busyDelete': '正在删除工作区',
|
|
102
|
-
'ws.busySessions': '正在删除对话',
|
|
103
|
-
'ws.busyRecent': '正在移出最近列表',
|
|
104
|
-
'ws.deleted': '已删除工作区 {name}:{sessions} 个对话 + 本地镜像 + 登记',
|
|
105
|
-
'ws.sessionsDeleted': '已删除 {n} 个对话(本地镜像保留)',
|
|
106
|
-
'ws.sessionsPartial': '已删除 {n} 个对话;{live} 个正在使用,已跳过',
|
|
107
|
-
'ws.recentForgotten': '已移出最近列表:{name}',
|
|
108
|
-
'ws.busyError': '还有 {n} 个会话正在使用该工作区,请先停止它们',
|
|
109
|
-
'ws.noApi': '当前 dshRemote 不支持工作区清理(插件版本过旧)',
|
|
110
|
-
|
|
111
|
-
// ── 加载态 / 页脚 ─────────────────────────────────────────────────────
|
|
112
|
-
'busy.line': '… {what}',
|
|
113
|
-
'busy.connecting': '正在连接',
|
|
114
|
-
'busy.probing': '正在探测',
|
|
115
|
-
'busy.listing': '正在读取目录',
|
|
116
|
-
'busy.saving': '正在保存',
|
|
117
|
-
'busy.deleting': '正在删除',
|
|
118
|
-
'busy.settingWorkspace': '正在建立工作区',
|
|
119
|
-
'busy.revealFolder': '正在打开镜像文件夹',
|
|
120
|
-
'busy.loading': '正在加载',
|
|
121
|
-
'busy.loadingMirrors': '正在读取本地镜像工作区',
|
|
122
|
-
'footer.error': '错误:{err}',
|
|
123
|
-
'error.generic': '操作失败',
|
|
124
|
-
'error.noApi': '宿主 API 不可用',
|
|
125
|
-
'error.badWorkspace': '无法构造工作区目标(本地镜像缺失)',
|
|
126
|
-
|
|
127
|
-
// ── toast / notify ────────────────────────────────────────────────────
|
|
128
|
-
'notify.connected': '已连接 {target}',
|
|
129
|
-
'notify.probeOk': '连接正常 · {target} · {latency} ms',
|
|
130
|
-
'notify.probeFailed': '探测失败:{err}',
|
|
131
|
-
'notify.saved': '已保存 {name}',
|
|
132
|
-
'notify.deleted': '已删除 {name}',
|
|
133
|
-
'notify.revealed': '已在文件管理器中打开 {path}',
|
|
134
|
-
'notify.workspaceSet': '已采用工作区 {label}',
|
|
135
|
-
'notify.switchRefused': '宿主拒绝切换到 {label}',
|
|
136
|
-
'notify.switchFailed': '切换工作区失败:{err}',
|
|
137
|
-
'notify.pickFailed': '无法采用该目录:{err}',
|
|
138
|
-
'notify.warnings': '警告:{text}',
|
|
139
|
-
|
|
140
|
-
// ── 无场景时的对话框降级流程 ──────────────────────────────────────────
|
|
141
|
-
'flow.add': '+ 新增远程机',
|
|
142
|
-
'flow.addDescription': '输入主机、端口和用户名',
|
|
143
|
-
'flow.selectTitle': '选择远程机',
|
|
144
|
-
'flow.machineOption': '{name} · {target}',
|
|
145
|
-
'flow.connectTitle': '连接到 {name}?',
|
|
146
|
-
'flow.connect': '连接',
|
|
147
|
-
'flow.cancel': '取消',
|
|
148
|
-
'flow.machineMissing': '找不到该机器(列表已变化)',
|
|
149
|
-
'flow.hostTitle': '主机(必填)',
|
|
150
|
-
'flow.hostPlaceholder': 'example.com 或 ~/.ssh/config 别名',
|
|
151
|
-
'flow.portTitle': '端口',
|
|
152
|
-
'flow.portPlaceholder': '22',
|
|
153
|
-
'flow.usernameTitle': '用户名',
|
|
154
|
-
'flow.usernamePlaceholder': 'root',
|
|
155
|
-
'flow.nameTitle': '显示名称',
|
|
156
|
-
'flow.namePlaceholder': '留空则使用主机名',
|
|
157
|
-
'flow.authTitle': '认证方式',
|
|
158
|
-
'flow.keyPathTitle': '私钥路径',
|
|
159
|
-
'flow.keyPathPlaceholder': '/home/me/.ssh/id_ed25519',
|
|
160
|
-
'flow.groupTitle': '分组',
|
|
161
|
-
'flow.groupPlaceholder': '留空表示不分组',
|
|
162
|
-
'flow.saveConfirm': '保存这台远程机?',
|
|
163
|
-
'flow.save': '保存',
|
|
164
|
-
},
|
|
165
|
-
en: {
|
|
166
|
-
title: 'dsh-remote · remote servers',
|
|
167
|
-
'cmd.description': 'Open the dsh-remote server manager (remote workspaces)',
|
|
168
|
-
'cmd.unavailable': 'the dsh-remote TUI is not available in this profile',
|
|
169
|
-
'cmd.failed': 'dsh-remote failed to open: {err}',
|
|
170
|
-
'status.loading': '…',
|
|
171
|
-
'status.none': 'no remote machine',
|
|
172
|
-
'status.connected': 'connected · {target}',
|
|
173
|
-
'status.disconnected': 'disconnected · {target}',
|
|
174
|
-
'status.detailMachine': 'machine {name}',
|
|
175
|
-
'status.detailTarget': '{user}@{host}:{port}',
|
|
176
|
-
'status.detailRemote': 'remote {path}',
|
|
177
|
-
|
|
178
|
-
'list.hints': '↑↓ select · Enter actions · a add · c connect · t probe · b browse · o mirror · e edit · d delete · ←/Esc close',
|
|
179
|
-
'list.empty': 'no saved machines yet — press a to add one',
|
|
180
|
-
'list.count': '{count} machines',
|
|
181
|
-
'list.current': 'current',
|
|
182
|
-
'list.loading': '… loading machines',
|
|
183
|
-
|
|
184
|
-
'menu.title': 'Actions · {name}',
|
|
185
|
-
'menu.connect': 'Connect',
|
|
186
|
-
'menu.workspaces': 'Manage workspaces (delete)',
|
|
187
|
-
'menu.edit': 'Edit',
|
|
188
|
-
'menu.delete': 'Delete',
|
|
189
|
-
'menu.probe': 'Probe connection',
|
|
190
|
-
'menu.browse': 'Browse remote directory',
|
|
191
|
-
'menu.hints': '↑↓ select · →/Enter run · ←/Esc back',
|
|
192
|
-
|
|
193
|
-
'form.titleNew': 'Add remote machine',
|
|
194
|
-
'form.titleEdit': 'Edit remote machine · {name}',
|
|
195
|
-
'form.name': 'Name',
|
|
196
|
-
'form.host': 'Host / alias',
|
|
197
|
-
'form.useSshConfig': 'Use ~/.ssh/config alias',
|
|
198
|
-
'form.port': 'Port',
|
|
199
|
-
'form.username': 'Username',
|
|
200
|
-
'form.auth': 'Authentication',
|
|
201
|
-
'form.password': 'Password',
|
|
202
|
-
'form.privateKeyPath': 'Private key path',
|
|
203
|
-
'form.passphrase': 'Key passphrase',
|
|
204
|
-
'form.group': 'Group',
|
|
205
|
-
'form.passwordUnchanged': '(leave empty to keep)',
|
|
206
|
-
'form.passwordPlaceholder': '(not saved)',
|
|
207
|
-
'form.passphrasePlaceholder': '(no passphrase)',
|
|
208
|
-
'form.hints': 'Tab/↓ next · Shift+Tab/↑ previous · Space/←→ toggle · Enter save · Esc cancel',
|
|
209
|
-
'form.required': 'required',
|
|
210
|
-
'form.optional': 'optional',
|
|
211
|
-
'form.errHostRequired': 'host is required',
|
|
212
|
-
'form.errHostInvalid': 'invalid host (no spaces, / or @)',
|
|
213
|
-
'form.errAliasInvalid': 'invalid ~/.ssh/config alias',
|
|
214
|
-
'form.errPortRange': 'port must be an integer between 1 and 65535',
|
|
215
|
-
'form.errAuth': 'invalid authentication mode',
|
|
216
|
-
'form.errKeyPath': 'key authentication needs a private key path',
|
|
217
|
-
|
|
218
|
-
'auth.password': 'Password',
|
|
219
|
-
'auth.key': 'Private key',
|
|
220
|
-
'auth.agent': 'SSH Agent',
|
|
221
|
-
|
|
222
|
-
'confirm.deleteTitle': 'Delete remote machine',
|
|
223
|
-
'confirm.delete': 'Delete "{name}"? Only the local record is removed; remote files are untouched.',
|
|
224
|
-
'confirm.hints': 'y / → / Enter confirm · n / ← / Esc cancel',
|
|
225
|
-
|
|
226
|
-
'browse.title': 'Remote directory · {path}',
|
|
227
|
-
'browse.loading': '… loading directory',
|
|
228
|
-
'browse.empty': '(empty directory)',
|
|
229
|
-
'browse.hints': '↑↓ select · →/Enter open · ←/Backspace up · w use as workspace · Esc back',
|
|
230
|
-
'browse.noSelection': 'no subdirectory to open',
|
|
231
|
-
'ws.title': 'Workspaces · {name}',
|
|
232
|
-
'ws.hints': '↑↓ select · d delete workspace (mirror + chats) · x delete chats only · r forget recent · ←/Esc back',
|
|
233
|
-
'ws.empty': 'no local mirror workspaces for this machine',
|
|
234
|
-
'ws.sessions': '{n} chats',
|
|
235
|
-
'ws.live': '{n} in use',
|
|
236
|
-
'ws.size': 'mirror {size}',
|
|
237
|
-
'ws.registered': 'registered',
|
|
238
|
-
'ws.recent': 'recent',
|
|
239
|
-
'ws.confirmTitleDelete': 'Delete workspace "{name}"?',
|
|
240
|
-
'ws.confirmDelete': 'Deletes the local mirror directory, the workspace registration and {n} chats, and forgets the remote path; this cannot be undone.',
|
|
241
|
-
'ws.confirmTitleSessions': 'Delete the chats under "{name}"?',
|
|
242
|
-
'ws.confirmSessions': 'Deletes {n} chats and keeps the local mirror and registration; this cannot be undone.',
|
|
243
|
-
'ws.confirmTitleRecent': 'Forget "{name}" from the recent list?',
|
|
244
|
-
'ws.confirmRecent': 'Only removes the remote path from every machine\'s recent list (so a restart will not recreate it); the mirror and registration stay.',
|
|
245
|
-
'ws.confirmHints': 'y / → / Enter confirm · n / ← / Esc cancel',
|
|
246
|
-
'ws.busyDelete': 'deleting workspace',
|
|
247
|
-
'ws.busySessions': 'deleting chats',
|
|
248
|
-
'ws.busyRecent': 'forgetting recent entry',
|
|
249
|
-
'ws.deleted': 'workspace {name} deleted: {sessions} chats + mirror + registration',
|
|
250
|
-
'ws.sessionsDeleted': 'deleted {n} chats (mirror kept)',
|
|
251
|
-
'ws.sessionsPartial': 'deleted {n} chats; {live} in use were skipped',
|
|
252
|
-
'ws.recentForgotten': 'forgot recent entry: {name}',
|
|
253
|
-
'ws.busyError': '{n} chats still in use — stop them first',
|
|
254
|
-
'ws.noApi': 'this dshRemote build has no workspace cleanup (plugin too old)',
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
'busy.line': '… {what}',
|
|
258
|
-
'busy.connecting': 'connecting',
|
|
259
|
-
'busy.probing': 'probing',
|
|
260
|
-
'busy.listing': 'loading directory',
|
|
261
|
-
'busy.saving': 'saving',
|
|
262
|
-
'busy.deleting': 'deleting',
|
|
263
|
-
'busy.settingWorkspace': 'creating workspace',
|
|
264
|
-
'busy.revealFolder': 'opening mirror folder',
|
|
265
|
-
'busy.loading': 'loading',
|
|
266
|
-
'busy.loadingMirrors': 'loading local mirror workspaces',
|
|
267
|
-
'footer.error': 'error: {err}',
|
|
268
|
-
'error.generic': 'operation failed',
|
|
269
|
-
'error.noApi': 'the host API is unavailable',
|
|
270
|
-
'error.badWorkspace': 'cannot build the workspace target (local mirror missing)',
|
|
271
|
-
|
|
272
|
-
'notify.connected': 'connected to {target}',
|
|
273
|
-
'notify.probeOk': 'connection ok · {target} · {latency} ms',
|
|
274
|
-
'notify.probeFailed': 'probe failed: {err}',
|
|
275
|
-
'notify.saved': 'saved {name}',
|
|
276
|
-
'notify.deleted': 'deleted {name}',
|
|
277
|
-
'notify.revealed': 'opened {path} in the file manager',
|
|
278
|
-
'notify.workspaceSet': 'workspace adopted: {label}',
|
|
279
|
-
'notify.switchRefused': 'the host refused to switch to {label}',
|
|
280
|
-
'notify.switchFailed': 'workspace switch failed: {err}',
|
|
281
|
-
'notify.pickFailed': 'cannot adopt this directory: {err}',
|
|
282
|
-
'notify.warnings': 'warning: {text}',
|
|
283
|
-
|
|
284
|
-
'flow.add': '+ Add remote machine',
|
|
285
|
-
'flow.addDescription': 'Enter host, port and username',
|
|
286
|
-
'flow.selectTitle': 'Pick a remote machine',
|
|
287
|
-
'flow.machineOption': '{name} · {target}',
|
|
288
|
-
'flow.connectTitle': 'Connect to {name}?',
|
|
289
|
-
'flow.connect': 'Connect',
|
|
290
|
-
'flow.cancel': 'Cancel',
|
|
291
|
-
'flow.machineMissing': 'machine not found (the list changed)',
|
|
292
|
-
'flow.hostTitle': 'Host (required)',
|
|
293
|
-
'flow.hostPlaceholder': 'example.com or a ~/.ssh/config alias',
|
|
294
|
-
'flow.portTitle': 'Port',
|
|
295
|
-
'flow.portPlaceholder': '22',
|
|
296
|
-
'flow.usernameTitle': 'Username',
|
|
297
|
-
'flow.usernamePlaceholder': 'root',
|
|
298
|
-
'flow.nameTitle': 'Display name',
|
|
299
|
-
'flow.namePlaceholder': 'empty uses the host',
|
|
300
|
-
'flow.authTitle': 'Authentication',
|
|
301
|
-
'flow.keyPathTitle': 'Private key path',
|
|
302
|
-
'flow.keyPathPlaceholder': '/home/me/.ssh/id_ed25519',
|
|
303
|
-
'flow.groupTitle': 'Group',
|
|
304
|
-
'flow.groupPlaceholder': 'empty means ungrouped',
|
|
305
|
-
'flow.saveConfirm': 'Save this remote machine?',
|
|
306
|
-
'flow.save': 'Save',
|
|
307
|
-
},
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
/** 规范化语言代码 → 'zh' | 'en';无法识别时返回 undefined。 */
|
|
311
|
-
export function normalizeLang(lang) {
|
|
312
|
-
const value = String(lang === undefined || lang === null ? '' : lang).trim().toLowerCase()
|
|
313
|
-
if (!value) return undefined
|
|
314
|
-
if (value === 'en' || value.startsWith('en-') || value.startsWith('en_')) return 'en'
|
|
315
|
-
if (value === 'zh' || value.startsWith('zh-') || value.startsWith('zh_')) return 'zh'
|
|
316
|
-
return undefined
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* 创建文案渲染器。
|
|
321
|
-
*
|
|
322
|
-
* @param {string} [lang] - 'zh' / 'en'(或 zh-CN / en-US)。省略时读
|
|
323
|
-
* `DSH_TUI_LANG` 环境变量,仍无法判定则中文。
|
|
324
|
-
* @returns {{ lang: 'zh'|'en', dict: Record<string, string>, t(key: string, params?: object): string }}
|
|
325
|
-
*/
|
|
326
|
-
export function createI18n(lang) {
|
|
327
|
-
const fromArg = normalizeLang(lang)
|
|
328
|
-
const envLang = typeof process === 'object' && process && process.env ? process.env.DSH_TUI_LANG : ''
|
|
329
|
-
const resolved = fromArg || normalizeLang(envLang) || 'zh'
|
|
330
|
-
const dict = DICT[resolved] || DICT.zh
|
|
331
|
-
const fallback = DICT.zh
|
|
332
|
-
|
|
333
|
-
/** 取文案并做 {name} 插值;缺 key 时回落中文,再缺则返回 key 本身。 */
|
|
334
|
-
function t(key, params) {
|
|
335
|
-
const name = String(key)
|
|
336
|
-
let text = dict[name]
|
|
337
|
-
if (text === undefined) text = fallback[name]
|
|
338
|
-
if (text === undefined) return name
|
|
339
|
-
if (!params) return text
|
|
340
|
-
return text.replace(/\{(\w+)\}/g, (match, param) => {
|
|
341
|
-
const value = params[param]
|
|
342
|
-
return value === undefined || value === null ? match : String(value)
|
|
343
|
-
})
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
return { lang: resolved, dict, t }
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
/** 暴露字典本身(测试校验两侧键集一致;运行时请用 createI18n)。 */
|
|
350
|
-
export const TRANSLATIONS = DICT
|
|
1
|
+
// dsh-remote TUI 文案表(中 / 英)。
|
|
2
|
+
//
|
|
3
|
+
// TUI 侧所有用户可见字符串都从这里取:场景、对话框降级流程、命令描述、页脚
|
|
4
|
+
// 校验错误。默认中文;只有显式传了英文 lang 或环境变量 `DSH_TUI_LANG=en`
|
|
5
|
+
// 时才用英文(与 dsh-tui 自身的语言开关保持同一习惯)。
|
|
6
|
+
//
|
|
7
|
+
// 约束:zh / en 两个字典必须**键集完全一致**(tui-format.test.js 会断言),
|
|
8
|
+
// 否则漏翻的一侧会静默回落到 key 本身。
|
|
9
|
+
|
|
10
|
+
const DICT = {
|
|
11
|
+
zh: {
|
|
12
|
+
// ── 通用 / 命令 ────────────────────────────────────────────────────────
|
|
13
|
+
title: 'dsh-remote · 远程服务器',
|
|
14
|
+
'cmd.description': '打开 dsh-remote 远程服务器管理页(远程工作区)',
|
|
15
|
+
'cmd.unavailable': '当前 profile 没有可用的 TUI 界面',
|
|
16
|
+
'cmd.failed': 'dsh-remote 打开失败:{err}',
|
|
17
|
+
'status.loading': '…',
|
|
18
|
+
'status.none': '未连接远程机',
|
|
19
|
+
'status.connected': '已连接 {target}',
|
|
20
|
+
'status.disconnected': '未连接 · {target}',
|
|
21
|
+
'status.detailMachine': '远程机 {name}',
|
|
22
|
+
'status.detailTarget': '{user}@{host}:{port}',
|
|
23
|
+
'status.detailRemote': '远端 {path}',
|
|
24
|
+
|
|
25
|
+
// ── 机器列表 ──────────────────────────────────────────────────────────
|
|
26
|
+
'list.hints': '↑↓ 选择 · Enter 动作 · a 新增 · c 连接 · t 探测 · b 浏览 · o 镜像 · e 编辑 · d 删除 · ←/Esc 关闭',
|
|
27
|
+
'list.empty': '还没有保存的远程机 —— 按 a 添加一台',
|
|
28
|
+
'list.count': '{count} 台机器',
|
|
29
|
+
'list.current': '当前',
|
|
30
|
+
'list.loading': '… 正在读取机器列表',
|
|
31
|
+
|
|
32
|
+
// ── 动作菜单 ──────────────────────────────────────────────────────────
|
|
33
|
+
'menu.title': '动作 · {name}',
|
|
34
|
+
'menu.connect': '连接',
|
|
35
|
+
'menu.workspaces': '工作区管理(删除/清理)',
|
|
36
|
+
'menu.edit': '编辑',
|
|
37
|
+
'menu.delete': '删除',
|
|
38
|
+
'menu.probe': '探测连接',
|
|
39
|
+
'menu.browse': '浏览远程目录',
|
|
40
|
+
'menu.hints': '↑↓ 选择 · →/Enter 执行 · ←/Esc 返回',
|
|
41
|
+
|
|
42
|
+
// ── 表单 ──────────────────────────────────────────────────────────────
|
|
43
|
+
'form.titleNew': '新增远程机',
|
|
44
|
+
'form.titleEdit': '编辑远程机 · {name}',
|
|
45
|
+
'form.name': '名称',
|
|
46
|
+
'form.host': '主机 / 别名',
|
|
47
|
+
'form.useSshConfig': '使用 ~/.ssh/config 别名',
|
|
48
|
+
'form.port': '端口',
|
|
49
|
+
'form.username': '用户名',
|
|
50
|
+
'form.auth': '认证方式',
|
|
51
|
+
'form.password': '密码',
|
|
52
|
+
'form.privateKeyPath': '私钥路径',
|
|
53
|
+
'form.passphrase': '私钥口令',
|
|
54
|
+
'form.group': '分组',
|
|
55
|
+
'form.passwordUnchanged': '(留空表示不修改)',
|
|
56
|
+
'form.passwordPlaceholder': '(不保存密码)',
|
|
57
|
+
'form.passphrasePlaceholder': '(无口令)',
|
|
58
|
+
'form.hints': 'Tab/↓ 下一项 · Shift+Tab/↑ 上一项 · Space/←→ 切换 · Enter 保存 · Esc 取消',
|
|
59
|
+
'form.required': '必填',
|
|
60
|
+
'form.optional': '可选',
|
|
61
|
+
'form.errHostRequired': '主机不能为空',
|
|
62
|
+
'form.errHostInvalid': '主机格式不正确(不要包含空格、/ 或 @)',
|
|
63
|
+
'form.errAliasInvalid': '~/.ssh/config 别名格式不正确',
|
|
64
|
+
'form.errPortRange': '端口必须是 1-65535 的整数',
|
|
65
|
+
'form.errAuth': '认证方式无效',
|
|
66
|
+
'form.errKeyPath': '私钥认证需要填写私钥路径',
|
|
67
|
+
|
|
68
|
+
// ── 认证方式 ──────────────────────────────────────────────────────────
|
|
69
|
+
'auth.password': '密码',
|
|
70
|
+
'auth.key': '私钥',
|
|
71
|
+
'auth.agent': 'SSH Agent',
|
|
72
|
+
|
|
73
|
+
// ── 删除确认 ──────────────────────────────────────────────────────────
|
|
74
|
+
'confirm.deleteTitle': '删除远程机',
|
|
75
|
+
'confirm.delete': '确定删除「{name}」?只删除本机保存的记录,不会改动远程文件。',
|
|
76
|
+
'confirm.hints': 'y / → / Enter 确认 · n / ← / Esc 取消',
|
|
77
|
+
|
|
78
|
+
// ── 远程目录浏览 ──────────────────────────────────────────────────────
|
|
79
|
+
'browse.title': '远程目录 · {path}',
|
|
80
|
+
'browse.loading': '… 正在读取目录',
|
|
81
|
+
'browse.empty': '(空目录)',
|
|
82
|
+
'browse.hints': '↑↓ 选择 · →/Enter 进入 · ←/Backspace 上级 · w 设为工作区 · Esc 返回',
|
|
83
|
+
'browse.noSelection': '没有可进入的子目录',
|
|
84
|
+
|
|
85
|
+
// ── 远程工作区清理 ────────────────────────────────────────────────────
|
|
86
|
+
'ws.title': '工作区 · {name}',
|
|
87
|
+
'ws.hints': '↑↓ 选择 · d 删除工作区(含镜像/对话)· x 仅删除对话 · r 移出最近列表 · ←/Esc 返回',
|
|
88
|
+
'ws.empty': '这台机器还没有本地镜像工作区',
|
|
89
|
+
'ws.sessions': '{n} 个对话',
|
|
90
|
+
'ws.live': '{n} 个使用中',
|
|
91
|
+
'ws.size': '镜像 {size}',
|
|
92
|
+
'ws.registered': '已登记',
|
|
93
|
+
'ws.recent': '最近',
|
|
94
|
+
'ws.confirmTitleDelete': '删除工作区「{name}」?',
|
|
95
|
+
'ws.confirmDelete': '将删除本地镜像目录、工作区登记和 {n} 个对话,并从最近列表移除该远端路径;不可恢复。',
|
|
96
|
+
'ws.confirmTitleSessions': '删除「{name}」下的对话?',
|
|
97
|
+
'ws.confirmSessions': '将删除 {n} 个对话,保留本地镜像目录与工作区登记;不可恢复。',
|
|
98
|
+
'ws.confirmTitleRecent': '从最近列表移除「{name}」?',
|
|
99
|
+
'ws.confirmRecent': '只从每台机器的「最近工作区」移除该远端路径(重启后不会再自动重建),本地镜像与台账保留。',
|
|
100
|
+
'ws.confirmHints': 'y / → / Enter 确认 · n / ← / Esc 取消',
|
|
101
|
+
'ws.busyDelete': '正在删除工作区',
|
|
102
|
+
'ws.busySessions': '正在删除对话',
|
|
103
|
+
'ws.busyRecent': '正在移出最近列表',
|
|
104
|
+
'ws.deleted': '已删除工作区 {name}:{sessions} 个对话 + 本地镜像 + 登记',
|
|
105
|
+
'ws.sessionsDeleted': '已删除 {n} 个对话(本地镜像保留)',
|
|
106
|
+
'ws.sessionsPartial': '已删除 {n} 个对话;{live} 个正在使用,已跳过',
|
|
107
|
+
'ws.recentForgotten': '已移出最近列表:{name}',
|
|
108
|
+
'ws.busyError': '还有 {n} 个会话正在使用该工作区,请先停止它们',
|
|
109
|
+
'ws.noApi': '当前 dshRemote 不支持工作区清理(插件版本过旧)',
|
|
110
|
+
|
|
111
|
+
// ── 加载态 / 页脚 ─────────────────────────────────────────────────────
|
|
112
|
+
'busy.line': '… {what}',
|
|
113
|
+
'busy.connecting': '正在连接',
|
|
114
|
+
'busy.probing': '正在探测',
|
|
115
|
+
'busy.listing': '正在读取目录',
|
|
116
|
+
'busy.saving': '正在保存',
|
|
117
|
+
'busy.deleting': '正在删除',
|
|
118
|
+
'busy.settingWorkspace': '正在建立工作区',
|
|
119
|
+
'busy.revealFolder': '正在打开镜像文件夹',
|
|
120
|
+
'busy.loading': '正在加载',
|
|
121
|
+
'busy.loadingMirrors': '正在读取本地镜像工作区',
|
|
122
|
+
'footer.error': '错误:{err}',
|
|
123
|
+
'error.generic': '操作失败',
|
|
124
|
+
'error.noApi': '宿主 API 不可用',
|
|
125
|
+
'error.badWorkspace': '无法构造工作区目标(本地镜像缺失)',
|
|
126
|
+
|
|
127
|
+
// ── toast / notify ────────────────────────────────────────────────────
|
|
128
|
+
'notify.connected': '已连接 {target}',
|
|
129
|
+
'notify.probeOk': '连接正常 · {target} · {latency} ms',
|
|
130
|
+
'notify.probeFailed': '探测失败:{err}',
|
|
131
|
+
'notify.saved': '已保存 {name}',
|
|
132
|
+
'notify.deleted': '已删除 {name}',
|
|
133
|
+
'notify.revealed': '已在文件管理器中打开 {path}',
|
|
134
|
+
'notify.workspaceSet': '已采用工作区 {label}',
|
|
135
|
+
'notify.switchRefused': '宿主拒绝切换到 {label}',
|
|
136
|
+
'notify.switchFailed': '切换工作区失败:{err}',
|
|
137
|
+
'notify.pickFailed': '无法采用该目录:{err}',
|
|
138
|
+
'notify.warnings': '警告:{text}',
|
|
139
|
+
|
|
140
|
+
// ── 无场景时的对话框降级流程 ──────────────────────────────────────────
|
|
141
|
+
'flow.add': '+ 新增远程机',
|
|
142
|
+
'flow.addDescription': '输入主机、端口和用户名',
|
|
143
|
+
'flow.selectTitle': '选择远程机',
|
|
144
|
+
'flow.machineOption': '{name} · {target}',
|
|
145
|
+
'flow.connectTitle': '连接到 {name}?',
|
|
146
|
+
'flow.connect': '连接',
|
|
147
|
+
'flow.cancel': '取消',
|
|
148
|
+
'flow.machineMissing': '找不到该机器(列表已变化)',
|
|
149
|
+
'flow.hostTitle': '主机(必填)',
|
|
150
|
+
'flow.hostPlaceholder': 'example.com 或 ~/.ssh/config 别名',
|
|
151
|
+
'flow.portTitle': '端口',
|
|
152
|
+
'flow.portPlaceholder': '22',
|
|
153
|
+
'flow.usernameTitle': '用户名',
|
|
154
|
+
'flow.usernamePlaceholder': 'root',
|
|
155
|
+
'flow.nameTitle': '显示名称',
|
|
156
|
+
'flow.namePlaceholder': '留空则使用主机名',
|
|
157
|
+
'flow.authTitle': '认证方式',
|
|
158
|
+
'flow.keyPathTitle': '私钥路径',
|
|
159
|
+
'flow.keyPathPlaceholder': '/home/me/.ssh/id_ed25519',
|
|
160
|
+
'flow.groupTitle': '分组',
|
|
161
|
+
'flow.groupPlaceholder': '留空表示不分组',
|
|
162
|
+
'flow.saveConfirm': '保存这台远程机?',
|
|
163
|
+
'flow.save': '保存',
|
|
164
|
+
},
|
|
165
|
+
en: {
|
|
166
|
+
title: 'dsh-remote · remote servers',
|
|
167
|
+
'cmd.description': 'Open the dsh-remote server manager (remote workspaces)',
|
|
168
|
+
'cmd.unavailable': 'the dsh-remote TUI is not available in this profile',
|
|
169
|
+
'cmd.failed': 'dsh-remote failed to open: {err}',
|
|
170
|
+
'status.loading': '…',
|
|
171
|
+
'status.none': 'no remote machine',
|
|
172
|
+
'status.connected': 'connected · {target}',
|
|
173
|
+
'status.disconnected': 'disconnected · {target}',
|
|
174
|
+
'status.detailMachine': 'machine {name}',
|
|
175
|
+
'status.detailTarget': '{user}@{host}:{port}',
|
|
176
|
+
'status.detailRemote': 'remote {path}',
|
|
177
|
+
|
|
178
|
+
'list.hints': '↑↓ select · Enter actions · a add · c connect · t probe · b browse · o mirror · e edit · d delete · ←/Esc close',
|
|
179
|
+
'list.empty': 'no saved machines yet — press a to add one',
|
|
180
|
+
'list.count': '{count} machines',
|
|
181
|
+
'list.current': 'current',
|
|
182
|
+
'list.loading': '… loading machines',
|
|
183
|
+
|
|
184
|
+
'menu.title': 'Actions · {name}',
|
|
185
|
+
'menu.connect': 'Connect',
|
|
186
|
+
'menu.workspaces': 'Manage workspaces (delete)',
|
|
187
|
+
'menu.edit': 'Edit',
|
|
188
|
+
'menu.delete': 'Delete',
|
|
189
|
+
'menu.probe': 'Probe connection',
|
|
190
|
+
'menu.browse': 'Browse remote directory',
|
|
191
|
+
'menu.hints': '↑↓ select · →/Enter run · ←/Esc back',
|
|
192
|
+
|
|
193
|
+
'form.titleNew': 'Add remote machine',
|
|
194
|
+
'form.titleEdit': 'Edit remote machine · {name}',
|
|
195
|
+
'form.name': 'Name',
|
|
196
|
+
'form.host': 'Host / alias',
|
|
197
|
+
'form.useSshConfig': 'Use ~/.ssh/config alias',
|
|
198
|
+
'form.port': 'Port',
|
|
199
|
+
'form.username': 'Username',
|
|
200
|
+
'form.auth': 'Authentication',
|
|
201
|
+
'form.password': 'Password',
|
|
202
|
+
'form.privateKeyPath': 'Private key path',
|
|
203
|
+
'form.passphrase': 'Key passphrase',
|
|
204
|
+
'form.group': 'Group',
|
|
205
|
+
'form.passwordUnchanged': '(leave empty to keep)',
|
|
206
|
+
'form.passwordPlaceholder': '(not saved)',
|
|
207
|
+
'form.passphrasePlaceholder': '(no passphrase)',
|
|
208
|
+
'form.hints': 'Tab/↓ next · Shift+Tab/↑ previous · Space/←→ toggle · Enter save · Esc cancel',
|
|
209
|
+
'form.required': 'required',
|
|
210
|
+
'form.optional': 'optional',
|
|
211
|
+
'form.errHostRequired': 'host is required',
|
|
212
|
+
'form.errHostInvalid': 'invalid host (no spaces, / or @)',
|
|
213
|
+
'form.errAliasInvalid': 'invalid ~/.ssh/config alias',
|
|
214
|
+
'form.errPortRange': 'port must be an integer between 1 and 65535',
|
|
215
|
+
'form.errAuth': 'invalid authentication mode',
|
|
216
|
+
'form.errKeyPath': 'key authentication needs a private key path',
|
|
217
|
+
|
|
218
|
+
'auth.password': 'Password',
|
|
219
|
+
'auth.key': 'Private key',
|
|
220
|
+
'auth.agent': 'SSH Agent',
|
|
221
|
+
|
|
222
|
+
'confirm.deleteTitle': 'Delete remote machine',
|
|
223
|
+
'confirm.delete': 'Delete "{name}"? Only the local record is removed; remote files are untouched.',
|
|
224
|
+
'confirm.hints': 'y / → / Enter confirm · n / ← / Esc cancel',
|
|
225
|
+
|
|
226
|
+
'browse.title': 'Remote directory · {path}',
|
|
227
|
+
'browse.loading': '… loading directory',
|
|
228
|
+
'browse.empty': '(empty directory)',
|
|
229
|
+
'browse.hints': '↑↓ select · →/Enter open · ←/Backspace up · w use as workspace · Esc back',
|
|
230
|
+
'browse.noSelection': 'no subdirectory to open',
|
|
231
|
+
'ws.title': 'Workspaces · {name}',
|
|
232
|
+
'ws.hints': '↑↓ select · d delete workspace (mirror + chats) · x delete chats only · r forget recent · ←/Esc back',
|
|
233
|
+
'ws.empty': 'no local mirror workspaces for this machine',
|
|
234
|
+
'ws.sessions': '{n} chats',
|
|
235
|
+
'ws.live': '{n} in use',
|
|
236
|
+
'ws.size': 'mirror {size}',
|
|
237
|
+
'ws.registered': 'registered',
|
|
238
|
+
'ws.recent': 'recent',
|
|
239
|
+
'ws.confirmTitleDelete': 'Delete workspace "{name}"?',
|
|
240
|
+
'ws.confirmDelete': 'Deletes the local mirror directory, the workspace registration and {n} chats, and forgets the remote path; this cannot be undone.',
|
|
241
|
+
'ws.confirmTitleSessions': 'Delete the chats under "{name}"?',
|
|
242
|
+
'ws.confirmSessions': 'Deletes {n} chats and keeps the local mirror and registration; this cannot be undone.',
|
|
243
|
+
'ws.confirmTitleRecent': 'Forget "{name}" from the recent list?',
|
|
244
|
+
'ws.confirmRecent': 'Only removes the remote path from every machine\'s recent list (so a restart will not recreate it); the mirror and registration stay.',
|
|
245
|
+
'ws.confirmHints': 'y / → / Enter confirm · n / ← / Esc cancel',
|
|
246
|
+
'ws.busyDelete': 'deleting workspace',
|
|
247
|
+
'ws.busySessions': 'deleting chats',
|
|
248
|
+
'ws.busyRecent': 'forgetting recent entry',
|
|
249
|
+
'ws.deleted': 'workspace {name} deleted: {sessions} chats + mirror + registration',
|
|
250
|
+
'ws.sessionsDeleted': 'deleted {n} chats (mirror kept)',
|
|
251
|
+
'ws.sessionsPartial': 'deleted {n} chats; {live} in use were skipped',
|
|
252
|
+
'ws.recentForgotten': 'forgot recent entry: {name}',
|
|
253
|
+
'ws.busyError': '{n} chats still in use — stop them first',
|
|
254
|
+
'ws.noApi': 'this dshRemote build has no workspace cleanup (plugin too old)',
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
'busy.line': '… {what}',
|
|
258
|
+
'busy.connecting': 'connecting',
|
|
259
|
+
'busy.probing': 'probing',
|
|
260
|
+
'busy.listing': 'loading directory',
|
|
261
|
+
'busy.saving': 'saving',
|
|
262
|
+
'busy.deleting': 'deleting',
|
|
263
|
+
'busy.settingWorkspace': 'creating workspace',
|
|
264
|
+
'busy.revealFolder': 'opening mirror folder',
|
|
265
|
+
'busy.loading': 'loading',
|
|
266
|
+
'busy.loadingMirrors': 'loading local mirror workspaces',
|
|
267
|
+
'footer.error': 'error: {err}',
|
|
268
|
+
'error.generic': 'operation failed',
|
|
269
|
+
'error.noApi': 'the host API is unavailable',
|
|
270
|
+
'error.badWorkspace': 'cannot build the workspace target (local mirror missing)',
|
|
271
|
+
|
|
272
|
+
'notify.connected': 'connected to {target}',
|
|
273
|
+
'notify.probeOk': 'connection ok · {target} · {latency} ms',
|
|
274
|
+
'notify.probeFailed': 'probe failed: {err}',
|
|
275
|
+
'notify.saved': 'saved {name}',
|
|
276
|
+
'notify.deleted': 'deleted {name}',
|
|
277
|
+
'notify.revealed': 'opened {path} in the file manager',
|
|
278
|
+
'notify.workspaceSet': 'workspace adopted: {label}',
|
|
279
|
+
'notify.switchRefused': 'the host refused to switch to {label}',
|
|
280
|
+
'notify.switchFailed': 'workspace switch failed: {err}',
|
|
281
|
+
'notify.pickFailed': 'cannot adopt this directory: {err}',
|
|
282
|
+
'notify.warnings': 'warning: {text}',
|
|
283
|
+
|
|
284
|
+
'flow.add': '+ Add remote machine',
|
|
285
|
+
'flow.addDescription': 'Enter host, port and username',
|
|
286
|
+
'flow.selectTitle': 'Pick a remote machine',
|
|
287
|
+
'flow.machineOption': '{name} · {target}',
|
|
288
|
+
'flow.connectTitle': 'Connect to {name}?',
|
|
289
|
+
'flow.connect': 'Connect',
|
|
290
|
+
'flow.cancel': 'Cancel',
|
|
291
|
+
'flow.machineMissing': 'machine not found (the list changed)',
|
|
292
|
+
'flow.hostTitle': 'Host (required)',
|
|
293
|
+
'flow.hostPlaceholder': 'example.com or a ~/.ssh/config alias',
|
|
294
|
+
'flow.portTitle': 'Port',
|
|
295
|
+
'flow.portPlaceholder': '22',
|
|
296
|
+
'flow.usernameTitle': 'Username',
|
|
297
|
+
'flow.usernamePlaceholder': 'root',
|
|
298
|
+
'flow.nameTitle': 'Display name',
|
|
299
|
+
'flow.namePlaceholder': 'empty uses the host',
|
|
300
|
+
'flow.authTitle': 'Authentication',
|
|
301
|
+
'flow.keyPathTitle': 'Private key path',
|
|
302
|
+
'flow.keyPathPlaceholder': '/home/me/.ssh/id_ed25519',
|
|
303
|
+
'flow.groupTitle': 'Group',
|
|
304
|
+
'flow.groupPlaceholder': 'empty means ungrouped',
|
|
305
|
+
'flow.saveConfirm': 'Save this remote machine?',
|
|
306
|
+
'flow.save': 'Save',
|
|
307
|
+
},
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/** 规范化语言代码 → 'zh' | 'en';无法识别时返回 undefined。 */
|
|
311
|
+
export function normalizeLang(lang) {
|
|
312
|
+
const value = String(lang === undefined || lang === null ? '' : lang).trim().toLowerCase()
|
|
313
|
+
if (!value) return undefined
|
|
314
|
+
if (value === 'en' || value.startsWith('en-') || value.startsWith('en_')) return 'en'
|
|
315
|
+
if (value === 'zh' || value.startsWith('zh-') || value.startsWith('zh_')) return 'zh'
|
|
316
|
+
return undefined
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* 创建文案渲染器。
|
|
321
|
+
*
|
|
322
|
+
* @param {string} [lang] - 'zh' / 'en'(或 zh-CN / en-US)。省略时读
|
|
323
|
+
* `DSH_TUI_LANG` 环境变量,仍无法判定则中文。
|
|
324
|
+
* @returns {{ lang: 'zh'|'en', dict: Record<string, string>, t(key: string, params?: object): string }}
|
|
325
|
+
*/
|
|
326
|
+
export function createI18n(lang) {
|
|
327
|
+
const fromArg = normalizeLang(lang)
|
|
328
|
+
const envLang = typeof process === 'object' && process && process.env ? process.env.DSH_TUI_LANG : ''
|
|
329
|
+
const resolved = fromArg || normalizeLang(envLang) || 'zh'
|
|
330
|
+
const dict = DICT[resolved] || DICT.zh
|
|
331
|
+
const fallback = DICT.zh
|
|
332
|
+
|
|
333
|
+
/** 取文案并做 {name} 插值;缺 key 时回落中文,再缺则返回 key 本身。 */
|
|
334
|
+
function t(key, params) {
|
|
335
|
+
const name = String(key)
|
|
336
|
+
let text = dict[name]
|
|
337
|
+
if (text === undefined) text = fallback[name]
|
|
338
|
+
if (text === undefined) return name
|
|
339
|
+
if (!params) return text
|
|
340
|
+
return text.replace(/\{(\w+)\}/g, (match, param) => {
|
|
341
|
+
const value = params[param]
|
|
342
|
+
return value === undefined || value === null ? match : String(value)
|
|
343
|
+
})
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
return { lang: resolved, dict, t }
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/** 暴露字典本身(测试校验两侧键集一致;运行时请用 createI18n)。 */
|
|
350
|
+
export const TRANSLATIONS = DICT
|