Browse Source

Continue the preparation to localization

Add support for localization in the QML's on the Common folder.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
QGC4.4
Tomaz Canabrava 9 years ago
parent
commit
9ac9b3aaea
  1. 52
      src/AutoPilotPlugins/Common/ESP8266Component.qml
  2. 10
      src/AutoPilotPlugins/Common/ESP8266ComponentSummary.qml
  3. 58
      src/AutoPilotPlugins/Common/RadioComponent.qml

52
src/AutoPilotPlugins/Common/ESP8266Component.qml

@ -42,7 +42,7 @@ QGCView {
property int _firstColumn: ScreenTools.defaultFontPixelWidth * 20 property int _firstColumn: ScreenTools.defaultFontPixelWidth * 20
property int _secondColumn: ScreenTools.defaultFontPixelWidth * 12 property int _secondColumn: ScreenTools.defaultFontPixelWidth * 12
readonly property string dialogTitle: "controller WiFi Bridge" readonly property string dialogTitle: qsTr("controller WiFi Bridge")
property int stStatus: XMLHttpRequest.UNSENT property int stStatus: XMLHttpRequest.UNSENT
property int stErrorCount: 0 property int stErrorCount: 0
property bool stEnabled: false property bool stEnabled: false
@ -75,7 +75,7 @@ QGCView {
if (stStatus === XMLHttpRequest.DONE) { if (stStatus === XMLHttpRequest.DONE) {
var objectArray = JSON.parse(req.responseText); var objectArray = JSON.parse(req.responseText);
if (objectArray.errors !== undefined) { if (objectArray.errors !== undefined) {
console.log("Error fetching WiFi Bridge Status: " + objectArray.errors[0].message) console.log(qsTr("Error fetching WiFi Bridge Status: %1").arg(objectArray.errors[0].message))
stErrorCount = stErrorCount + 1 stErrorCount = stErrorCount + 1
if(stErrorCount < 2 && stEnabled) if(stErrorCount < 2 && stEnabled)
timer.start() timer.start()
@ -129,7 +129,7 @@ QGCView {
spacing: ScreenTools.defaultFontPixelHeight * 0.5 spacing: ScreenTools.defaultFontPixelHeight * 0.5
QGCLabel { QGCLabel {
text: "WiFi Bridge Settings" text: qsTr("WiFi Bridge Settings")
font.weight: Font.DemiBold font.weight: Font.DemiBold
} }
@ -152,7 +152,7 @@ QGCView {
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
text: "WiFi Channel" text: qsTr("WiFi Channel")
width: _firstColumn width: _firstColumn
anchors.baseline: channelField.baseline anchors.baseline: channelField.baseline
} }
@ -169,7 +169,7 @@ QGCView {
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
text: "WiFi SSID" text: qsTr("WiFi SSID")
width: _firstColumn width: _firstColumn
anchors.baseline: ssidField.baseline anchors.baseline: ssidField.baseline
} }
@ -186,7 +186,7 @@ QGCView {
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
text: "WiFi Password" text: qsTr("WiFi Password")
width: _firstColumn width: _firstColumn
anchors.baseline: passwordField.baseline anchors.baseline: passwordField.baseline
} }
@ -203,7 +203,7 @@ QGCView {
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
text: "UART Baud Rate" text: qsTr("UART Baud Rate")
width: _firstColumn width: _firstColumn
anchors.baseline: baudField.baseline anchors.baseline: baudField.baseline
} }
@ -220,7 +220,7 @@ QGCView {
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
text: "QGC UDP Port" text: qsTr("QGC UDP Port")
width: _firstColumn width: _firstColumn
anchors.baseline: qgcportField.baseline anchors.baseline: qgcportField.baseline
} }
@ -248,13 +248,13 @@ QGCView {
spacing: ScreenTools.defaultFontPixelHeight / 2 spacing: ScreenTools.defaultFontPixelHeight / 2
visible: false visible: false
QGCLabel { QGCLabel {
text: "Bridge/Vehicle Link" text: qsTr("Bridge/Vehicle Link")
font.weight: Font.DemiBold font.weight: Font.DemiBold
} }
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
text: "Messages Received" text: qsTr("Messages Received")
width: _firstColumn width: _firstColumn
} }
QGCLabel { QGCLabel {
@ -264,7 +264,7 @@ QGCView {
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
text: "Messages Lost" text: qsTr("Messages Lost")
width: _firstColumn width: _firstColumn
} }
QGCLabel { QGCLabel {
@ -274,7 +274,7 @@ QGCView {
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
text: "Messages Sent" text: qsTr("Messages Sent")
width: _firstColumn width: _firstColumn
} }
QGCLabel { QGCLabel {
@ -287,13 +287,13 @@ QGCView {
color: palette.text color: palette.text
} }
QGCLabel { QGCLabel {
text: "Bridge/QGC Link" text: qsTr("Bridge/QGC Link")
font.weight: Font.DemiBold font.weight: Font.DemiBold
} }
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
text: "Messages Received" text: qsTr("Messages Received")
width: _firstColumn width: _firstColumn
} }
QGCLabel { QGCLabel {
@ -303,7 +303,7 @@ QGCView {
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
text: "Messages Lost" text: qsTr("Messages Lost")
width: _firstColumn width: _firstColumn
} }
QGCLabel { QGCLabel {
@ -313,7 +313,7 @@ QGCView {
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
text: "Messages Sent" text: qsTr("Messages Sent")
width: _firstColumn width: _firstColumn
} }
QGCLabel { QGCLabel {
@ -326,13 +326,13 @@ QGCView {
color: palette.text color: palette.text
} }
QGCLabel { QGCLabel {
text: "QGC/Bridge Link" text: qsTr("QGC/Bridge Link")
font.weight: Font.DemiBold font.weight: Font.DemiBold
} }
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
text: "Messages Received" text: qsTr("Messages Received")
width: _firstColumn width: _firstColumn
} }
QGCLabel { QGCLabel {
@ -342,7 +342,7 @@ QGCView {
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
text: "Messages Lost" text: qsTr("Messages Lost")
width: _firstColumn width: _firstColumn
} }
QGCLabel { QGCLabel {
@ -352,7 +352,7 @@ QGCView {
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
text: "Messages Sent" text: qsTr("Messages Sent")
width: _firstColumn width: _firstColumn
} }
QGCLabel { QGCLabel {
@ -365,14 +365,14 @@ QGCView {
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth * 1.5 spacing: ScreenTools.defaultFontPixelWidth * 1.5
QGCButton { QGCButton {
text: "Restore Defaults" text: qsTr("Restore Defaults")
width: ScreenTools.defaultFontPixelWidth * 16 width: ScreenTools.defaultFontPixelWidth * 16
onClicked: { onClicked: {
controller.restoreDefaults() controller.restoreDefaults()
} }
} }
QGCButton { QGCButton {
text: "Restart WiFi Bridge" text: qsTr("Restart WiFi Bridge")
enabled: !controller.busy enabled: !controller.busy
width: ScreenTools.defaultFontPixelWidth * 16 width: ScreenTools.defaultFontPixelWidth * 16
onClicked: { onClicked: {
@ -383,8 +383,8 @@ QGCView {
visible: false visible: false
icon: StandardIcon.Warning icon: StandardIcon.Warning
standardButtons: StandardButton.Yes | StandardButton.No standardButtons: StandardButton.Yes | StandardButton.No
title: "Reboot WiFi Bridge" title: qsTr("Reboot WiFi Bridge")
text: "This will restart the WiFi Bridge so the settings you've changed can take effect. Note that you may have to change your computer WiFi settings and QGroundControl link settings to match these changes. Are you sure you want to restart it?" text: qsTr("This will restart the WiFi Bridge so the settings you've changed can take effect. Note that you may have to change your computer WiFi settings and QGroundControl link settings to match these changes. Are you sure you want to restart it?")
onYes: { onYes: {
controller.reboot() controller.reboot()
rebootDialog.visible = false rebootDialog.visible = false
@ -395,7 +395,7 @@ QGCView {
} }
} }
QGCButton { QGCButton {
text: stEnabled ? "Hide Status" : "Show Status" text: stEnabled ? qsTr("Hide Status") : qsTr("Show Status")
width: ScreenTools.defaultFontPixelWidth * 16 width: ScreenTools.defaultFontPixelWidth * 16
onClicked: { onClicked: {
stEnabled = !stEnabled stEnabled = !stEnabled
@ -408,7 +408,7 @@ QGCView {
} }
} }
QGCButton { QGCButton {
text: "Reset Counters" text: qsTr("Reset Counters")
visible: stEnabled visible: stEnabled
enabled: stEnabled enabled: stEnabled
width: ScreenTools.defaultFontPixelWidth * 16 width: ScreenTools.defaultFontPixelWidth * 16

10
src/AutoPilotPlugins/Common/ESP8266ComponentSummary.qml

@ -30,23 +30,23 @@ FactPanel {
anchors.fill: parent anchors.fill: parent
anchors.margins: 8 anchors.margins: 8
VehicleSummaryRow { VehicleSummaryRow {
labelText: "Firmware Version:" labelText: qsTr("Firmware Version:")
valueText: esp8266.version valueText: esp8266.version
} }
VehicleSummaryRow { VehicleSummaryRow {
labelText: "WiFi Channel:" labelText: qsTr("WiFi Channel:")
valueText: wifiChannel ? wifiChannel.valueString : "" valueText: wifiChannel ? wifiChannel.valueString : ""
} }
VehicleSummaryRow { VehicleSummaryRow {
labelText: "WiFi SSID:" labelText: qsTr("WiFi SSID:")
valueText: esp8266.wifiSSID valueText: esp8266.wifiSSID
} }
VehicleSummaryRow { VehicleSummaryRow {
labelText: "WiFi Password:" labelText: qsTr("WiFi Password:")
valueText: esp8266.wifiPassword valueText: esp8266.wifiPassword
} }
VehicleSummaryRow { VehicleSummaryRow {
labelText: "UART Baud Rate:" labelText: qsTr("UART Baud Rate:")
valueText: uartBaud ? uartBaud.valueString : "" valueText: uartBaud ? uartBaud.valueString : ""
} }
} }

58
src/AutoPilotPlugins/Common/RadioComponent.qml

@ -39,7 +39,7 @@ QGCView {
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled } QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
readonly property string dialogTitle: "Radio" readonly property string dialogTitle: qsTr("Radio")
readonly property real labelToMonitorMargin: defaultTextWidth * 3 readonly property real labelToMonitorMargin: defaultTextWidth * 3
property bool controllerCompleted: false property bool controllerCompleted: false
@ -76,7 +76,7 @@ QGCView {
} }
onChannelCountChanged: updateChannelCount() onChannelCountChanged: updateChannelCount()
onFunctionMappingChangedAPMReboot: showMessage("Reboot required", "Your stick mappings have changed, you must reboot the vehicle for correct operation.", StandardButton.Ok) onFunctionMappingChangedAPMReboot: showMessage(qsTr("Reboot required"), qsTr("Your stick mappings have changed, you must reboot the vehicle for correct operation."), StandardButton.Ok)
} }
onCompleted: { onCompleted: {
@ -95,7 +95,7 @@ QGCView {
id: copyTrimsDialogComponent id: copyTrimsDialogComponent
QGCViewMessage { QGCViewMessage {
message: "Center your sticks and move throttle all the way down, then press Ok to copy trims. After pressing Ok, reset the trims on your radio back to zero." message: qsTr("Center your sticks and move throttle all the way down, then press Ok to copy trims. After pressing Ok, reset the trims on your radio back to zero.")
function accept() { function accept() {
hideDialog() hideDialog()
@ -108,8 +108,8 @@ QGCView {
id: zeroTrimsDialogComponent id: zeroTrimsDialogComponent
QGCViewMessage { QGCViewMessage {
message: "Before calibrating you should zero all your trims and subtrims. Click Ok to start Calibration.\n\n" + message: qsTr("Before calibrating you should zero all your trims and subtrims. Click Ok to start Calibration.\n\n%1").arg(
(QGroundControl.multiVehicleManager.activeVehicle.px4Firmware ? "" : "Please ensure all motor power is disconnected AND all props are removed from the vehicle.") (QGroundControl.multiVehicleManager.activeVehicle.px4Firmware ? "" : qsTr("Please ensure all motor power is disconnected AND all props are removed from the vehicle.")))
function accept() { function accept() {
hideDialog() hideDialog()
@ -122,7 +122,7 @@ QGCView {
id: channelCountDialogComponent id: channelCountDialogComponent
QGCViewMessage { QGCViewMessage {
message: controller.channelCount == 0 ? "Please turn on transmitter." : controller.minChannelCount + " channels or more are needed to fly." message: controller.channelCount == 0 ? qsTr("Please turn on transmitter.") : qsTr("%1 channels or more are needed to fly.").arg(controller.minChannelCount)
} }
} }
@ -147,21 +147,21 @@ QGCView {
QGCLabel { QGCLabel {
width: parent.width width: parent.width
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: "Click Ok to place your Spektrum receiver in the bind mode. Select the specific receiver type below:" text: qsTr("Click Ok to place your Spektrum receiver in the bind mode. Select the specific receiver type below:")
} }
ExclusiveGroup { id: radioGroup } ExclusiveGroup { id: radioGroup }
QGCRadioButton { QGCRadioButton {
exclusiveGroup: radioGroup exclusiveGroup: radioGroup
text: "DSM2 Mode" text: qsTr("DSM2 Mode")
property int bindMode: RadioComponentController.DSM2 property int bindMode: RadioComponentController.DSM2
} }
QGCRadioButton { QGCRadioButton {
exclusiveGroup: radioGroup exclusiveGroup: radioGroup
text: "DSMX (7 channels or less)" text: qsTr("DSMX (7 channels or less)")
property int bindMode: RadioComponentController.DSMX7 property int bindMode: RadioComponentController.DSMX7
} }
@ -169,7 +169,7 @@ QGCView {
QGCRadioButton { QGCRadioButton {
exclusiveGroup: radioGroup exclusiveGroup: radioGroup
checked: true checked: true
text: "DSMX (8 channels or more)" text: qsTr("DSMX (8 channels or more)")
property int bindMode: RadioComponentController.DSMX8 property int bindMode: RadioComponentController.DSMX8
} }
@ -221,7 +221,7 @@ QGCView {
anchors.fill: parent anchors.fill: parent
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
text: "Not Mapped" text: qsTr("Not Mapped")
visible: !mapped visible: !mapped
} }
@ -270,17 +270,15 @@ QGCView {
Column { Column {
width: parent.width width: parent.width
spacing: 5 spacing: 5
QGCLabel { text: qsTr("Attitude Controls") }
QGCLabel { text: "Attitude Controls" }
Item { Item {
width: parent.width width: parent.width
height: defaultTextHeight * 2 height: defaultTextHeight * 2
QGCLabel { QGCLabel {
id: rollLabel id: rollLabel
width: defaultTextWidth * 10 width: defaultTextWidth * 10
text: "Roll" text: qsTr("Roll")
} }
Loader { Loader {
@ -310,7 +308,7 @@ QGCView {
QGCLabel { QGCLabel {
id: pitchLabel id: pitchLabel
width: defaultTextWidth * 10 width: defaultTextWidth * 10
text: "Pitch" text: qsTr("Pitch")
} }
Loader { Loader {
@ -340,7 +338,7 @@ QGCView {
QGCLabel { QGCLabel {
id: yawLabel id: yawLabel
width: defaultTextWidth * 10 width: defaultTextWidth * 10
text: "Yaw" text: qsTr("Yaw")
} }
Loader { Loader {
@ -370,7 +368,7 @@ QGCView {
QGCLabel { QGCLabel {
id: throttleLabel id: throttleLabel
width: defaultTextWidth * 10 width: defaultTextWidth * 10
text: "Throttle" text: qsTr("Throttle")
} }
Loader { Loader {
@ -400,14 +398,14 @@ QGCView {
QGCButton { QGCButton {
id: skipButton id: skipButton
text: "Skip" text: qsTr("Skip")
onClicked: controller.skipButtonClicked() onClicked: controller.skipButtonClicked()
} }
QGCButton { QGCButton {
id: cancelButton id: cancelButton
text: "Cancel" text: qsTr("Cancel")
onClicked: controller.cancelButtonClicked() onClicked: controller.cancelButtonClicked()
} }
@ -415,10 +413,10 @@ QGCView {
QGCButton { QGCButton {
id: nextButton id: nextButton
primary: true primary: true
text: "Calibrate" text: qsTr("Calibrate")
onClicked: { onClicked: {
if (text == "Calibrate") { if (text == qsTr("Calibrate")) {
showDialog(zeroTrimsDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel) showDialog(zeroTrimsDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel)
} else { } else {
controller.nextButtonClicked() controller.nextButtonClicked()
@ -446,26 +444,26 @@ QGCView {
border.width: 1 border.width: 1
} }
QGCLabel { text: "Additional Radio setup:" } QGCLabel { text: qsTr("Additional Radio setup:") }
Row { Row {
spacing: 10 spacing: 10
QGCLabel { QGCLabel {
anchors.baseline: bindButton.baseline anchors.baseline: bindButton.baseline
text: "Place Spektrum satellite receiver in bind mode:" text: qsTr("Place Spektrum satellite receiver in bind mode:")
} }
QGCButton { QGCButton {
id: bindButton id: bindButton
text: "Spektrum Bind" text: qsTr("Spektrum Bind")
onClicked: showDialog(spektrumBindDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel) onClicked: showDialog(spektrumBindDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel)
} }
} }
QGCButton { QGCButton {
text: "Copy Trims" text: qsTr("Copy Trims")
visible: QGroundControl.multiVehicleManager.activeVehicle.px4Firmware visible: QGroundControl.multiVehicleManager.activeVehicle.px4Firmware
onClicked: showDialog(copyTrimsDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel) onClicked: showDialog(copyTrimsDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel)
} }
@ -475,7 +473,6 @@ QGCView {
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
property Fact fact: controller.getParameterFact(-1, modelData) property Fact fact: controller.getParameterFact(-1, modelData)
QGCLabel { QGCLabel {
@ -510,10 +507,9 @@ QGCView {
Row { Row {
spacing: 10 spacing: 10
ExclusiveGroup { id: modeGroup } ExclusiveGroup { id: modeGroup }
QGCRadioButton { QGCRadioButton {
exclusiveGroup: modeGroup exclusiveGroup: modeGroup
text: "Mode 1" text: qsTr("Mode 1")
checked: controller.transmitterMode == 1 checked: controller.transmitterMode == 1
onClicked: controller.transmitterMode = 1 onClicked: controller.transmitterMode = 1
@ -521,7 +517,7 @@ QGCView {
QGCRadioButton { QGCRadioButton {
exclusiveGroup: modeGroup exclusiveGroup: modeGroup
text: "Mode 2" text: qsTr("Mode 2")
checked: controller.transmitterMode == 2 checked: controller.transmitterMode == 2
onClicked: controller.transmitterMode = 2 onClicked: controller.transmitterMode = 2
@ -541,7 +537,7 @@ QGCView {
width: parent.width width: parent.width
spacing: 5 spacing: 5
QGCLabel { text: "Channel Monitor" } QGCLabel { text: qsTr("Channel Monitor") }
Connections { Connections {
target: controller target: controller

Loading…
Cancel
Save