Files
nebuleair_pro_4g/html/topbar.html
PaulVua 163d60bf34 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>
2026-01-05 18:10:06 +01:00

25 lines
1.2 KiB
HTML
Executable File

<!-- Topbar -->
<nav class="navbar navbar-dark fixed-top" style="background-color: #8d8d8f;" id="topbar">
<div class="container-fluid">
<a class="navbar-brand" href="#">
<img src="assets/img/LogoNebuleAir.png" alt="Logo" height="30" class="d-inline-block align-text-top">
</a>
<div class="d-flex">
<button class="btn btn-outline-light d-md-none me-2" type="button" data-bs-toggle="offcanvas" data-bs-target="#sidebarOffcanvas" aria-controls="sidebarOffcanvas" aria-label="Toggle Sidebar"></button>
<!-- Centered text -->
<!--
<span id="pageTitle_plus_ID" class="position-absolute top-50 start-50 translate-middle">Texte au milieu</span>
-->
<!-- Language Switcher -->
<select class="form-select form-select-sm me-2" id="languageSwitcher" style="width: auto; background-color: transparent; color: white; border-color: white;" onchange="i18n.setLanguage(this.value)">
<option value="fr">🇫🇷 FR</option>
<option value="en">🇬🇧 EN</option>
</select>
<button type="button" class="btn btn-outline-light" id="RTC_time">loading...</button>
</div>
</div>
</nav>