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:
1 parent
fea6d8db04
commit
b0d0e3a5f3
301 files changed
+28002
-2705
No files matched your search
@@ -0,0 +1,66 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { normalizeDistroId, parseOsPrettyName, parseOsReleaseOrUname, resolveSessionDistro } from '../../src/utils/hostDistro'
|
||||
|
||||
describe('hostDistro', () => {
|
||||
it('normalizes common distro ids', () => {
|
||||
expect(normalizeDistroId('ubuntu')).toBe('ubuntu')
|
||||
expect(normalizeDistroId('deepin')).toBe('deepin')
|
||||
expect(normalizeDistroId('uos')).toBe('deepin')
|
||||
expect(normalizeDistroId('rocky')).toBe('rocky')
|
||||
expect(normalizeDistroId('rhel')).toBe('redhat')
|
||||
expect(normalizeDistroId('openEuler')).toBe('openeuler')
|
||||
expect(normalizeDistroId('anolis')).toBe('anolis')
|
||||
expect(normalizeDistroId('alinux')).toBe('alinux')
|
||||
expect(normalizeDistroId('amzn2')).toBe('amazon')
|
||||
expect(normalizeDistroId('Amazon Linux')).toBe('amazon')
|
||||
expect(normalizeDistroId('Alibaba Cloud Linux')).toBe('alinux')
|
||||
expect(normalizeDistroId('Linux')).toBe('linux')
|
||||
})
|
||||
|
||||
it('parses cloud linux from os-release NAME when needed', () => {
|
||||
expect(
|
||||
parseOsReleaseOrUname(`NAME="Alibaba Cloud Linux"
|
||||
ID=alinux
|
||||
VERSION_ID="3"`)
|
||||
).toBe('alinux')
|
||||
expect(
|
||||
parseOsReleaseOrUname(`NAME="Amazon Linux"
|
||||
ID=amzn
|
||||
VERSION_ID="2023"`)
|
||||
).toBe('amazon')
|
||||
})
|
||||
|
||||
it('parses os-release ID', () => {
|
||||
const sample = `NAME="Ubuntu"
|
||||
VERSION="22.04"
|
||||
ID=ubuntu
|
||||
ID_LIKE=debian
|
||||
`
|
||||
expect(parseOsReleaseOrUname(sample)).toBe('ubuntu')
|
||||
})
|
||||
|
||||
it('maps TencentOS to centos icon family', () => {
|
||||
expect(normalizeDistroId('tencentos')).toBe('centos')
|
||||
expect(
|
||||
parseOsReleaseOrUname(`NAME="TencentOS Server"
|
||||
ID="tencentos"
|
||||
VERSION_ID="4"`)
|
||||
).toBe('centos')
|
||||
})
|
||||
|
||||
it('parses PRETTY_NAME', () => {
|
||||
expect(
|
||||
parseOsPrettyName(`NAME="Ubuntu"
|
||||
PRETTY_NAME="Ubuntu 24.04.4 LTS"
|
||||
ID=ubuntu`)
|
||||
).toBe('Ubuntu 24.04.4 LTS')
|
||||
})
|
||||
|
||||
it('resolves protocol defaults for desktop sessions', () => {
|
||||
expect(resolveSessionDistro({ protocol: 'rdp' })).toBe('windows')
|
||||
expect(resolveSessionDistro({ protocol: 'vnc' })).toBe('vnc')
|
||||
expect(resolveSessionDistro({ protocol: 'ssh', distro: 'debian' })).toBe('debian')
|
||||
expect(resolveSessionDistro({ protocol: 'ssh' })).toBe('linux')
|
||||
expect(resolveSessionDistro({})).toBe('linux')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user