0.4.0: interfaccia in italiano e inglese, scelta nelle impostazioni

L'inglese è la lingua sorgente delle stringhe; l'italiano sta nel catalogo
translations/harbour-aira-it.ts (99 stringhe), che lupdate aggiorna e lrelease
compila in build. Di serie la lingua del sistema, con ripiego sull'inglese.

- nuova classe Translator: risolve la lingua prima di createView e allinea
  QLocale::setDefault, così anche i numeri seguono la lingua (23,0 °C in
  italiano, 23.0 °C in inglese) — le temperature passano da formatValue, non
  più dal toFixed() di JavaScript che metteva sempre il punto
- Qt 5.6 non ha QQmlEngine::retranslate(): al cambio di lingua la radice QML
  viene ricaricata (setSource ricrea il componente anche a url invariata)
- le etichette di stato in airajson.cpp usano QCoreApplication::translate per
  esteso: lupdate non riconosce una funzione wrapper e le avrebbe perse
- selettore della lingua in Impostazioni (Sistema / English / Italiano)
- test: 41/41, carica il .qm vero come fa main.cpp e verifica entrambe le
  lingue, il ripiego e i formati numerici
- anteprime bilingui (docs/anteprima/ inglese, it/ italiano), README e PIANO
  aggiornati, spec RPM con i cataloghi in %files
This commit is contained in:
Carlo
2026-10-10 08:19:20 +02:00
parent e0dcf1f830
commit fddd21e16a
29 changed files with 1230 additions and 190 deletions
+24 -6
View File
@@ -21,13 +21,18 @@ status, domestic hot water, and the house target temperature per zone.
- **Cover page** showing the house temperature
- Address and bridge token live in the app settings (QSettings), never in the
binary
- **Languages: English and Italian.** The interface follows the phone language by
default and falls back to English when there is no catalogue for it. The
language can also be picked in the settings; the app reloads to apply it, and
numbers follow the chosen language too (decimal comma in Italian, dot in
English)
Layout previews (rendered with the real values the plant returned, **not**
screenshots — see *Status*):
| Home | Other commands | Cover |
|---|---|---|
| ![home](docs/anteprima/dashboard.png) | ![commands](docs/anteprima/comandi.png) | ![cover](docs/anteprima/copertina.png) |
| Home | Other commands | Settings | Cover |
|---|---|---|---|
| ![home](docs/anteprima/dashboard.png) | ![commands](docs/anteprima/comandi.png) | ![settings](docs/anteprima/impostazioni.png) | ![cover](docs/anteprima/copertina.png) |
## Why there is a bridge
@@ -107,10 +112,15 @@ parsing, mode labels, command payloads, error messages.
Verified so far:
- **31/31** core checks (`tests/core_test.cpp`), compiled with no warnings
- **39/39** core checks (`tests/core_test.cpp`), compiled with no warnings
- **27/27** bridge checks, offline (`bridge/test_bridge_commands.py`) —
including that a zone command always carries every zone, and that absurd
values are refused (40 °C, zone 3, text)
- **99/99** strings translated in the Italian catalogue, checked by loading the
compiled `.qm` in the test the same way `main.cpp` does: source English in,
Italian out, and back to English when the catalogue is removed
- numbers formatted through `QLocale`, so the decimal separator follows the
language (verified for both)
- `qmllint` clean on every QML file. Note it validates syntax only: without the
Silica module an invalid Silica property passes silently
- read-only queries against one real Aira Home unit, through the bridge
@@ -120,6 +130,12 @@ Not verified: **the app has not been built or run on a phone yet** — the first
build is up to whoever has the Sailfish SDK. The images in `docs/anteprima/` are
layout previews built from the real plant values, not screenshots.
A Qt 5.6 note on the language switch: `QQmlEngine::retranslate()` only exists
from Qt 5.10, so installing a translator is not enough to re-translate what is
already on screen. The app therefore reloads the QML root when the language
changes: the setting applies immediately, at the cost of landing back on the home
page.
Caveats:
- **Unofficial client**, not in the Jolla Store: it talks to Aira's API with
@@ -152,7 +168,8 @@ harbour-aira.pro qmake project (icons, qml, docs)
src/airajson.{h,cpp} pure logic, testable without the SDK
src/apiclient.{h,cpp} QNetworkAccessManager + timeout watchdog
src/settings.{h,cpp} QSettings in AppConfigLocation (SailJail sandbox)
src/main.cpp context properties: appSettings, api
src/translator.{h,cpp} UI language: system locale, English fallback, reload
src/main.cpp context properties: appSettings, api, translator
qml/harbour-aira.qml ApplicationWindow + cover
qml/pages/MainPage.qml dashboard and water/heating commands
qml/pages/CommandsPage.qml the other commands, current state on top
@@ -161,9 +178,10 @@ qml/components/InfoRow.qml
qml/components/ActionButton.qml command button, optional confirmation
tests/core_test.cpp core checks (headless)
bridge/ local HTTP bridge -> see bridge/README.md
translations/ harbour-aira-it.ts (English is the source language)
docs/PIANO.md project plan and decisions (Italian)
docs/PROTOCOL.md bridge API
docs/anteprima/ layout previews
docs/anteprima/ layout previews (English; docs/anteprima/it/ Italian)
```
## License