From 930dd0f1caeefb74a6b9f18fd89080baa3c97442 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" <[email protected]> Date: Tue, 3 May 2016 18:14:41 +0200 Subject: [PATCH 1/2] A script to find literal texts to be marked for translation in qml To: [email protected]
in perl... Signed-off-by: Robert C. Helling <[email protected]> --- scripts/translationmark.pl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 scripts/translationmark.pl diff --git a/scripts/translationmark.pl b/scripts/translationmark.pl new file mode 100755 index 0000000..b206ed1 --- /dev/null +++ b/scripts/translationmark.pl @@ -0,0 +1,24 @@ +#!/usr/bin/env perl + +# This script expects filenames on the command line and looks up text: tags in qml files and tries to wrap them with qsTr + +foreach $filename (@ARGV) { + next unless $filename =~ /qml$/; + open IN, $filename; + open OUT, ">$filename.bak"; + while (<IN>) { + if (/text:/ && !/qsTr/) { + if (/text:\s+(\"[^\"]*\")\s*$/) { + print OUT "$`text: qsTr($1)$'\n"; + } else { + print OUT ">>>>$_"; + print "$filename: $_"; + } + } else { + print OUT; + } + } + close IN; + close OUT; + system "mv $filename.bak $filename"; +} -- 2.6.4 (Apple Git-63)
From 823c65176d6b9fedd32a144fcb03667841045860 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" <[email protected]> Date: Tue, 3 May 2016 21:24:00 +0200 Subject: [PATCH 2/2] Mark strings in qml files for translation To: [email protected] I did this semi-automatically: I used the script from the previous patch and then did some manual corrections. This marks only title: and text: tags, there might be others Signed-off-by: Robert C. Helling <[email protected]> --- mobile-widgets/qml/About.qml | 10 +++--- mobile-widgets/qml/CloudCredentials.qml | 8 ++--- mobile-widgets/qml/DiveDetails.qml | 6 ++-- mobile-widgets/qml/DiveDetailsEdit.qml | 34 +++++++++--------- mobile-widgets/qml/DiveDetailsView.qml | 28 +++++++-------- mobile-widgets/qml/DiveList.qml | 12 +++---- mobile-widgets/qml/DownloadFromDiveComputer.qml | 30 ++++++++-------- mobile-widgets/qml/GpsList.qml | 12 +++---- mobile-widgets/qml/Log.qml | 4 +-- mobile-widgets/qml/Preferences.qml | 12 +++---- mobile-widgets/qml/StartPage.qml | 4 +-- mobile-widgets/qml/ThemeTest.qml | 30 ++++++++-------- mobile-widgets/qml/main.qml | 46 ++++++++++++------------- 13 files changed, 118 insertions(+), 118 deletions(-) diff --git a/mobile-widgets/qml/About.qml b/mobile-widgets/qml/About.qml index 43e9904..43959c6 100644 --- a/mobile-widgets/qml/About.qml +++ b/mobile-widgets/qml/About.qml @@ -7,7 +7,7 @@ import org.subsurfacedivelog.mobile 1.0 Kirigami.ScrollablePage { id: aboutPage property int pageWidth: aboutPage.width - aboutPage.leftPadding - aboutPage.rightPadding - title: "About Subsurface-mobile" + title: qsTr("About Subsurface-mobile") ColumnLayout { spacing: Kirigami.Units.largeSpacing @@ -16,7 +16,7 @@ Kirigami.ScrollablePage { Kirigami.Heading { - text: "About Subsurface-mobile" + text: qsTr("About Subsurface-mobile") Layout.topMargin: Kirigami.Units.gridUnit Layout.alignment: Qt.AlignHCenter Layout.maximumWidth: pageWidth @@ -33,8 +33,8 @@ Kirigami.ScrollablePage { } Kirigami.Heading { - text: "A mobile version of the free Subsurface divelog software.\n" + - "View your dive logs while on the go." + text: qsTr("A mobile version of the free Subsurface divelog software.\n") + + qsTr("View your dive logs while on the go.") level: 4 Layout.alignment: Qt.AlignHCenter Layout.topMargin: Kirigami.Units.largeSpacing * 3 @@ -45,7 +45,7 @@ Kirigami.ScrollablePage { } Kirigami.Heading { - text: "Version: " + manager.getVersion() + "\n\n© Subsurface developer team\n2011-2016" + text: qsTr("Version: %1\n\n© Subsurface developer team\n2011-2016").arg(manager.getVersion()) level: 5 font.pointSize: subsurfaceTheme.smallPointSize + 1 Layout.alignment: Qt.AlignHCenter diff --git a/mobile-widgets/qml/CloudCredentials.qml b/mobile-widgets/qml/CloudCredentials.qml index 2bb42a6..1222dbb 100644 --- a/mobile-widgets/qml/CloudCredentials.qml +++ b/mobile-widgets/qml/CloudCredentials.qml @@ -46,13 +46,13 @@ Item { } Kirigami.Heading { - text: "Cloud credentials" + text: qsTr("Cloud credentials") level: headingLevel Layout.bottomMargin: Kirigami.Units.largeSpacing / 2 } Kirigami.Label { - text: "Email" + text: qsTr("Email") } StyledTextField { @@ -64,7 +64,7 @@ Item { } Kirigami.Label { - text: "Password" + text: qsTr("Password") } StyledTextField { @@ -87,7 +87,7 @@ Item { } } Kirigami.Label { - text: "Show password" + text: qsTr("Show password") } } Item { width: Kirigami.Units.gridUnit; height: width } diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml index 5735266..8e258d7 100644 --- a/mobile-widgets/qml/DiveDetails.qml +++ b/mobile-widgets/qml/DiveDetails.qml @@ -30,7 +30,7 @@ Kirigami.Page { property alias gpsCheckbox: detailsEdit.gpsCheckbox property int updateCurrentIdx: manager.updateSelectedDive - title: diveDetailsListView.currentItem ? diveDetailsListView.currentItem.modelData.dive.location : "Dive details" + title: diveDetailsListView.currentItem ? diveDetailsListView.currentItem.modelData.dive.location : qsTr("Dive details") state: "view" leftPadding: 0 topPadding: 0 @@ -64,7 +64,7 @@ Kirigami.Page { ] property QtObject deleteAction: Action { - text: "Delete dive" + text: qsTr("Delete dive") iconName: "trash-empty" onTriggered: { contextDrawer.close() @@ -81,7 +81,7 @@ Kirigami.Page { } property QtObject mapAction: Action { - text: "Show on map" + text: qsTr("Show on map") iconName: "gps" onTriggered: { showMap(diveDetailsListView.currentItem.modelData.dive.gps) diff --git a/mobile-widgets/qml/DiveDetailsEdit.qml b/mobile-widgets/qml/DiveDetailsEdit.qml index 6ef006a..7ff511d 100644 --- a/mobile-widgets/qml/DiveDetailsEdit.qml +++ b/mobile-widgets/qml/DiveDetailsEdit.qml @@ -71,11 +71,11 @@ Item { Kirigami.Heading { Layout.columnSpan: 2 - text: "Dive " + number + text: qsTr("Dive %1").arg(number) } Kirigami.Label { Layout.alignment: Qt.AlignRight - text: "Date:" + text: qsTr("Date:") } StyledTextField { id: txtDate; @@ -83,7 +83,7 @@ Item { } Kirigami.Label { Layout.alignment: Qt.AlignRight - text: "Location:" + text: qsTr("Location:") } StyledTextField { id: txtLocation; @@ -92,7 +92,7 @@ Item { Kirigami.Label { Layout.alignment: Qt.AlignRight - text: "Coordinates:" + text: qsTr("Coordinates:") } StyledTextField { id: txtGps @@ -101,7 +101,7 @@ Item { Kirigami.Label { Layout.alignment: Qt.AlignRight - text: "Use current\nGPS location:" + text: qsTr("Use current\nGPS location:") visible: manager.locationServiceAvailable } CheckBox { @@ -115,7 +115,7 @@ Item { Kirigami.Label { Layout.alignment: Qt.AlignRight - text: "Depth:" + text: qsTr("Depth:") } StyledTextField { id: txtDepth @@ -124,7 +124,7 @@ Item { } Kirigami.Label { Layout.alignment: Qt.AlignRight - text: "Duration:" + text: qsTr("Duration:") } StyledTextField { id: txtDuration @@ -134,7 +134,7 @@ Item { Kirigami.Label { Layout.alignment: Qt.AlignRight - text: "Air Temp:" + text: qsTr("Air Temp:") } StyledTextField { id: txtAirTemp @@ -143,7 +143,7 @@ Item { Kirigami.Label { Layout.alignment: Qt.AlignRight - text: "Water Temp:" + text: qsTr("Water Temp:") } StyledTextField { id: txtWaterTemp @@ -152,7 +152,7 @@ Item { Kirigami.Label { Layout.alignment: Qt.AlignRight - text: "Suit:" + text: qsTr("Suit:") } StyledTextField { id: txtSuit @@ -161,7 +161,7 @@ Item { Kirigami.Label { Layout.alignment: Qt.AlignRight - text: "Buddy:" + text: qsTr("Buddy:") } StyledTextField { id: txtBuddy @@ -170,7 +170,7 @@ Item { Kirigami.Label { Layout.alignment: Qt.AlignRight - text: "Dive Master:" + text: qsTr("Dive Master:") } StyledTextField { id: txtDiveMaster @@ -179,7 +179,7 @@ Item { Kirigami.Label { Layout.alignment: Qt.AlignRight - text: "Weight:" + text: qsTr("Weight:") } StyledTextField { id: txtWeight @@ -189,7 +189,7 @@ Item { Kirigami.Label { Layout.alignment: Qt.AlignRight - text: "Gas mix:" + text: qsTr("Gas mix:") } StyledTextField { id: txtGasMix @@ -200,7 +200,7 @@ Item { Kirigami.Label { Layout.alignment: Qt.AlignRight - text: "Start Pressure:" + text: qsTr("Start Pressure:") } StyledTextField { id: txtStartPressure @@ -210,7 +210,7 @@ Item { Kirigami.Label { Layout.alignment: Qt.AlignRight - text: "End Pressure:" + text: qsTr("End Pressure:") } StyledTextField { id: txtEndPressure @@ -221,7 +221,7 @@ Item { Kirigami.Label { Layout.columnSpan: 2 Layout.alignment: Qt.AlignLeft - text: "Notes:" + text: qsTr("Notes:") } TextArea { Layout.columnSpan: 2 diff --git a/mobile-widgets/qml/DiveDetailsView.qml b/mobile-widgets/qml/DiveDetailsView.qml index 557286f..6a4dd90 100644 --- a/mobile-widgets/qml/DiveDetailsView.qml +++ b/mobile-widgets/qml/DiveDetailsView.qml @@ -60,7 +60,7 @@ Item { } Kirigami.Label { id: dateLabel - text: "Date: " + text: qsTr("Date: ") opacity: 0.6 } Kirigami.Label { @@ -77,7 +77,7 @@ Item { Kirigami.Label { id: depthLabel - text: "Depth: " + text: qsTr("Depth: ") opacity: 0.6 } Kirigami.Label { @@ -86,7 +86,7 @@ Item { wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere } Kirigami.Label { - text: "Duration: " + text: qsTr("Duration: ") opacity: 0.6 Layout.alignment: Qt.AlignRight } @@ -118,7 +118,7 @@ Item { Layout.columnSpan: 4 Layout.margins: Kirigami.Units.gridUnit horizontalAlignment: Text.AlignHCenter - text: "No profile to show" + text: qsTr("No profile to show") } } GridLayout { @@ -136,12 +136,12 @@ Item { Kirigami.Heading { Layout.fillWidth: true level: 3 - text: "Dive Details" + text: qsTr("Dive Details") Layout.columnSpan: 4 } Kirigami.Label { - text: "Suit:" + text: qsTr("Suit:") wrapMode: Text.WrapAtWordBoundaryOrAnywhere opacity: 0.6 Layout.maximumWidth: detailsView.col1Width @@ -156,7 +156,7 @@ Item { } Kirigami.Label { - text: "Air Temp:" + text: qsTr("Air Temp:") wrapMode: Text.WrapAtWordBoundaryOrAnywhere opacity: 0.6 Layout.maximumWidth: detailsView.col3Width @@ -172,7 +172,7 @@ Item { } Kirigami.Label { - text: "Cylinder:" + text: qsTr("Cylinder:") opacity: 0.6 Layout.maximumWidth: detailsView.col1Width Layout.minimumWidth: detailsView.col1Width @@ -186,7 +186,7 @@ Item { } Kirigami.Label { - text: "Water Temp:" + text: qsTr("Water Temp:") wrapMode: Text.WrapAtWordBoundaryOrAnywhere opacity: 0.6 Layout.maximumWidth: detailsView.col3Width @@ -202,7 +202,7 @@ Item { } Kirigami.Label { - text: "Dive Master:" + text: qsTr("Dive Master:") wrapMode: Text.WrapAtWordBoundaryOrAnywhere opacity: 0.6 Layout.maximumWidth: detailsView.col1Width @@ -217,7 +217,7 @@ Item { } Kirigami.Label { - text: "Weight:" + text: qsTr("Weight:") opacity: 0.6 Layout.maximumWidth: detailsView.col3Width Layout.minimumWidth: detailsView.col3Width @@ -246,7 +246,7 @@ Item { columnSpacing: Kirigami.Units.smallSpacing Kirigami.Label { - text: "Buddy:" + text: qsTr("Buddy:") opacity: 0.6 Layout.maximumWidth: detailsView.col1Width Layout.minimumWidth: detailsView.col1Width @@ -260,7 +260,7 @@ Item { } Kirigami.Label { - text: "SAC:" + text: qsTr("SAC:") opacity: 0.6 Layout.maximumWidth: detailsView.col3Width Layout.minimumWidth: detailsView.col3Width @@ -277,7 +277,7 @@ Item { Kirigami.Heading { Layout.fillWidth: true level: 3 - text: "Notes" + text: qsTr("Notes") wrapMode: Text.WrapAtWordBoundaryOrAnywhere Layout.columnSpan: 4 } diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml index e4ae3be..f949a44 100644 --- a/mobile-widgets/qml/DiveList.qml +++ b/mobile-widgets/qml/DiveList.qml @@ -9,7 +9,7 @@ import org.subsurfacedivelog.mobile 1.0 Kirigami.ScrollablePage { id: page objectName: "DiveList" - title: "Dive list" + title: qsTr("Dive list") background: Rectangle { color: Kirigami.Theme.viewBackgroundColor } @@ -92,7 +92,7 @@ Kirigami.ScrollablePage { bottom: numberText.bottom } Kirigami.Label { - text: 'Depth: ' + text: qsTr('Depth: ') font.pointSize: subsurfaceTheme.smallPointSize color: textColor } @@ -103,7 +103,7 @@ Kirigami.ScrollablePage { color: textColor } Kirigami.Label { - text: 'Duration: ' + text: qsTr('Duration: ') font.pointSize: subsurfaceTheme.smallPointSize color: textColor } @@ -219,17 +219,17 @@ Kirigami.ScrollablePage { if (visible) { page.actions.main = page.saveAction page.actions.right = page.offlineAction - title = "Cloud credentials" + title = qsTr("Cloud credentials") } else if(manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL || manager.credentialStatus === QMLManager.NOCLOUD) { page.actions.main = page.addDiveAction page.actions.right = null - title = "Dive list" + title = qsTr("Dive list") if (diveListView.count === 0) showPassiveNotification(qsTr("Please tap the '+' button to add a dive"), 3000) } else { page.actions.main = null page.actions.right = null - title = "Dive list" + title = qsTr("Dive list") } } diff --git a/mobile-widgets/qml/DownloadFromDiveComputer.qml b/mobile-widgets/qml/DownloadFromDiveComputer.qml index a062ffa..85f043d 100644 --- a/mobile-widgets/qml/DownloadFromDiveComputer.qml +++ b/mobile-widgets/qml/DownloadFromDiveComputer.qml @@ -13,12 +13,12 @@ Kirigami.Page { width: parent.width height: parent.height Layout.fillWidth: true; - title: "Dive Computer" + title: qsTr("Dive Computer") /* this can be done by hitting the back key contextualActions: [ Action { - text: "Close Preferences" + text: qsTr("Close Preferences") iconName: "dialog-cancel" onTriggered: { stackView.pop() @@ -35,11 +35,11 @@ Kirigami.Page { RowLayout { anchors.top:parent.top Layout.fillWidth: true - Text { text: " Vendor name : " } + Text { text: qsTr(" Vendor name : ") } ComboBox { Layout.fillWidth: true } } RowLayout { - Text { text: " Dive Computer:" } + Text { text: qsTr(" Dive Computer:") } ComboBox { Layout.fillWidth: true } } RowLayout { @@ -49,15 +49,15 @@ Kirigami.Page { } RowLayout { SubsurfaceButton { - text: "Download" + text: qsTr("Download") onClicked: { - text: "Retry" + text: qsTr("Retry") stackView.pop(); } } SubsurfaceButton { id:quitbutton - text: "Quit" + text: qsTr("Quit") onClicked: { stackView.pop(); } @@ -65,7 +65,7 @@ Kirigami.Page { } RowLayout { Text { - text: " Downloaded dives" + text: qsTr(" Downloaded dives") } } TableView { @@ -76,29 +76,29 @@ Kirigami.Page { TableViewColumn { width: parent.width / 2 role: "datetime" - title: "Date / Time" + title: qsTr("Date / Time") } TableViewColumn { width: parent.width / 4 role: "duration" - title: "Duration" + title: qsTr("Duration") } TableViewColumn { width: parent.width / 4 role: "depth" - title: "Depth" + title: qsTr("Depth") } } RowLayout { Layout.fillWidth: true SubsurfaceButton { - text: "Accept" + text: qsTr("Accept") onClicked: { stackView.pop(); } } SubsurfaceButton { - text: "Quit" + text: qsTr("Quit") onClicked: { stackView.pop(); } @@ -108,11 +108,11 @@ Kirigami.Page { Layout.fillWidth: true } SubsurfaceButton { - text: "Select All" + text: qsTr("Select All") } SubsurfaceButton { id: unselectbutton - text: "Unselect All" + text: qsTr("Unselect All") } } RowLayout { // spacer to make space for silly button diff --git a/mobile-widgets/qml/GpsList.qml b/mobile-widgets/qml/GpsList.qml index 8866160..270c4c9 100644 --- a/mobile-widgets/qml/GpsList.qml +++ b/mobile-widgets/qml/GpsList.qml @@ -13,7 +13,7 @@ Kirigami.ScrollablePage { width: parent.width - Kirigami.Units.gridUnit anchors.margins: Kirigami.Units.gridUnit / 2 objectName: "gpsList" - title: "GPS Fixes" + title: qsTr("GPS Fixes") Component { id: gpsDelegate @@ -37,7 +37,7 @@ Kirigami.ScrollablePage { rightMargin: horizontalPadding } Kirigami.Label { - text: 'Date: ' + text: qsTr('Date: ') opacity: 0.6 font.pointSize: subsurfaceTheme.smallPointSize } @@ -47,7 +47,7 @@ Kirigami.ScrollablePage { font.pointSize: subsurfaceTheme.smallPointSize } Kirigami.Label { - text: 'Name: ' + text: qsTr('Name: ') opacity: 0.6 font.pointSize: subsurfaceTheme.smallPointSize } @@ -57,7 +57,7 @@ Kirigami.ScrollablePage { font.pointSize: subsurfaceTheme.smallPointSize } Kirigami.Label { - text: 'Latitude: ' + text: qsTr('Latitude: ') opacity: 0.6 font.pointSize: subsurfaceTheme.smallPointSize } @@ -66,7 +66,7 @@ Kirigami.ScrollablePage { font.pointSize: subsurfaceTheme.smallPointSize } Kirigami.Label { - text: 'Longitude: ' + text: qsTr('Longitude: ') opacity: 0.6 font.pointSize: subsurfaceTheme.smallPointSize } @@ -110,7 +110,7 @@ Kirigami.ScrollablePage { x: Kirigami.Units.gridUnit / 2 height: paintedHeight + Kirigami.Units.gridUnit / 2 verticalAlignment: Text.AlignBottom - text: "List of stored GPS fixes" + text: qsTr("List of stored GPS fixes") } } } diff --git a/mobile-widgets/qml/Log.qml b/mobile-widgets/qml/Log.qml index 147709c..7d630d0 100644 --- a/mobile-widgets/qml/Log.qml +++ b/mobile-widgets/qml/Log.qml @@ -12,7 +12,7 @@ Kirigami.ScrollablePage { id: logWindow anchors.margins: Kirigami.Units.gridUnit / 2 objectName: "Log" - title: "Application Log" + title: qsTr("Application Log") property int pageWidth: subsurfaceTheme.columnWidth - Kirigami.Units.smallSpacing @@ -20,7 +20,7 @@ Kirigami.ScrollablePage { width: logWindow.width - logWindow.leftPadding - logWindow.rightPadding - 2 * Kirigami.Units.smallSpacing spacing: Kirigami.Units.smallSpacing Kirigami.Heading { - text: "Application Log" + text: qsTr("Application Log") } Kirigami.Label { id: logContent diff --git a/mobile-widgets/qml/Preferences.qml b/mobile-widgets/qml/Preferences.qml index f7767b4..c437341 100644 --- a/mobile-widgets/qml/Preferences.qml +++ b/mobile-widgets/qml/Preferences.qml @@ -8,10 +8,10 @@ import org.subsurfacedivelog.mobile 1.0 Kirigami.Page { - title: "Preferences" + title: qsTr("Preferences") actions { main: Action { - text: "Save" + text: qsTr("Save") iconName: "document-save" onTriggered: { manager.distanceThreshold = distanceThreshold.text @@ -34,13 +34,13 @@ Kirigami.Page { } Kirigami.Heading { - text: "Preferences" + text: qsTr("Preferences") Layout.bottomMargin: Kirigami.Units.largeSpacing / 2 Layout.columnSpan: 2 } Kirigami.Heading { - text: "Subsurface GPS data webservice" + text: qsTr("Subsurface GPS data webservice") level: 3 Layout.topMargin: Kirigami.Units.largeSpacing Layout.bottomMargin: Kirigami.Units.largeSpacing / 2 @@ -48,7 +48,7 @@ Kirigami.Page { } Kirigami.Label { - text: "Distance threshold (meters)" + text: qsTr("Distance threshold (meters)") Layout.alignment: Qt.AlignRight } @@ -59,7 +59,7 @@ Kirigami.Page { } Kirigami.Label { - text: "Time threshold (minutes)" + text: qsTr("Time threshold (minutes)") Layout.alignment: Qt.AlignRight } diff --git a/mobile-widgets/qml/StartPage.qml b/mobile-widgets/qml/StartPage.qml index e9c7856..09057b1 100644 --- a/mobile-widgets/qml/StartPage.qml +++ b/mobile-widgets/qml/StartPage.qml @@ -16,10 +16,10 @@ ColumnLayout { Layout.fillWidth: true Layout.margins: Kirigami.Units.gridUnit Layout.topMargin: Kirigami.Units.gridUnit * 3 - text: "To use Subsurface-mobile with Subsurface cloud storage, please enter " + + text: qsTr("To use Subsurface-mobile with Subsurface cloud storage, please enter" + "your cloud credentials.\n\n" + "To use Subsurface-mobile only with local data on this device, tap " + - "on the no cloud icon below." + "on the no cloud icon below.") wrapMode: Text.WordWrap } Kirigami.Label { diff --git a/mobile-widgets/qml/ThemeTest.qml b/mobile-widgets/qml/ThemeTest.qml index 292d2be..e72a2ca 100644 --- a/mobile-widgets/qml/ThemeTest.qml +++ b/mobile-widgets/qml/ThemeTest.qml @@ -10,7 +10,7 @@ Kirigami.Page { /* this can be done by hitting the back key contextualActions: [ Action { - text: "Close Theme info" + text: qsTr("Close Theme info") iconName: "dialog-cancel" onTriggered: { stackView.pop() @@ -26,11 +26,11 @@ Kirigami.Page { Kirigami.Heading { Layout.columnSpan: 2 - text: "Theme Information" + text: qsTr("Theme Information") } Kirigami.Heading { - text: "Screen" + text: qsTr("Screen") Layout.columnSpan: 2 level: 3 } @@ -39,83 +39,83 @@ Kirigami.Page { } Kirigami.Label { - text: "Geometry (pixels):" + text: qsTr("Geometry (pixels):") } Kirigami.Label { text: rootItem.width + "x" + rootItem.height } Kirigami.Label { - text: "Geometry (gridUnits):" + text: qsTr("Geometry (gridUnits):") } Kirigami.Label { text: Math.round(rootItem.width / Kirigami.Units.gridUnit) + "x" + Math.round(rootItem.height / Kirigami.Units.gridUnit) } Kirigami.Label { - text: "Units.gridUnit:" + text: qsTr("Units.gridUnit:") } Kirigami.Label { text: Kirigami.Units.gridUnit } Kirigami.Label { - text: "Units.devicePixelRatio:" + text: qsTr("Units.devicePixelRatio:") } Kirigami.Label { text: Screen.devicePixelRatio } Kirigami.Heading { - text: "Font Metrics" + text: qsTr("Font Metrics") level: 3 Layout.columnSpan: 2 } Kirigami.Label { - text: "FontMetrics pointSize:" + text: qsTr("FontMetrics pointSize:") } Kirigami.Label { text: fm.font.pointSize } Kirigami.Label { - text: "FontMetrics pixelSize:" + text: qsTr("FontMetrics pixelSize:") } Kirigami.Label { text: fm.height } Kirigami.Label { - text: "FontMetrics devicePixelRatio:" + text: qsTr("FontMetrics devicePixelRatio:") } Kirigami.Label { text: fm.height / fm.font.pointSize } Kirigami.Label { - text: "Text item pixelSize:" + text: qsTr("Text item pixelSize:") } Text { text: font.pixelSize } Kirigami.Label { - text: "Text item pointSize:" + text: qsTr("Text item pointSize:") } Text { text: font.pointSize } Kirigami.Label { - text: "Pixel density:" + text: qsTr("Pixel density:") } Text { text: Screen.pixelDensity } Kirigami.Label { - text: "Height of default font:" + text: qsTr("Height of default font:") } Text { text: font.pixelSize / Screen.pixelDensity + "mm" diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml index 36064bc..65cf0ec 100644 --- a/mobile-widgets/qml/main.qml +++ b/mobile-widgets/qml/main.qml @@ -88,13 +88,13 @@ Kirigami.ApplicationWindow { } globalDrawer: Kirigami.GlobalDrawer { - title: "Subsurface" + title: qsTr("Subsurface") titleIcon: "qrc:/qml/subsurface-mobile-icon.png" bannerImageSource: "dive.jpg" actions: [ Kirigami.Action { - text: "Dive list" + text: qsTr("Dive list") onTriggered: { manager.appendTextToLog("requested dive list with credential status " + manager.credentialStatus) if (manager.credentialStatus == QMLManager.UNKNOWN) { @@ -109,7 +109,7 @@ Kirigami.ApplicationWindow { } }, Kirigami.Action { - text: "Cloud credentials" + text: qsTr("Cloud credentials") onTriggered: { returnTopPage() oldStatus = manager.credentialStatus @@ -123,11 +123,11 @@ Kirigami.ApplicationWindow { } }, Kirigami.Action { - text: "Manage dives" + text: qsTr("Manage dives") /* * disable for the beta to avoid confusion Action { - text: "Download from computer" + text: qsTr("Download from computer") onTriggered: { detailsWindow.endEditMode() stackView.push(downloadDivesWindow) @@ -135,7 +135,7 @@ Kirigami.ApplicationWindow { } */ Kirigami.Action { - text: "Add dive manually" + text: qsTr("Add dive manually") enabled: manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL || manager.credentialStatus === QMLManager.NOCLOUD onTriggered: { returnTopPage() // otherwise odd things happen with the page stack @@ -143,7 +143,7 @@ Kirigami.ApplicationWindow { } } Kirigami.Action { - text: "Manual sync with cloud" + text: qsTr("Manual sync with cloud") enabled: manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL || manager.credentialStatus === QMLManager.NOCLOUD onTriggered: { if (manager.credentialStatus === QMLManager.NOCLOUD) { @@ -161,7 +161,7 @@ Kirigami.ApplicationWindow { } } Kirigami.Action { - text: syncToCloud ? "Offline mode" : "Enable auto cloud sync" + text: syncToCloud ? qsTr("Offline mode") : qsTr("Enable auto cloud sync") enabled: manager.credentialStatus !== QMLManager.NOCLOUD onTriggered: { syncToCloud = !syncToCloud @@ -179,31 +179,31 @@ Kirigami.ApplicationWindow { }, Kirigami.Action { - text: "GPS" + text: qsTr("GPS") enabled: manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL Kirigami.Action { - text: "GPS-tag dives" + text: qsTr("GPS-tag dives") onTriggered: { manager.applyGpsData(); } } Kirigami.Action { - text: "Upload GPS data" + text: qsTr("Upload GPS data") onTriggered: { manager.sendGpsData(); } } Kirigami.Action { - text: "Download GPS data" + text: qsTr("Download GPS data") onTriggered: { manager.downloadGpsData(); } } Kirigami.Action { - text: "Show GPS fixes" + text: qsTr("Show GPS fixes") onTriggered: { returnTopPage() manager.populateGpsData(); @@ -212,13 +212,13 @@ Kirigami.ApplicationWindow { } Kirigami.Action { - text: "Clear GPS cache" + text: qsTr("Clear GPS cache") onTriggered: { manager.clearGpsData(); } } Kirigami.Action { - text: "Preferences" + text: qsTr("Preferences") onTriggered: { stackView.push(prefsWindow) detailsWindow.endEditMode() @@ -227,29 +227,29 @@ Kirigami.ApplicationWindow { }, Kirigami.Action { - text: "Developer" + text: qsTr("Developer") Kirigami.Action { - text: "App log" + text: qsTr("App log") onTriggered: { stackView.push(logWindow) } } Kirigami.Action { - text: "Theme information" + text: qsTr("Theme information") onTriggered: { stackView.push(themetest) } } }, Kirigami.Action { - text: "User manual" + text: qsTr("User manual") onTriggered: { Qt.openUrlExternally("https://subsurface-divelog.org/documentation/subsurface-mobile-user-manual/") } }, Kirigami.Action { - text: "About" + text: qsTr("About") onTriggered: { stackView.push(aboutWindow) detailsWindow.endEditMode() @@ -261,7 +261,7 @@ Kirigami.ApplicationWindow { height: childrenRect.height width: Kirigami.Units.gridUnit * 10 CheckBox { - //text: "Run location service" + //text: qsTr("Run location service") id: locationCheckbox visible: manager.locationServiceAvailable anchors { @@ -280,7 +280,7 @@ Kirigami.ApplicationWindow { //leftMargin: units.smallSpacing verticalCenter: locationCheckbox.verticalCenter } - text: manager.locationServiceAvailable ? "Run location service" : "No GPS source available" + text: manager.locationServiceAvailable ? qsTr("Run location service") : qsTr("No GPS source available") } onClicked: { print("Click.") @@ -292,7 +292,7 @@ Kirigami.ApplicationWindow { contextDrawer: Kirigami.ContextDrawer { id: contextDrawer actions: rootItem.pageStack.currentPage ? rootItem.pageStack.currentPage.contextualActions : null - title: "Actions" + title: qsTr("Actions") } QtObject { -- 2.6.4 (Apple Git-63)
According to my experiments, these patches (one with a helper script and one with translation markings for qml files) should be enough to enable localization for the mobile version. What is then needed is uncommenting the last two lines in translations/CMakeLists.txt to create/update .ts files and pushing those to the translation web service). At least for subsurface-mobile on desktop this should be enough for a translated app. Best Robert
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
