Implement lightweight offline i18n system with French/English support

**Core System:**
- Add i18n.js translation library with data-attribute support
- Create translation files (fr.json, en.json) with offline support
- Store language preference in SQLite config_table
- Add backend endpoints for get/set language

**UI Features:**
- Add language switcher dropdown to topbar (🇫🇷 FR / 🇬🇧 EN)
- Auto-sync language selection across all pages
- Support for static HTML and dynamically created elements

**Implementation:**
- Migrate sensors.html as working example
- Add data-i18n attributes to all UI elements
- Support for buttons, inputs, and dynamic content
- Comprehensive README documentation in html/lang/

**Technical Details:**
- Works completely offline (local JSON files)
- No external dependencies
- Database-backed user preference
- Event-based language change notifications
- Automatic translation on page load

Next steps: Gradually migrate other pages (admin, wifi, index, etc.)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
PaulVua
2026-01-05 18:10:06 +01:00
parent 906eaa851d
commit 163d60bf34
8 changed files with 561 additions and 24 deletions

53
html/lang/en.json Normal file
View File

@@ -0,0 +1,53 @@
{
"common": {
"getData": "Get Data",
"loading": "Loading...",
"error": "Error",
"startRecording": "Start recording",
"stopRecording": "Stop recording"
},
"sensors": {
"title": "Measurement Sensors",
"description": "Your NebuleAir sensor is equipped with one or more probes that measure environmental variables. Measurements are automatic, but you can verify their operation here.",
"npm": {
"title": "NextPM",
"description": "Particulate matter sensor.",
"headerUart": "UART Port"
},
"bme280": {
"title": "BME280 Temp/Humidity Sensor",
"description": "Temperature and humidity sensor on I2C port.",
"headerI2c": "I2C Port",
"temp": "Temperature",
"hum": "Humidity",
"press": "Pressure"
},
"noise": {
"title": "Decibel Meter",
"description": "Noise sensor on I2C port.",
"headerI2c": "I2C Port"
},
"envea": {
"title": "Envea Probe",
"description": "Gas sensor."
}
},
"wifi": {
"title": "WIFI Connection",
"description": "WIFI connection is not mandatory but it allows you to perform updates and enable remote control.",
"status": "Status",
"connected": "Connected",
"hotspot": "Hotspot",
"disconnected": "Disconnected",
"scan": "Scan",
"connect": "Connect",
"enterPassword": "Enter password for"
},
"admin": {
"title": "Administration",
"parameters": "Parameters (config)",
"deviceName": "Device Name",
"deviceID": "Device ID",
"modemVersion": "Modem Version"
}
}