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
64 lines
1.9 KiB
QML
64 lines
1.9 KiB
QML
import QtQuick 2.0
|
|
import Sailfish.Silica 1.0
|
|
|
|
// Copertina: legge api.summary (context property C++), quindi non dipende
|
|
// dallo scope delle property della pagina principale.
|
|
CoverBackground {
|
|
id: cover
|
|
|
|
function t(key) {
|
|
var v = api.summary[key]
|
|
return api.formatValue(v)
|
|
}
|
|
|
|
Label {
|
|
id: titleLabel
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
anchors.top: parent.top
|
|
anchors.topMargin: Theme.paddingLarge
|
|
text: "Aira"
|
|
color: Theme.primaryColor
|
|
font.pixelSize: Theme.fontSizeLarge
|
|
}
|
|
|
|
Column {
|
|
anchors.centerIn: parent
|
|
width: parent.width - 2 * Theme.paddingLarge
|
|
spacing: Theme.paddingSmall
|
|
|
|
Label {
|
|
width: parent.width
|
|
horizontalAlignment: Text.AlignHCenter
|
|
text: cover.t("zone1_temperature") + " °C"
|
|
color: Theme.primaryColor
|
|
font.pixelSize: Theme.fontSizeHuge
|
|
}
|
|
|
|
Label {
|
|
width: parent.width
|
|
horizontalAlignment: Text.AlignHCenter
|
|
text: qsTr("house · target %1 °C").arg(cover.t("zone1_setpoint"))
|
|
color: Theme.secondaryColor
|
|
font.pixelSize: Theme.fontSizeExtraSmall
|
|
truncationMode: TruncationMode.Fade
|
|
}
|
|
|
|
Label {
|
|
width: parent.width
|
|
horizontalAlignment: Text.AlignHCenter
|
|
text: qsTr("DHW %1 °C · target %2 °C").arg(cover.t("dhw_current")).arg(cover.t("dhw_target"))
|
|
color: Theme.secondaryColor
|
|
font.pixelSize: Theme.fontSizeExtraSmall
|
|
truncationMode: TruncationMode.Fade
|
|
}
|
|
}
|
|
|
|
Label {
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
anchors.bottom: parent.bottom
|
|
anchors.bottomMargin: Theme.paddingMedium
|
|
text: qsTr("outdoor %1 °C").arg(cover.t("outdoor_temperature"))
|
|
color: Theme.secondaryColor
|
|
font.pixelSize: Theme.fontSizeExtraSmall
|
|
}
|
|
} |