Add internationalization (i18n) support with English and Russian locales

- Add translation JSON files (en.json, ru.json) with 110+ strings each
- Implement locale auto-detection from browser settings
- Add locale toggle button (EN/RU) with localStorage persistence
- Translate all user-facing text: auth, player, scripts, callbacks
- Fix dynamic content translation on locale switch (playback state, track title)
- Add comprehensive i18n documentation to CLAUDE.md
- Follow existing theme toggle pattern for consistency

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-06 04:27:50 +03:00
parent a0af855846
commit 9bbb8e1bd7
4 changed files with 464 additions and 46 deletions

View File

@@ -0,0 +1,109 @@
{
"app.title": "Media Server",
"auth.message": "Enter your API token to connect to the media server.",
"auth.placeholder": "Enter API Token",
"auth.connect": "Connect",
"auth.help": "To get your token, run:",
"auth.logout": "Logout",
"auth.logout.title": "Clear saved token",
"auth.invalid": "Invalid token. Please try again.",
"auth.cleared": "Token cleared. Please enter a new token.",
"auth.required": "Please enter a token",
"player.theme": "Toggle theme",
"player.locale": "Change language",
"player.previous": "Previous",
"player.play": "Play/Pause",
"player.next": "Next",
"player.mute": "Mute",
"player.status.connected": "Connected",
"player.status.disconnected": "Disconnected",
"player.no_media": "No media playing",
"player.source": "Source:",
"player.unknown_source": "Unknown",
"state.playing": "Playing",
"state.paused": "Paused",
"state.stopped": "Stopped",
"state.idle": "Idle",
"scripts.quick_actions": "Quick Actions",
"scripts.no_scripts": "No scripts configured",
"scripts.management": "Script Management",
"scripts.add": "Add",
"scripts.table.name": "Name",
"scripts.table.label": "Label",
"scripts.table.command": "Command",
"scripts.table.timeout": "Timeout",
"scripts.table.actions": "Actions",
"scripts.empty": "No scripts configured. Click 'Add' to create one.",
"scripts.dialog.add": "Add Script",
"scripts.dialog.edit": "Edit Script",
"scripts.field.name": "Script Name *",
"scripts.field.label": "Label",
"scripts.field.command": "Command *",
"scripts.field.description": "Description",
"scripts.field.icon": "Icon (MDI)",
"scripts.field.timeout": "Timeout (seconds)",
"scripts.placeholder.name": "Only letters, numbers, and underscores allowed",
"scripts.placeholder.label": "Human-readable name",
"scripts.placeholder.command": "e.g., shutdown /s /t 0",
"scripts.placeholder.description": "What does this script do?",
"scripts.placeholder.icon": "e.g., mdi:power",
"scripts.button.cancel": "Cancel",
"scripts.button.save": "Save",
"scripts.button.edit": "Edit",
"scripts.button.delete": "Delete",
"scripts.msg.executed": "{name} executed successfully",
"scripts.msg.execute_failed": "Failed to execute {name}",
"scripts.msg.execute_error": "Error executing {name}",
"scripts.msg.created": "Script created successfully",
"scripts.msg.updated": "Script updated successfully",
"scripts.msg.create_failed": "Failed to create script",
"scripts.msg.update_failed": "Failed to update script",
"scripts.msg.deleted": "Script deleted successfully",
"scripts.msg.delete_failed": "Failed to delete script",
"scripts.msg.not_found": "Script not found",
"scripts.msg.load_failed": "Failed to load script details",
"scripts.msg.list_failed": "Failed to load scripts",
"scripts.confirm.delete": "Are you sure you want to delete the script \"{name}\"?",
"callbacks.management": "Callback Management",
"callbacks.description": "Callbacks are scripts triggered automatically by media control events (play, pause, stop, etc.)",
"callbacks.add": "Add",
"callbacks.table.event": "Event",
"callbacks.table.command": "Command",
"callbacks.table.timeout": "Timeout",
"callbacks.table.actions": "Actions",
"callbacks.empty": "No callbacks configured. Click 'Add' to create one.",
"callbacks.dialog.add": "Add Callback",
"callbacks.dialog.edit": "Edit Callback",
"callbacks.field.event": "Event *",
"callbacks.field.command": "Command *",
"callbacks.field.timeout": "Timeout (seconds)",
"callbacks.field.workdir": "Working Directory",
"callbacks.placeholder.event": "Select event...",
"callbacks.placeholder.command": "e.g., shutdown /s /t 0",
"callbacks.placeholder.workdir": "Optional",
"callbacks.button.cancel": "Cancel",
"callbacks.button.save": "Save",
"callbacks.button.edit": "Edit",
"callbacks.button.delete": "Delete",
"callbacks.event.on_play": "on_play - After play succeeds",
"callbacks.event.on_pause": "on_pause - After pause succeeds",
"callbacks.event.on_stop": "on_stop - After stop succeeds",
"callbacks.event.on_next": "on_next - After next track succeeds",
"callbacks.event.on_previous": "on_previous - After previous track succeeds",
"callbacks.event.on_volume": "on_volume - After volume change",
"callbacks.event.on_mute": "on_mute - After mute toggle",
"callbacks.event.on_seek": "on_seek - After seek succeeds",
"callbacks.event.on_turn_on": "on_turn_on - Callback-only action",
"callbacks.event.on_turn_off": "on_turn_off - Callback-only action",
"callbacks.event.on_toggle": "on_toggle - Callback-only action",
"callbacks.msg.created": "Callback created successfully",
"callbacks.msg.updated": "Callback updated successfully",
"callbacks.msg.create_failed": "Failed to create callback",
"callbacks.msg.update_failed": "Failed to update callback",
"callbacks.msg.deleted": "Callback deleted successfully",
"callbacks.msg.delete_failed": "Failed to delete callback",
"callbacks.msg.not_found": "Callback not found",
"callbacks.msg.load_failed": "Failed to load callback details",
"callbacks.msg.list_failed": "Failed to load callbacks",
"callbacks.confirm.delete": "Are you sure you want to delete the callback \"{name}\"?"
}