Add internationalization (i18n) support with English and Russian translations
Some checks failed
Validate / validate (push) Failing after 7s

Implemented localization system similar to the media-server project pattern:
- Created locale JSON files for English (en.json) and Russian (ru.json)
- Added complete translations for all UI elements, buttons, labels, and messages
- Implemented locale management system with browser locale detection
- Added language selector dropdown in header
- Applied data-i18n, data-i18n-title, and data-i18n-placeholder attributes
- Translations stored in localStorage and persist across sessions
- Automatic language detection from browser settings
- All dynamic content (displays, devices, modals) now uses translation function

Translations cover:
- Authentication (login/logout)
- Displays (layout visualization, cards, labels)
- Devices (management, status, actions)
- Settings modal (brightness, device configuration)
- Calibration modal (LED mapping, testing)
- Error messages and notifications
- Server status and version information

The implementation uses:
- Simple t(key, params) translation function with parameter substitution
- Async locale loading from /static/locales/{locale}.json
- updateAllText() to refresh all UI elements when language changes
- Fallback to English if translation file fails to load

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-06 17:09:50 +03:00
parent 6a0cc12ca1
commit 38018750ed
4 changed files with 439 additions and 90 deletions

View File

@@ -0,0 +1,111 @@
{
"app.title": "WLED Контроллер Экрана",
"app.version": "Версия:",
"theme.toggle": "Переключить тему",
"locale.change": "Изменить язык",
"auth.login": "Войти",
"auth.logout": "Выйти",
"auth.authenticated": "Авторизован",
"auth.title": "Вход в WLED Контроллер",
"auth.message": "Пожалуйста, введите ваш API ключ для аутентификации и доступа к WLED Контроллеру Экрана.",
"auth.label": "API Ключ:",
"auth.placeholder": "Введите ваш API ключ...",
"auth.hint": "Ваш API ключ будет безопасно сохранен в локальном хранилище браузера.",
"auth.button.cancel": "Отмена",
"auth.button.login": "Войти",
"auth.error.required": "Пожалуйста, введите API ключ",
"auth.success": "Вход выполнен успешно!",
"auth.logout.confirm": "Вы уверены, что хотите выйти?",
"auth.logout.success": "Выход выполнен успешно",
"auth.please_login": "Пожалуйста, войдите для просмотра",
"displays.title": "Доступные Дисплеи",
"displays.layout": "Расположение Дисплеев",
"displays.information": "Информация о Дисплеях",
"displays.legend.primary": "Основной Дисплей",
"displays.legend.secondary": "Вторичный Дисплей",
"displays.badge.primary": "Основной",
"displays.badge.secondary": "Вторичный",
"displays.resolution": "Разрешение:",
"displays.position": "Позиция:",
"displays.index": "Индекс Дисплея:",
"displays.loading": "Загрузка дисплеев...",
"displays.none": "Нет доступных дисплеев",
"displays.failed": "Не удалось загрузить дисплеи",
"devices.title": "WLED Устройства",
"devices.add": "Добавить Новое Устройство",
"devices.loading": "Загрузка устройств...",
"devices.none": "Устройства не настроены",
"devices.failed": "Не удалось загрузить устройства",
"devices.wled_config": "Конфигурация WLED:",
"devices.wled_note": "Настройте ваше WLED устройство (эффекты, сегменты, порядок цветов, ограничения питания и т.д.) используя",
"devices.wled_link": "официальное приложение WLED",
"devices.wled_note2": "Этот контроллер отправляет данные о цвете пикселей и управляет яркостью для каждого устройства.",
"device.name": "Имя Устройства:",
"device.name.placeholder": "ТВ в Гостиной",
"device.url": "WLED URL:",
"device.url.placeholder": "http://192.168.1.100",
"device.led_count": "Количество Светодиодов:",
"device.led_count.hint": "Количество светодиодов, настроенных в вашем WLED устройстве",
"device.button.add": "Добавить Устройство",
"device.button.start": "Запустить",
"device.button.stop": "Остановить",
"device.button.settings": "Настройки",
"device.button.calibrate": "Калибровка",
"device.button.remove": "Удалить",
"device.status.connected": "Подключено",
"device.status.disconnected": "Отключено",
"device.status.error": "Ошибка",
"device.status.processing": "Обработка",
"device.status.idle": "Ожидание",
"device.fps": "FPS:",
"device.display": "Дисплей:",
"device.remove.confirm": "Вы уверены, что хотите удалить это устройство?",
"device.added": "Устройство успешно добавлено",
"device.removed": "Устройство успешно удалено",
"device.started": "Обработка запущена",
"device.stopped": "Обработка остановлена",
"settings.title": "Настройки Устройства",
"settings.brightness": "Яркость:",
"settings.brightness.hint": "Общая яркость для этого WLED устройства (0-100%)",
"settings.url.hint": "IP адрес или имя хоста вашего WLED устройства",
"settings.button.cancel": "Отмена",
"settings.button.save": "Сохранить Изменения",
"settings.saved": "Настройки успешно сохранены",
"settings.failed": "Не удалось сохранить настройки",
"calibration.title": "Калибровка Светодиодов",
"calibration.description": "Настройте как ваша светодиодная лента сопоставляется с краями экрана. Используйте кнопки тестирования чтобы проверить что каждый край светится правильно.",
"calibration.preview.screen": "Экран",
"calibration.preview.top": "Сверху:",
"calibration.preview.right": "Справа:",
"calibration.preview.bottom": "Снизу:",
"calibration.preview.left": "Слева:",
"calibration.preview.leds": "Светодиодов",
"calibration.start_position": "Начальная Позиция:",
"calibration.position.bottom_left": "Нижний Левый",
"calibration.position.bottom_right": "Нижний Правый",
"calibration.position.top_left": "Верхний Левый",
"calibration.position.top_right": "Верхний Правый",
"calibration.direction": "Направление:",
"calibration.direction.clockwise": "По Часовой Стрелке",
"calibration.direction.counterclockwise": "Против Часовой Стрелки",
"calibration.leds.top": "Светодиодов Сверху:",
"calibration.leds.right": "Светодиодов Справа:",
"calibration.leds.bottom": "Светодиодов Снизу:",
"calibration.leds.left": "Светодиодов Слева:",
"calibration.total": "Всего Светодиодов:",
"calibration.test": "Тест Краев (подсвечивает каждый край):",
"calibration.test.top": "Сверху",
"calibration.test.right": "Справа",
"calibration.test.bottom": "Снизу",
"calibration.test.left": "Слева",
"calibration.button.cancel": "Отмена",
"calibration.button.save": "Сохранить Калибровку",
"calibration.saved": "Калибровка успешно сохранена",
"calibration.failed": "Не удалось сохранить калибровку",
"calibration.testing": "Тестирование {edge} края...",
"server.healthy": "Сервер онлайн",
"server.offline": "Сервер офлайн",
"error.unauthorized": "Не авторизован - пожалуйста, войдите",
"error.network": "Сетевая ошибка",
"error.unknown": "Произошла ошибка"
}