feat(i18n): add multi-language support (ja/ko/vi/ru/zh-TW) with system auto-detection

- Extend AppLanguage to 7 locales: zh-CN, zh-TW, en, ja, ko, vi, ru
- Auto-detect system language via navigator.languages; fallback to English
- Add BCP47 locale mapping for date formatting and sorting
- Create 50 translation JSON files (5 languages × 10 namespaces, 1137 keys each)
- Update language selector with native language names
- Extend locale key parity test to cover all 7 languages (70 assertions)
- Add VNC/RDP desktop, serial terminal, AI agent, port forwarding, and SFTP features
- Add credential encryption, host metrics, session backup crypto, and zmodem bridge
- Update Rust backend: desktop services, host metrics, SSH/SFTP enhancements
This commit is contained in:
Logan.Li committed 2026-08-12 00:07:48 +08:00
1 parent fea6d8db04
commit b0d0e3a5f3
301 files changed
+28002 -2705

No files matched your search

+14 -4
View File
@@ -1,12 +1,17 @@
import { describe, expect, it } from 'vitest'
import { beforeEach, describe, expect, it } from 'vitest'
import { normalizeAppSettings } from '../../src/stores/settingsStore'
import { isAppLanguage } from '../../src/i18n/detectLocale'
describe('settings migration', () => {
it('drops obsolete legacy settings while preserving supported values', () => {
beforeEach(() => {
// language default depends on navigator; tests assert explicit values
})
it('keeps supported language and drops obsolete legacy settings', () => {
const settings = normalizeAppSettings({
theme: 'light',
timeout: 45,
language: 'en-US',
language: 'en',
showNotifications: true,
encryptPasswords: false,
lockOnSleep: true,
@@ -14,9 +19,14 @@ describe('settings migration', () => {
expect(settings.theme).toBe('light')
expect(settings.timeout).toBe(45)
expect(settings).not.toHaveProperty('language')
expect(settings.language).toBe('en')
expect(settings).not.toHaveProperty('showNotifications')
expect(settings).not.toHaveProperty('encryptPasswords')
expect(settings).not.toHaveProperty('lockOnSleep')
})
it('falls back to a valid language when stored value is invalid', () => {
const settings = normalizeAppSettings({ language: 'fr-FR' })
expect(isAppLanguage(settings.language)).toBe(true)
})
})
+43 -11
View File
@@ -1,6 +1,7 @@
import { beforeEach, describe, expect, it } from 'vitest'
import {
getTerminalBroadcastTargets,
selectBroadcastTargetCount,
terminalBroadcastTargetCount,
useTerminalBroadcastStore,
} from '../../src/stores/terminalBroadcastStore'
@@ -8,7 +9,40 @@ import {
describe('terminal broadcast store', () => {
beforeEach(() => useTerminalBroadcastStore.getState().reset())
it('collects ready shells from every open terminal workspace and removes closed tabs', () => {
it('defaults scope to current-tab', () => {
expect(useTerminalBroadcastStore.getState().scope).toBe('current-tab')
})
it('collects ready shells from every open terminal workspace when scope is all', () => {
const store = useTerminalBroadcastStore.getState()
store.setScope('all')
store.registerWorkspace({
tabId: 'tab-a',
targets: [
{ tabId: 'tab-a', paneId: 'left', shellId: 'shell-a', connectionId: 'conn-a', label: 'Host A' },
{ tabId: 'tab-a', paneId: 'right', shellId: 'shell-b', connectionId: 'conn-a', label: 'Host A' },
],
})
store.registerWorkspace({
tabId: 'tab-b',
targets: [
{ tabId: 'tab-b', paneId: 'main', shellId: 'shell-c', connectionId: 'local', label: 'Local' },
],
})
expect(getTerminalBroadcastTargets().map((target) => target.shellId)).toEqual([
'shell-a',
'shell-b',
'shell-c',
])
expect(terminalBroadcastTargetCount(useTerminalBroadcastStore.getState())).toBe(3)
expect(selectBroadcastTargetCount('tab-a')(useTerminalBroadcastStore.getState())).toBe(3)
useTerminalBroadcastStore.getState().unregisterWorkspace('tab-a')
expect(getTerminalBroadcastTargets().map((target) => target.shellId)).toEqual(['shell-c'])
})
it('limits targets to the source tab when scope is current-tab', () => {
const store = useTerminalBroadcastStore.getState()
store.registerWorkspace({
tabId: 'tab-a',
@@ -24,15 +58,13 @@ describe('terminal broadcast store', () => {
],
})
expect(getTerminalBroadcastTargets().map((target) => target.shellId)).toEqual([
'shell-a',
'shell-b',
'shell-c',
])
expect(terminalBroadcastTargetCount(useTerminalBroadcastStore.getState())).toBe(3)
useTerminalBroadcastStore.getState().unregisterWorkspace('tab-a')
expect(getTerminalBroadcastTargets().map((target) => target.shellId)).toEqual(['shell-c'])
expect(getTerminalBroadcastTargets('tab-a').map((t) => t.shellId)).toEqual(['shell-a', 'shell-b'])
expect(getTerminalBroadcastTargets('tab-b').map((t) => t.shellId)).toEqual(['shell-c'])
const latest = useTerminalBroadcastStore.getState()
expect(selectBroadcastTargetCount('tab-a')(latest)).toBe(2)
expect(selectBroadcastTargetCount('tab-b')(latest)).toBe(1)
// Without source tab id, current-tab must not silently expand to all tabs
expect(getTerminalBroadcastTargets()).toEqual([])
})
it('deduplicates a shell defensively', () => {
@@ -43,6 +75,6 @@ describe('terminal broadcast store', () => {
{ tabId: 'tab-a', paneId: 'b', shellId: 'shared', connectionId: 'conn-a', label: 'A' },
],
})
expect(getTerminalBroadcastTargets()).toHaveLength(1)
expect(getTerminalBroadcastTargets('tab-a')).toHaveLength(1)
})
})