fix: resolve i18n implementation issues
This commit is contained in:
@ -23,7 +23,7 @@ export const BoardInfoPanel: Component<{ board: BoardInfo }> = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (props.board.ttl == null) {
|
if (props.board.ttl == null) {
|
||||||
return 'timeout';
|
return t('info.timeout');
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -39,7 +39,7 @@ export const BoardInfoPanel: Component<{ board: BoardInfo }> = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ('Connecting' in props.board.connect_status) {
|
if ('Connecting' in props.board.connect_status) {
|
||||||
return `Connecting (${props.board.connect_status.Connecting.toFixed(0)})`;
|
return `${t('info.connecting')} (${props.board.connect_status.Connecting.toFixed(0)})`;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Component, JSX, ParentComponent, splitProps } from 'solid-js';
|
import { Component, JSX, ParentComponent, splitProps } from 'solid-js';
|
||||||
import { DisplayInfo } from '../../models/display-info.model';
|
import { DisplayInfo } from '../../models/display-info.model';
|
||||||
|
import { useLanguage } from '../../i18n/index';
|
||||||
|
|
||||||
type DisplayInfoItemProps = {
|
type DisplayInfoItemProps = {
|
||||||
label: string;
|
label: string;
|
||||||
@ -20,26 +21,28 @@ type DisplayInfoPanelProps = {
|
|||||||
|
|
||||||
export const DisplayInfoPanel: Component<DisplayInfoPanelProps> = (props) => {
|
export const DisplayInfoPanel: Component<DisplayInfoPanelProps> = (props) => {
|
||||||
const [localProps, rootProps] = splitProps(props, ['display']);
|
const [localProps, rootProps] = splitProps(props, ['display']);
|
||||||
|
const { t } = useLanguage();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div {...rootProps} class={'card bg-base-100/95 backdrop-blur shadow-lg border border-base-300 ' + rootProps.class}>
|
<div {...rootProps} class={'card bg-base-100/95 backdrop-blur shadow-lg border border-base-300 ' + rootProps.class}>
|
||||||
<div class="card-body p-4">
|
<div class="card-body p-4">
|
||||||
<div class="card-title text-sm mb-3 flex items-center justify-between">
|
<div class="card-title text-sm mb-3 flex items-center justify-between">
|
||||||
<span class="text-base-content">显示器信息</span>
|
<span class="text-base-content">{t('displays.displayInfo')}</span>
|
||||||
{localProps.display.is_primary && (
|
{localProps.display.is_primary && (
|
||||||
<div class="badge badge-primary badge-sm">主显示器</div>
|
<div class="badge badge-primary badge-sm">{t('displays.isPrimary')}</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<DisplayInfoItem label="ID">
|
<DisplayInfoItem label={t('displays.id')}>
|
||||||
<code class="bg-base-200 px-1 rounded text-xs">{localProps.display.id}</code>
|
<code class="bg-base-200 px-1 rounded text-xs">{localProps.display.id}</code>
|
||||||
</DisplayInfoItem>
|
</DisplayInfoItem>
|
||||||
<DisplayInfoItem label="位置">
|
<DisplayInfoItem label={t('displays.position')}>
|
||||||
({localProps.display.x}, {localProps.display.y})
|
({localProps.display.x}, {localProps.display.y})
|
||||||
</DisplayInfoItem>
|
</DisplayInfoItem>
|
||||||
<DisplayInfoItem label="尺寸">
|
<DisplayInfoItem label={t('displays.size')}>
|
||||||
{localProps.display.width} × {localProps.display.height}
|
{localProps.display.width} × {localProps.display.height}
|
||||||
</DisplayInfoItem>
|
</DisplayInfoItem>
|
||||||
<DisplayInfoItem label="缩放">
|
<DisplayInfoItem label={t('displays.scale')}>
|
||||||
{localProps.display.scale_factor}×
|
{localProps.display.scale_factor}×
|
||||||
</DisplayInfoItem>
|
</DisplayInfoItem>
|
||||||
</div>
|
</div>
|
||||||
|
@ -191,14 +191,14 @@ export const LedStripTest = () => {
|
|||||||
<div class="container mx-auto p-6 space-y-6">
|
<div class="container mx-auto p-6 space-y-6">
|
||||||
<div class="card bg-base-200 shadow-xl">
|
<div class="card bg-base-200 shadow-xl">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h2 class="card-title text-2xl mb-4">LED Strip Testing</h2>
|
<h2 class="card-title text-2xl mb-4">{t('ledTest.title')}</h2>
|
||||||
|
|
||||||
{/* Hardware Selection */}
|
{/* Hardware Selection */}
|
||||||
<div class="form-control w-full max-w-xs">
|
<div class="form-control w-full max-w-xs">
|
||||||
<label class="label">
|
<label class="label">
|
||||||
<span class="label-text">Select Hardware Board</span>
|
<span class="label-text">{t('ledTest.selectHardwareBoard')}</span>
|
||||||
<span class="label-text-alt">
|
<span class="label-text-alt">
|
||||||
{boards().length > 0 ? `${boards().length} device(s) found` : 'Searching...'}
|
{boards().length > 0 ? `${boards().length} ${t('ledTest.devicesFound')}` : t('ledTest.searching')}
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
<select
|
<select
|
||||||
@ -210,7 +210,7 @@ export const LedStripTest = () => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<option disabled value="">
|
<option disabled value="">
|
||||||
{boards().length > 0 ? 'Choose a board' : 'No boards found'}
|
{boards().length > 0 ? t('ledTest.chooseBoard') : t('ledTest.noBoardsFound')}
|
||||||
</option>
|
</option>
|
||||||
<For each={boards()}>
|
<For each={boards()}>
|
||||||
{(board) => {
|
{(board) => {
|
||||||
@ -221,9 +221,9 @@ export const LedStripTest = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getStatusText = (status: BoardInfo['connect_status']) => {
|
const getStatusText = (status: BoardInfo['connect_status']) => {
|
||||||
if (status === 'Connected') return 'Connected';
|
if (status === 'Connected') return t('ledTest.connected');
|
||||||
if (typeof status === 'object' && 'Connecting' in status) return 'Connecting';
|
if (typeof status === 'object' && 'Connecting' in status) return t('ledTest.connecting');
|
||||||
return 'Disconnected';
|
return t('ledTest.disconnected');
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -240,7 +240,7 @@ export const LedStripTest = () => {
|
|||||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mt-4">
|
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mt-4">
|
||||||
<div class="form-control">
|
<div class="form-control">
|
||||||
<label class="label">
|
<label class="label">
|
||||||
<span class="label-text">LED Count</span>
|
<span class="label-text">{t('ledTest.ledCount')}</span>
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
@ -254,7 +254,7 @@ export const LedStripTest = () => {
|
|||||||
|
|
||||||
<div class="form-control">
|
<div class="form-control">
|
||||||
<label class="label">
|
<label class="label">
|
||||||
<span class="label-text">LED Type</span>
|
<span class="label-text">{t('ledTest.ledType')}</span>
|
||||||
</label>
|
</label>
|
||||||
<select
|
<select
|
||||||
class="select select-bordered w-full"
|
class="select select-bordered w-full"
|
||||||
@ -268,7 +268,7 @@ export const LedStripTest = () => {
|
|||||||
|
|
||||||
<div class="form-control">
|
<div class="form-control">
|
||||||
<label class="label">
|
<label class="label">
|
||||||
<span class="label-text">Animation Speed (ms)</span>
|
<span class="label-text">{t('ledTest.animationSpeed')}</span>
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
@ -306,7 +306,7 @@ export const LedStripTest = () => {
|
|||||||
onClick={() => startTest(pattern)}
|
onClick={() => startTest(pattern)}
|
||||||
disabled={!selectedBoard()}
|
disabled={!selectedBoard()}
|
||||||
>
|
>
|
||||||
Start Test
|
{t('ledTest.startTestButton')}
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@ -314,7 +314,7 @@ export const LedStripTest = () => {
|
|||||||
class="btn btn-error"
|
class="btn btn-error"
|
||||||
onClick={() => stopTest()}
|
onClick={() => stopTest()}
|
||||||
>
|
>
|
||||||
Stop Test
|
{t('ledTest.stopTest')}
|
||||||
</button>
|
</button>
|
||||||
</Show>
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
|
@ -301,8 +301,8 @@ export const WhiteBalance = () => {
|
|||||||
<ol class="list-decimal list-inside space-y-1 ml-2">
|
<ol class="list-decimal list-inside space-y-1 ml-2">
|
||||||
<li>{t('whiteBalance.fullscreenTip')}</li>
|
<li>{t('whiteBalance.fullscreenTip')}</li>
|
||||||
<li>{t('whiteBalance.dragTip')}</li>
|
<li>{t('whiteBalance.dragTip')}</li>
|
||||||
<li>将RGB控制面板拖拽到合适位置</li>
|
<li>{t('whiteBalance.dragPanelTip')}</li>
|
||||||
<li>对比LED灯条颜色与屏幕边缘颜色</li>
|
<li>{t('whiteBalance.compareColorsTip')}</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -58,6 +58,9 @@ export const enUS: TranslationDict = {
|
|||||||
deviceCount: 'Device Count',
|
deviceCount: 'Device Count',
|
||||||
noDevicesFound: 'No Devices Found',
|
noDevicesFound: 'No Devices Found',
|
||||||
checkConnection: 'Please check device connection status',
|
checkConnection: 'Please check device connection status',
|
||||||
|
// Device status
|
||||||
|
timeout: 'Timeout',
|
||||||
|
connecting: 'Connecting',
|
||||||
},
|
},
|
||||||
|
|
||||||
displays: {
|
displays: {
|
||||||
@ -88,6 +91,9 @@ export const enUS: TranslationDict = {
|
|||||||
currentMode: 'Current Mode',
|
currentMode: 'Current Mode',
|
||||||
maxMode: 'Max Mode',
|
maxMode: 'Max Mode',
|
||||||
minMode: 'Min Mode',
|
minMode: 'Min Mode',
|
||||||
|
// Display info panel specific
|
||||||
|
id: 'ID',
|
||||||
|
scale: 'Scale',
|
||||||
},
|
},
|
||||||
|
|
||||||
ledConfig: {
|
ledConfig: {
|
||||||
@ -169,6 +175,9 @@ export const enUS: TranslationDict = {
|
|||||||
draggable: 'Draggable',
|
draggable: 'Draggable',
|
||||||
exitFullscreen: 'Exit Fullscreen',
|
exitFullscreen: 'Exit Fullscreen',
|
||||||
notEnabled: 'Not Enabled',
|
notEnabled: 'Not Enabled',
|
||||||
|
// Missing white balance instructions
|
||||||
|
dragPanelTip: 'Drag the RGB control panel to a suitable position',
|
||||||
|
compareColorsTip: 'Compare LED strip colors with screen edge colors',
|
||||||
},
|
},
|
||||||
|
|
||||||
ledTest: {
|
ledTest: {
|
||||||
@ -197,6 +206,20 @@ export const enUS: TranslationDict = {
|
|||||||
singleScan: 'Single Scan',
|
singleScan: 'Single Scan',
|
||||||
singleScanDesc: 'Light up each LED individually for precise position testing',
|
singleScanDesc: 'Light up each LED individually for precise position testing',
|
||||||
breathingDesc: 'Breathing effect for the entire LED strip to test overall brightness',
|
breathingDesc: 'Breathing effect for the entire LED strip to test overall brightness',
|
||||||
|
// LED test form labels
|
||||||
|
ledCount: 'LED Count',
|
||||||
|
ledType: 'LED Type',
|
||||||
|
animationSpeed: 'Animation Speed (ms)',
|
||||||
|
startTestButton: 'Start Test',
|
||||||
|
// Hardware selection
|
||||||
|
selectHardwareBoard: 'Select Hardware Board',
|
||||||
|
devicesFound: 'device(s) found',
|
||||||
|
searching: 'Searching...',
|
||||||
|
chooseBoard: 'Choose a board',
|
||||||
|
noBoardsFound: 'No boards found',
|
||||||
|
connected: 'Connected',
|
||||||
|
connecting: 'Connecting',
|
||||||
|
disconnected: 'Disconnected',
|
||||||
},
|
},
|
||||||
|
|
||||||
errors: {
|
errors: {
|
||||||
|
@ -58,6 +58,9 @@ export const zhCN: TranslationDict = {
|
|||||||
deviceCount: '设备总数',
|
deviceCount: '设备总数',
|
||||||
noDevicesFound: '未发现设备',
|
noDevicesFound: '未发现设备',
|
||||||
checkConnection: '请检查设备连接状态',
|
checkConnection: '请检查设备连接状态',
|
||||||
|
// Device status
|
||||||
|
timeout: '超时',
|
||||||
|
connecting: '连接中',
|
||||||
},
|
},
|
||||||
|
|
||||||
displays: {
|
displays: {
|
||||||
@ -88,6 +91,9 @@ export const zhCN: TranslationDict = {
|
|||||||
currentMode: '当前模式',
|
currentMode: '当前模式',
|
||||||
maxMode: '最大模式',
|
maxMode: '最大模式',
|
||||||
minMode: '最小模式',
|
minMode: '最小模式',
|
||||||
|
// Display info panel specific
|
||||||
|
id: 'ID',
|
||||||
|
scale: '缩放',
|
||||||
},
|
},
|
||||||
|
|
||||||
ledConfig: {
|
ledConfig: {
|
||||||
@ -169,10 +175,13 @@ export const zhCN: TranslationDict = {
|
|||||||
draggable: '可拖拽',
|
draggable: '可拖拽',
|
||||||
exitFullscreen: '退出全屏',
|
exitFullscreen: '退出全屏',
|
||||||
notEnabled: '暂未启用',
|
notEnabled: '暂未启用',
|
||||||
|
// Missing white balance instructions
|
||||||
|
dragPanelTip: '将RGB控制面板拖拽到合适位置',
|
||||||
|
compareColorsTip: '对比LED灯条颜色与屏幕边缘颜色',
|
||||||
},
|
},
|
||||||
|
|
||||||
ledTest: {
|
ledTest: {
|
||||||
title: '灯带测试',
|
title: 'LED灯带测试',
|
||||||
testEffects: '测试效果',
|
testEffects: '测试效果',
|
||||||
staticColor: '静态颜色',
|
staticColor: '静态颜色',
|
||||||
rainbow: '彩虹',
|
rainbow: '彩虹',
|
||||||
@ -197,6 +206,20 @@ export const zhCN: TranslationDict = {
|
|||||||
singleScan: '单色扫描',
|
singleScan: '单色扫描',
|
||||||
singleScanDesc: '单个LED依次点亮,用于精确测试每个LED位置',
|
singleScanDesc: '单个LED依次点亮,用于精确测试每个LED位置',
|
||||||
breathingDesc: '整条灯带呼吸效果,用于测试整体亮度',
|
breathingDesc: '整条灯带呼吸效果,用于测试整体亮度',
|
||||||
|
// LED test form labels
|
||||||
|
ledCount: 'LED数量',
|
||||||
|
ledType: 'LED类型',
|
||||||
|
animationSpeed: '动画速度 (ms)',
|
||||||
|
startTestButton: '开始测试',
|
||||||
|
// Hardware selection
|
||||||
|
selectHardwareBoard: '选择硬件板',
|
||||||
|
devicesFound: '个设备',
|
||||||
|
searching: '搜索中...',
|
||||||
|
chooseBoard: '选择设备',
|
||||||
|
noBoardsFound: '未找到设备',
|
||||||
|
connected: '已连接',
|
||||||
|
connecting: '连接中',
|
||||||
|
disconnected: '已断开',
|
||||||
},
|
},
|
||||||
|
|
||||||
errors: {
|
errors: {
|
||||||
|
@ -61,6 +61,9 @@ export interface TranslationDict {
|
|||||||
deviceCount: string;
|
deviceCount: string;
|
||||||
noDevicesFound: string;
|
noDevicesFound: string;
|
||||||
checkConnection: string;
|
checkConnection: string;
|
||||||
|
// Device status
|
||||||
|
timeout: string;
|
||||||
|
connecting: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Display page
|
// Display page
|
||||||
@ -92,6 +95,9 @@ export interface TranslationDict {
|
|||||||
currentMode: string;
|
currentMode: string;
|
||||||
maxMode: string;
|
maxMode: string;
|
||||||
minMode: string;
|
minMode: string;
|
||||||
|
// Display info panel specific
|
||||||
|
id: string;
|
||||||
|
scale: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
// LED Strip Configuration
|
// LED Strip Configuration
|
||||||
@ -175,6 +181,9 @@ export interface TranslationDict {
|
|||||||
draggable: string;
|
draggable: string;
|
||||||
exitFullscreen: string;
|
exitFullscreen: string;
|
||||||
notEnabled: string;
|
notEnabled: string;
|
||||||
|
// Missing white balance instructions
|
||||||
|
dragPanelTip: string;
|
||||||
|
compareColorsTip: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
// LED Test
|
// LED Test
|
||||||
@ -204,6 +213,20 @@ export interface TranslationDict {
|
|||||||
singleScan: string;
|
singleScan: string;
|
||||||
singleScanDesc: string;
|
singleScanDesc: string;
|
||||||
breathingDesc: string;
|
breathingDesc: string;
|
||||||
|
// LED test form labels
|
||||||
|
ledCount: string;
|
||||||
|
ledType: string;
|
||||||
|
animationSpeed: string;
|
||||||
|
startTestButton: string;
|
||||||
|
// Hardware selection
|
||||||
|
selectHardwareBoard: string;
|
||||||
|
devicesFound: string;
|
||||||
|
searching: string;
|
||||||
|
chooseBoard: string;
|
||||||
|
noBoardsFound: string;
|
||||||
|
connected: string;
|
||||||
|
connecting: string;
|
||||||
|
disconnected: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Error messages
|
// Error messages
|
||||||
|
Reference in New Issue
Block a user