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
+30 -30
View File
@@ -17,7 +17,7 @@ Page {
}
function flag(key) {
return page.raw(key) ? qsTr("sì") : qsTr("no")
return page.raw(key) ? qsTr("yes") : qsTr("no")
}
function stato(key) {
@@ -51,7 +51,7 @@ Page {
width: parent.width
spacing: Theme.paddingSmall
PageHeader { title: qsTr("Altri comandi") }
PageHeader { title: qsTr("Other commands") }
Label {
visible: page.notice.length > 0
@@ -64,80 +64,80 @@ Page {
}
// ---- stato attuale -------------------------------------------- //
SectionHeader { text: qsTr("Stato attuale") }
SectionHeader { text: qsTr("Current state") }
InfoRow { label: qsTr("Assenza"); value: page.flag("away_mode") }
InfoRow { label: qsTr("Away mode"); value: page.flag("away_mode") }
InfoRow { label: qsTr("Night mode"); value: page.flag("night_mode") }
InfoRow { label: qsTr("Riscaldamento forzato"); value: page.flag("force_heating") }
InfoRow { label: qsTr("Acqua calda attiva"); value: page.flag("hot_water_heating") }
InfoRow { label: qsTr("Pompa"); value: page.stato("pump_active_state") }
InfoRow { label: qsTr("Modalità consentite"); value: page.stato("configured_modes") }
InfoRow { label: qsTr("Forced heating"); value: page.flag("force_heating") }
InfoRow { label: qsTr("Hot water active"); value: page.flag("hot_water_heating") }
InfoRow { label: qsTr("Pump"); value: page.stato("pump_active_state") }
InfoRow { label: qsTr("Allowed modes"); value: page.stato("configured_modes") }
// ---- assenza --------------------------------------------------- //
SectionHeader { text: qsTr("Assenza") }
SectionHeader { text: qsTr("Away mode") }
ActionButton {
text: qsTr("Attiva assenza")
text: qsTr("Turn away mode on")
onTriggered: api.sendCommand("away_mode_on")
}
ActionButton {
text: qsTr("Disattiva assenza")
text: qsTr("Turn away mode off")
onTriggered: api.sendCommand("away_mode_off")
}
// ---- rumore ---------------------------------------------------- //
SectionHeader { text: qsTr("Rumore") }
SectionHeader { text: qsTr("Noise") }
ActionButton {
text: qsTr("Night mode per un'ora")
text: qsTr("Night mode for one hour")
onTriggered: api.sendCommand("night_mode_1h")
}
// ---- riscaldamento --------------------------------------------- //
SectionHeader { text: qsTr("Riscaldamento") }
SectionHeader { text: qsTr("Heating") }
ActionButton {
text: qsTr("Forza riscaldamento")
confirmText: qsTr("Avvio del riscaldamento forzato")
text: qsTr("Force heating")
confirmText: qsTr("Starting forced heating")
onTriggered: api.sendCommand("force_heating_on")
}
ActionButton {
text: qsTr("Ferma riscaldamento forzato")
text: qsTr("Stop forced heating")
onTriggered: api.sendCommand("force_heating_off")
}
ActionButton {
text: qsTr("Abilita funzione riscaldamento")
text: qsTr("Enable heating function")
onTriggered: api.sendCommand("heating_on")
}
ActionButton {
text: qsTr("Disabilita funzione riscaldamento")
confirmText: qsTr("Il riscaldamento verrà disabilitato")
text: qsTr("Disable heating function")
confirmText: qsTr("Heating will be disabled")
onTriggered: api.sendCommand("heating_off")
}
// ---- acqua calda ----------------------------------------------- //
SectionHeader { text: qsTr("Acqua calda sanitaria") }
SectionHeader { text: qsTr("Domestic hot water") }
ActionButton {
text: qsTr("Ciclo antilegionella")
confirmText: qsTr("Avvio del ciclo antilegionella: richiede tempo")
text: qsTr("Legionella cycle")
confirmText: qsTr("Starting the legionella cycle: it takes a while")
onTriggered: api.sendCommand("legionella_cycle")
}
ActionButton {
text: qsTr("Abilita riscaldamento ACS")
text: qsTr("Enable DHW heating")
onTriggered: api.sendCommand("hot_water_heating_on")
}
ActionButton {
text: qsTr("Disabilita riscaldamento ACS")
confirmText: qsTr("L'acqua calda smetterà di essere riscaldata")
text: qsTr("Disable DHW heating")
confirmText: qsTr("Domestic hot water will stop being heated")
onTriggered: api.sendCommand("hot_water_heating_off")
}
// ---- diagnostica ----------------------------------------------- //
SectionHeader { text: qsTr("Diagnostica") }
SectionHeader { text: qsTr("Diagnostics") }
ActionButton {
text: qsTr("Verifica impianto")
text: qsTr("Plant check")
onTriggered: api.sendCommand("ping")
}
@@ -151,7 +151,7 @@ Page {
Label {
x: Theme.horizontalPageMargin
width: parent.width - 2 * Theme.horizontalPageMargin
text: qsTr("I comandi passano dal bridge e possono richiedere qualche secondo. Dopo l'invio lo stato si aggiorna da solo.")
text: qsTr("Commands go through the bridge and may take a few seconds. The status refreshes by itself afterwards.")
color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeExtraSmall
wrapMode: Text.Wrap
@@ -163,4 +163,4 @@ Page {
if (api.configured)
api.refresh()
}
}
}