diff --git a/server/src/wled_controller/static/app.js b/server/src/wled_controller/static/app.js index c701edb..e8b3583 100644 --- a/server/src/wled_controller/static/app.js +++ b/server/src/wled_controller/static/app.js @@ -120,6 +120,12 @@ function updateAllText() { const key = el.getAttribute('data-i18n-title'); el.title = t(key); }); + + // Re-render dynamic content with new translations + if (apiKey) { + loadDisplays(); + loadDevices(); + } } // Initialize app @@ -360,7 +366,7 @@ async function loadDevices() { const container = document.getElementById('devices-list'); if (!devices || devices.length === 0) { - container.innerHTML = '
No devices attached
'; + container.innerHTML = `
${t('devices.none')}
`; return; } @@ -395,7 +401,7 @@ async function loadDevices() { } catch (error) { console.error('Failed to load devices:', error); document.getElementById('devices-list').innerHTML = - '
Failed to load devices
'; + `
${t('devices.failed')}
`; } } @@ -405,44 +411,45 @@ function createDeviceCard(device) { const settings = device.settings || {}; const isProcessing = state.processing || false; + const statusKey = isProcessing ? 'device.status.processing' : 'device.status.idle'; const status = isProcessing ? 'processing' : 'idle'; return `
${device.name || device.id}
- ${status.toUpperCase()} + ${t(statusKey)}
- URL: + ${t('device.url')} ${device.url || 'N/A'}
- LED Count: + ${t('device.led_count')} ${device.led_count || 0}
- Display: - Display ${settings.display_index !== undefined ? settings.display_index : 0} + ${t('device.display')} + ${settings.display_index !== undefined ? settings.display_index : 0}
${isProcessing ? `
${state.fps_actual?.toFixed(1) || '0.0'}
-
Actual FPS
+
${t('device.metrics.actual_fps')}
${state.fps_target || 0}
-
Target FPS
+
${t('device.metrics.target_fps')}
${metrics.frames_processed || 0}
-
Frames
+
${t('device.metrics.frames')}
${metrics.errors_count || 0}
-
Errors
+
${t('device.metrics.errors')}
` : ''} @@ -450,21 +457,21 @@ function createDeviceCard(device) {
${isProcessing ? ` ` : ` `}
diff --git a/server/src/wled_controller/static/locales/en.json b/server/src/wled_controller/static/locales/en.json index 13aa1da..8d0f507 100644 --- a/server/src/wled_controller/static/locales/en.json +++ b/server/src/wled_controller/static/locales/en.json @@ -64,6 +64,10 @@ "device.removed": "Device removed successfully", "device.started": "Processing started", "device.stopped": "Processing stopped", + "device.metrics.actual_fps": "Actual FPS", + "device.metrics.target_fps": "Target FPS", + "device.metrics.frames": "Frames", + "device.metrics.errors": "Errors", "settings.title": "Device Settings", "settings.brightness": "Brightness:", "settings.brightness.hint": "Global brightness for this WLED device (0-100%)", diff --git a/server/src/wled_controller/static/locales/ru.json b/server/src/wled_controller/static/locales/ru.json index 0e8c21b..84fb8c0 100644 --- a/server/src/wled_controller/static/locales/ru.json +++ b/server/src/wled_controller/static/locales/ru.json @@ -64,6 +64,10 @@ "device.removed": "Устройство успешно удалено", "device.started": "Обработка запущена", "device.stopped": "Обработка остановлена", + "device.metrics.actual_fps": "Факт. FPS", + "device.metrics.target_fps": "Целев. FPS", + "device.metrics.frames": "Кадры", + "device.metrics.errors": "Ошибки", "settings.title": "Настройки Устройства", "settings.brightness": "Яркость:", "settings.brightness.hint": "Общая яркость для этого WLED устройства (0-100%)",