diff --git a/CLAUDE.md b/CLAUDE.md index 785507d..51be7e7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -34,6 +34,43 @@ The API token is generated on first run and displayed in the console output. Default port: `8765` +## Internationalization (i18n) + +The Web UI supports multiple languages with translations stored in separate JSON files. + +### Locale Files + +Translation files are located in: +- `media_server/static/locales/en.json` - English (default) +- `media_server/static/locales/ru.json` - Russian + +### Maintaining Translations + +**IMPORTANT:** When adding or modifying user-facing text in the Web UI: + +1. **Update all locale files** - Add or update the translation key in **both** `en.json` and `ru.json` +2. **Use consistent keys** - Follow the existing key naming pattern (e.g., `section.element`, `scripts.button.save`) +3. **Test both locales** - Verify translations appear correctly by switching between EN/RU + +### Adding New Text + +When adding new UI elements: + +1. Add the English text to `static/locales/en.json` +2. Add the Russian translation to `static/locales/ru.json` +3. In HTML: use `data-i18n="key.name"` for text content +4. In HTML: use `data-i18n-placeholder="key.name"` for input placeholders +5. In HTML: use `data-i18n-title="key.name"` for title attributes +6. In JavaScript: use `t('key.name')` or `t('key.name', {param: value})` for dynamic text + +### Adding New Locales + +To add support for a new language: + +1. Create `media_server/static/locales/{lang_code}.json` (copy from `en.json`) +2. Translate all strings to the new language +3. Add the language code to `supportedLocales` array in `index.html` + ## Versioning Version is tracked in two files that must be kept in sync: diff --git a/media_server/static/index.html b/media_server/static/index.html index 6103c3a..6cae0e1 100644 --- a/media_server/static/index.html +++ b/media_server/static/index.html @@ -108,6 +108,24 @@ fill: var(--text-primary); } + #locale-toggle { + background: none; + border: 2px solid var(--text-secondary); + color: var(--text-primary); + border-radius: 6px; + padding: 6px 12px; + cursor: pointer; + font-size: 14px; + font-weight: bold; + transition: all 0.3s ease; + } + + #locale-toggle:hover { + border-color: var(--accent); + color: var(--accent); + transform: scale(1.05); + } + .player-container { background: var(--bg-secondary); border-radius: 12px; @@ -743,17 +761,17 @@
- +Enter your API token to connect to the media server.
- - +Enter your API token to connect to the media server.
+ +To get your token, run:
+To get your token, run:
media-server --show-token
| Name | -Label | -Command | -Timeout | -Actions | +Name | +Label | +Command | +Timeout | +Actions |
|---|---|---|---|---|---|---|---|---|---|
| No scripts configured. Click "Add Script" to create one. | +No scripts configured. Click "Add" to create one. | ||||||||
- Callbacks are scripts triggered automatically by media control events (play, pause, volume, etc.) +
+ Callbacks are scripts triggered automatically by media control events (play, pause, stop, etc.)
| Event | -Command | -Timeout | -Actions | +Event | +Command | +Timeout | +Actions |
|---|