refactor(i18n): move translations to JSON locale files
- Extract 1149 translation keys from i18n.py into locales/ru.json and locales/en.json - Rewrite i18n.py as a lightweight JSON loader (5287 → 128 lines) - Add I18nService.reload() for runtime hot-reload without restart - Add I18nService.available_languages() to list loaded language codes - Public API unchanged: t(), get(), get_all(), add_translation() - New languages require only a new *.json file in locales/ — no code changes Bump version: 1.1.6 → 1.1.7
This commit is contained in:
12
CHANGELOG.md
12
CHANGELOG.md
@@ -4,6 +4,18 @@ All notable changes to PVEmanager will be documented in this file.
|
||||
|
||||
---
|
||||
|
||||
## [v1.1.7] - 2026-03-16
|
||||
|
||||
### 🌍 i18n — Translation Files Refactored
|
||||
|
||||
- **Translations moved to JSON locale files** — all 1 149 translation keys extracted from the Python source into `backend/app/locales/ru.json` and `backend/app/locales/en.json`
|
||||
- **`i18n.py` reduced from 5 287 → 128 lines** — now a lightweight JSON loader with lazy initialisation; zero changes to the public API (`t()`, `I18nService.get()`, `.get_all()`, `.add_translation()`)
|
||||
- **Adding a new language requires no code changes** — drop a `xx.json` file into `backend/app/locales/` and it is picked up automatically on next startup
|
||||
- **`I18nService.reload()`** — new method that reloads all locale files at runtime without a container restart; useful for live translation editing
|
||||
- **`I18nService.available_languages()`** — returns the list of language codes currently loaded from disk
|
||||
|
||||
---
|
||||
|
||||
## [v1.1.6] - 2026-03-16
|
||||
|
||||
### 🖥️ LXC Terminal — xterm.js Console Fixed
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
**Modern web panel for managing Proxmox servers, virtual machines and LXC containers**
|
||||
|
||||
[](CHANGELOG.md)
|
||||
[](CHANGELOG.md)
|
||||
[](LICENSE)
|
||||
[](compose.yml)
|
||||
[](backend/)
|
||||
|
||||
22
WIKI.md
22
WIKI.md
@@ -1,6 +1,6 @@
|
||||
# 📖 PVEmanager - Documentation
|
||||
|
||||
> Complete guide for installation, configuration and usage of PVEmanager v1.1.6
|
||||
> Complete guide for installation, configuration and usage of PVEmanager v1.1.7
|
||||
|
||||
---
|
||||
|
||||
@@ -1191,17 +1191,21 @@ Access via **Settings → Security**:
|
||||
|
||||
### Adding New Language
|
||||
|
||||
1. Open `backend/app/i18n.py`
|
||||
2. Add translation for each key:
|
||||
Translations are stored as flat JSON files in `backend/app/locales/`.
|
||||
To add a new language, simply create a new file — no code changes required:
|
||||
|
||||
```python
|
||||
"key_name": {
|
||||
"ru": "Russian text",
|
||||
"en": "English text",
|
||||
"uz": "O'zbek matni" # New language
|
||||
}
|
||||
```bash
|
||||
# Create a new locale file for Uzbek
|
||||
cp backend/app/locales/en.json backend/app/locales/uz.json
|
||||
# Then translate the values in uz.json
|
||||
```
|
||||
|
||||
The file name becomes the language code (`uz.json` → `"uz"`). The panel picks
|
||||
it up automatically on next startup (or call `I18nService.reload()` at runtime).
|
||||
|
||||
> **Structure:** each file is a flat `{"key": "translated string"}` JSON object.
|
||||
> Keys must match the existing keys in `ru.json` / `en.json`.
|
||||
|
||||
---
|
||||
|
||||
## ⚙️ Settings
|
||||
|
||||
5343
backend/app/i18n.py
5343
backend/app/i18n.py
File diff suppressed because it is too large
Load Diff
1151
backend/app/locales/en.json
Normal file
1151
backend/app/locales/en.json
Normal file
File diff suppressed because it is too large
Load Diff
1151
backend/app/locales/ru.json
Normal file
1151
backend/app/locales/ru.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user