Add internationalization (i18n) support with English and Russian translations
Some checks failed
Validate / validate (push) Failing after 7s
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:
111
server/src/wled_controller/static/locales/en.json
Normal file
111
server/src/wled_controller/static/locales/en.json
Normal file
@@ -0,0 +1,111 @@
|
||||
{
|
||||
"app.title": "WLED Screen Controller",
|
||||
"app.version": "Version:",
|
||||
"theme.toggle": "Toggle theme",
|
||||
"locale.change": "Change language",
|
||||
"auth.login": "Login",
|
||||
"auth.logout": "Logout",
|
||||
"auth.authenticated": "Authenticated",
|
||||
"auth.title": "Login to WLED Controller",
|
||||
"auth.message": "Please enter your API key to authenticate and access the WLED Screen Controller.",
|
||||
"auth.label": "API Key:",
|
||||
"auth.placeholder": "Enter your API key...",
|
||||
"auth.hint": "Your API key will be stored securely in your browser's local storage.",
|
||||
"auth.button.cancel": "Cancel",
|
||||
"auth.button.login": "Login",
|
||||
"auth.error.required": "Please enter an API key",
|
||||
"auth.success": "Logged in successfully!",
|
||||
"auth.logout.confirm": "Are you sure you want to logout?",
|
||||
"auth.logout.success": "Logged out successfully",
|
||||
"auth.please_login": "Please login to view",
|
||||
"displays.title": "Available Displays",
|
||||
"displays.layout": "Display Layout",
|
||||
"displays.information": "Display Information",
|
||||
"displays.legend.primary": "Primary Display",
|
||||
"displays.legend.secondary": "Secondary Display",
|
||||
"displays.badge.primary": "Primary",
|
||||
"displays.badge.secondary": "Secondary",
|
||||
"displays.resolution": "Resolution:",
|
||||
"displays.position": "Position:",
|
||||
"displays.index": "Display Index:",
|
||||
"displays.loading": "Loading displays...",
|
||||
"displays.none": "No displays available",
|
||||
"displays.failed": "Failed to load displays",
|
||||
"devices.title": "WLED Devices",
|
||||
"devices.add": "Add New Device",
|
||||
"devices.loading": "Loading devices...",
|
||||
"devices.none": "No devices configured",
|
||||
"devices.failed": "Failed to load devices",
|
||||
"devices.wled_config": "WLED Configuration:",
|
||||
"devices.wled_note": "Configure your WLED device (effects, segments, color order, power limits, etc.) using the",
|
||||
"devices.wled_link": "official WLED app",
|
||||
"devices.wled_note2": "This controller sends pixel color data and controls brightness per device.",
|
||||
"device.name": "Device Name:",
|
||||
"device.name.placeholder": "Living Room TV",
|
||||
"device.url": "WLED URL:",
|
||||
"device.url.placeholder": "http://192.168.1.100",
|
||||
"device.led_count": "LED Count:",
|
||||
"device.led_count.hint": "Number of LEDs configured in your WLED device",
|
||||
"device.button.add": "Add Device",
|
||||
"device.button.start": "Start",
|
||||
"device.button.stop": "Stop",
|
||||
"device.button.settings": "Settings",
|
||||
"device.button.calibrate": "Calibrate",
|
||||
"device.button.remove": "Remove",
|
||||
"device.status.connected": "Connected",
|
||||
"device.status.disconnected": "Disconnected",
|
||||
"device.status.error": "Error",
|
||||
"device.status.processing": "Processing",
|
||||
"device.status.idle": "Idle",
|
||||
"device.fps": "FPS:",
|
||||
"device.display": "Display:",
|
||||
"device.remove.confirm": "Are you sure you want to remove this device?",
|
||||
"device.added": "Device added successfully",
|
||||
"device.removed": "Device removed successfully",
|
||||
"device.started": "Processing started",
|
||||
"device.stopped": "Processing stopped",
|
||||
"settings.title": "Device Settings",
|
||||
"settings.brightness": "Brightness:",
|
||||
"settings.brightness.hint": "Global brightness for this WLED device (0-100%)",
|
||||
"settings.url.hint": "IP address or hostname of your WLED device",
|
||||
"settings.button.cancel": "Cancel",
|
||||
"settings.button.save": "Save Changes",
|
||||
"settings.saved": "Settings saved successfully",
|
||||
"settings.failed": "Failed to save settings",
|
||||
"calibration.title": "LED Calibration",
|
||||
"calibration.description": "Configure how your LED strip is mapped to screen edges. Use test buttons to verify each edge lights up correctly.",
|
||||
"calibration.preview.screen": "Screen",
|
||||
"calibration.preview.top": "Top:",
|
||||
"calibration.preview.right": "Right:",
|
||||
"calibration.preview.bottom": "Bottom:",
|
||||
"calibration.preview.left": "Left:",
|
||||
"calibration.preview.leds": "LEDs",
|
||||
"calibration.start_position": "Starting Position:",
|
||||
"calibration.position.bottom_left": "Bottom Left",
|
||||
"calibration.position.bottom_right": "Bottom Right",
|
||||
"calibration.position.top_left": "Top Left",
|
||||
"calibration.position.top_right": "Top Right",
|
||||
"calibration.direction": "Direction:",
|
||||
"calibration.direction.clockwise": "Clockwise",
|
||||
"calibration.direction.counterclockwise": "Counterclockwise",
|
||||
"calibration.leds.top": "Top LEDs:",
|
||||
"calibration.leds.right": "Right LEDs:",
|
||||
"calibration.leds.bottom": "Bottom LEDs:",
|
||||
"calibration.leds.left": "Left LEDs:",
|
||||
"calibration.total": "Total LEDs:",
|
||||
"calibration.test": "Test Edges (lights up each edge):",
|
||||
"calibration.test.top": "Top",
|
||||
"calibration.test.right": "Right",
|
||||
"calibration.test.bottom": "Bottom",
|
||||
"calibration.test.left": "Left",
|
||||
"calibration.button.cancel": "Cancel",
|
||||
"calibration.button.save": "Save Calibration",
|
||||
"calibration.saved": "Calibration saved successfully",
|
||||
"calibration.failed": "Failed to save calibration",
|
||||
"calibration.testing": "Testing {edge} edge...",
|
||||
"server.healthy": "Server online",
|
||||
"server.offline": "Server offline",
|
||||
"error.unauthorized": "Unauthorized - please login",
|
||||
"error.network": "Network error",
|
||||
"error.unknown": "An error occurred"
|
||||
}
|
||||
Reference in New Issue
Block a user