From f84b3c8c11189bc4b1b2e26eac2395b0f0b7ad40 Mon Sep 17 00:00:00 2001 From: Yuri Chornoivan Date: Sat, 21 Dec 2019 09:59:36 +0200 Subject: [PATCH] Fix localization of app and smsapp. Patch mainly by Victor Ryzhykh. --- app/Messages.sh | 3 +++ app/qml/DevicePage.qml | 30 +++++++++++++++--------------- app/qml/FindDevicesPage.qml | 10 +++++----- app/qml/main.qml | 2 +- app/qml/mousepad.qml | 2 +- app/qml/mpris.qml | 6 +++--- app/qml/presentationRemote.qml | 4 ++-- app/qml/runcommand.qml | 8 ++++---- app/qml/volume.qml | 2 +- smsapp/Messages.sh | 3 +++ smsapp/qml/ChatMessage.qml | 6 +++--- smsapp/qml/ConversationDisplay.qml | 2 +- smsapp/qml/ConversationList.qml | 14 +++++++------- smsapp/qml/main.qml | 4 ++-- 14 files changed, 51 insertions(+), 45 deletions(-) create mode 100644 app/Messages.sh create mode 100644 smsapp/Messages.sh diff --git a/app/Messages.sh b/app/Messages.sh new file mode 100644 index 000000000..e13ce8ec5 --- /dev/null +++ b/app/Messages.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +$XGETTEXT `find . -name '*.cpp' -o -name '*.qml'` -o $podir/kdeconnect-app.pot diff --git a/app/qml/DevicePage.qml b/app/qml/DevicePage.qml index 3a3baaaf7..862efa31c 100644 --- a/app/qml/DevicePage.qml +++ b/app/qml/DevicePage.qml @@ -64,11 +64,11 @@ Kirigami.Page Kirigami.Action { iconName:"network-disconnect" onTriggered: deviceView.currentDevice.unpair() - text: i18n("Unpair") + text: i18nd("kdeconnect-app", "Unpair") }, Kirigami.Action { iconName:"hands-free" - text: i18n("Send Ping") + text: i18nd("kdeconnect-app", "Send Ping") onTriggered: { deviceView.currentDevice.pluginCall("ping", "sendPing"); } @@ -91,19 +91,19 @@ Kirigami.Page property list plugins : [ PluginItem { - name: i18n("Multimedia control") + name: i18nd("kdeconnect-app", "Multimedia control") interfaceFactory: MprisDbusInterfaceFactory component: "qrc:/qml/mpris.qml" pluginName: "mprisremote" }, PluginItem { - name: i18n("Remote input") + name: i18nd("kdeconnect-app", "Remote input") interfaceFactory: RemoteControlDbusInterfaceFactory component: "qrc:/qml/mousepad.qml" pluginName: "remotecontrol" }, PluginItem { - name: i18n("Presentation Remote") + name: i18nd("kdeconnect-app", "Presentation Remote") interfaceFactory: RemoteKeyboardDbusInterfaceFactory component: "qrc:/qml/presentationRemote.qml" pluginName: "remotecontrol" @@ -111,7 +111,7 @@ Kirigami.Page PluginItem { readonly property var lockIface: LockDeviceDbusInterfaceFactory.create(deviceView.currentDevice.id()) pluginName: "lockdevice" - name: lockIface.isLocked ? i18n("Unlock") : i18n("Lock") + name: lockIface.isLocked ? i18nd("kdeconnect-app", "Unlock") : i18nd("kdeconnect-app", "Lock") onClick: function() { lockIface.isLocked = !lockIface.isLocked; } @@ -119,13 +119,13 @@ Kirigami.Page PluginItem { readonly property var findmyphoneIface: FindMyPhoneDbusInterfaceFactory.create(deviceView.currentDevice.id()) pluginName: "findmyphone" - name: i18n("Find Device") + name: i18nd("kdeconnect-app", "Find Device") onClick: function() { findmyphoneIface.ring() } }, PluginItem { - name: i18n("Run command") + name: i18nd("kdeconnect-app", "Run command") interfaceFactory: RemoteCommandsDbusInterfaceFactory component: "qrc:/qml/runcommand.qml" pluginName: "remotecommands" @@ -133,14 +133,14 @@ Kirigami.Page PluginItem { readonly property var shareIface: ShareDbusInterfaceFactory.create(deviceView.currentDevice.id()) pluginName: "share" - name: i18n("Share File") + name: i18nd("kdeconnect-app", "Share File") onClick: function() { fileDialog.open() shareIface.shareUrl(fileDialog.fileUrl) } }, PluginItem { - name: i18n("Volume control") + name: i18nd("kdeconnect-app", "Volume control") interfaceFactory: RemoteSystemVolumeDbusInterfaceFactory component: "qrc:/qml/volume.qml" pluginName: "remotesystemvolume" @@ -154,7 +154,7 @@ Kirigami.Page readonly property var actions: [] Button { anchors.centerIn: parent - text: i18n("Pair") + text: i18nd("kdeconnect-app", "Pair") icon.name:"network-connect" onClicked: deviceView.currentDevice.requestPair() } @@ -167,13 +167,13 @@ Kirigami.Page RowLayout { anchors.centerIn: parent Button { - text: i18n("Accept") + text: i18nd("kdeconnect-app", "Accept") icon.name:"dialog-ok" onClicked: deviceView.currentDevice.acceptPairing() } Button { - text: i18n("Reject") + text: i18nd("kdeconnect-app", "Reject") icon.name:"dialog-cancel" onClicked: deviceView.currentDevice.rejectPairing() } @@ -188,7 +188,7 @@ Kirigami.Page Label { anchors.centerIn: parent - text: i18n("This device is not reachable") + text: i18nd("kdeconnect-app", "This device is not reachable") } } } @@ -196,7 +196,7 @@ Kirigami.Page FileDialog { id: fileDialog - title: i18n("Please choose a file") + title: i18nd("kdeconnect-app", "Please choose a file") folder: shortcuts.home } } diff --git a/app/qml/FindDevicesPage.qml b/app/qml/FindDevicesPage.qml index 51211952a..b3b6eae79 100644 --- a/app/qml/FindDevicesPage.qml +++ b/app/qml/FindDevicesPage.qml @@ -32,10 +32,10 @@ Kirigami.ScrollablePage } objectName: "FindDevices" - title: i18n("Pair") + title: i18nd("kdeconnect-app", "Pair") Label { - text: i18n("No devices found") + text: i18nd("kdeconnect-app", "No devices found") anchors.centerIn: parent visible: devices.count === 0 } @@ -50,11 +50,11 @@ Kirigami.ScrollablePage text: switch (parseInt(section)) { case DevicesModel.Paired: - return i18n("Remembered") + return i18nd("kdeconnect-app", "Remembered") case DevicesModel.Reachable: - return i18n("Available") + return i18nd("kdeconnect-app", "Available") case (DevicesModel.Reachable | DevicesModel.Paired): - return i18n("Connected") + return i18nd("kdeconnect-app", "Connected") } } diff --git a/app/qml/main.qml b/app/qml/main.qml index eb40e779a..cec7fb372 100644 --- a/app/qml/main.qml +++ b/app/qml/main.qml @@ -33,7 +33,7 @@ Kirigami.ApplicationWindow Kirigami.Action { id: findDevicesAction - text: i18n("Find devices...") + text: i18nd("kdeconnect-app", "Find devices...") iconName: "list-add" checked: pageStack.currentItem && pageStack.currentItem.objectName == "FindDevices" diff --git a/app/qml/mousepad.qml b/app/qml/mousepad.qml index 11bed94b1..5ca7a58b6 100644 --- a/app/qml/mousepad.qml +++ b/app/qml/mousepad.qml @@ -27,7 +27,7 @@ import org.kde.kdeconnect 1.0 Kirigami.Page { id: mousepad - title: i18n("Remote Control") + title: i18nd("kdeconnect-app", "Remote Control") property QtObject pluginInterface property QtObject device diff --git a/app/qml/mpris.qml b/app/qml/mpris.qml index ceb50c20a..87bf15593 100644 --- a/app/qml/mpris.qml +++ b/app/qml/mpris.qml @@ -30,7 +30,7 @@ Kirigami.Page property bool muted: false property int volumeUnmuted property var volume: pluginInterface.volume - title: i18n("Multimedia Controls") + title: i18nd("kdeconnect-app", "Multimedia Controls") onVolumeChanged: { if (muted && volume != 0) { @@ -73,7 +73,7 @@ Kirigami.Page Label { id: noPlayersText - text: i18n("No players available") + text: i18nd("kdeconnect-app", "No players available") anchors.centerIn: parent visible: pluginInterface.playerList.length == 0 } @@ -121,7 +121,7 @@ Kirigami.Page Label { id: artistAlbum Layout.fillWidth: true - text: i18n("%1 - %2", root.pluginInterface.artist, root.pluginInterface.album) + text: i18nd("kdeconnect-app", "%1 - %2", root.pluginInterface.artist, root.pluginInterface.album) visible: !nowPlaying.visible && root.pluginInterface.album.length > 0 && root.pluginInterface.artist.length > 0 wrapMode: Text.Wrap } diff --git a/app/qml/presentationRemote.qml b/app/qml/presentationRemote.qml index b7f2f7a3c..d8206edf8 100644 --- a/app/qml/presentationRemote.qml +++ b/app/qml/presentationRemote.qml @@ -26,12 +26,12 @@ import org.kde.kirigami 2.0 as Kirigami Kirigami.Page { id: mousepad - title: i18n("Presentation Remote") + title: i18nd("kdeconnect-app", "Presentation Remote") property QtObject pluginInterface actions.main: Kirigami.Action { icon.name: "view-fullscreen" - text: i18n("Enable Full-Screen") + text: i18nd("kdeconnect-app", "Enable Full-Screen") onTriggered: { mousepad.pluginInterface.sendKeyPress("", 25 /*XK_F5*/); } diff --git a/app/qml/runcommand.qml b/app/qml/runcommand.qml index f849a43ba..40e952eba 100644 --- a/app/qml/runcommand.qml +++ b/app/qml/runcommand.qml @@ -27,15 +27,15 @@ import org.kde.kdeconnect 1.0 Kirigami.Page { id: root - title: i18n("Run command") + title: i18nd("kdeconnect-app", "Run command") property QtObject pluginInterface actions.main: Kirigami.Action { icon.name: "document-edit" - text: i18n("Edit commands") + text: i18nd("kdeconnect-app", "Edit commands") onTriggered: { pluginInterface.editCommands(); - showPassiveNotification(i18n("You can edit commands on the connected device")); + showPassiveNotification(i18nd("kdeconnect-app", "You can edit commands on the connected device")); } } @@ -55,7 +55,7 @@ Kirigami.Page Label { visible: commandsList.count === 0 - text: i18n("No commands defined") + text: i18nd("kdeconnect-app", "No commands defined") anchors.centerIn: parent } diff --git a/app/qml/volume.qml b/app/qml/volume.qml index b66f2df34..ef6916c76 100644 --- a/app/qml/volume.qml +++ b/app/qml/volume.qml @@ -27,7 +27,7 @@ import org.kde.kdeconnect 1.0 Kirigami.Page { id: root - title: i18n("Volume control") + title: i18nd("kdeconnect-app", "Volume control") property QtObject pluginInterface ListView { diff --git a/smsapp/Messages.sh b/smsapp/Messages.sh new file mode 100644 index 000000000..d06519554 --- /dev/null +++ b/smsapp/Messages.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +$XGETTEXT `find . -name '*.cpp' -o -name '*.qml'` -o $podir/kdeconnect-sms.pot diff --git a/smsapp/qml/ChatMessage.qml b/smsapp/qml/ChatMessage.qml index 5c9f69ef3..9cb8f5e68 100644 --- a/smsapp/qml/ChatMessage.qml +++ b/smsapp/qml/ChatMessage.qml @@ -119,7 +119,7 @@ RowLayout { Controls.Menu { id: contextMenu Controls.MenuItem { - text: i18n("Copy Message") + text: i18nd("kdeconnect-sms", "Copy Message") enabled: bodyLabel.visible onTriggered: { root.messageCopyRequested(messageBody) @@ -147,7 +147,7 @@ RowLayout { } Controls.Label { id: dateLabeltest - text: spoilerHint == "" ? qsTr("Spoiler") : spoilerHint + text: spoilerHint == "" ? i18nd("kdeconnect-sms", "Spoiler") : spoilerHint color: sentByMe ? Kirigami.Theme.textColor : Kirigami.Theme.complementaryTextColor font.pixelSize: Kirigami.Units.gridUnit * 0.8 @@ -187,7 +187,7 @@ RowLayout { // mediaLocation === "" && // mediaGetUrl !== "" } - text: qsTr("Download") + text: i18nd("kdeconnect-sms", "Download") onClicked: { print("Downloading " + mediaGetUrl + "...") kaidan.downloadMedia(msgId, mediaGetUrl) diff --git a/smsapp/qml/ConversationDisplay.qml b/smsapp/qml/ConversationDisplay.qml index 9721f9fd7..618cce33e 100644 --- a/smsapp/qml/ConversationDisplay.qml +++ b/smsapp/qml/ConversationDisplay.qml @@ -196,7 +196,7 @@ Kirigami.ScrollablePage TextArea { id: messageField Layout.fillWidth: true - placeholderText: page.isMultitarget ? i18n("Replying to multitarget messages is not supported") : i18n("Compose message") + placeholderText: page.isMultitarget ? i18nd("kdeconnect-sms", "Replying to multitarget messages is not supported") : i18nd("kdeconnect-sms", "Compose message") wrapMode: TextArea.Wrap topPadding: Kirigami.Units.gridUnit * 0.5 bottomPadding: topPadding diff --git a/smsapp/qml/ConversationList.qml b/smsapp/qml/ConversationList.qml index ed2583818..8e1852867 100644 --- a/smsapp/qml/ConversationList.qml +++ b/smsapp/qml/ConversationList.qml @@ -35,7 +35,7 @@ Kirigami.ScrollablePage id: noDevicesWarning visible: !page.deviceConnected timeout: -1 - text: "⚠️ " + i18n("No devices available") + " ⚠️" + text: "⚠️ " + i18nd("kdeconnect-sms", "No devices available") + " ⚠️" MouseArea { // Detect mouseover and show another tooltip with more information @@ -45,13 +45,13 @@ Kirigami.ScrollablePage ToolTip.visible: containsMouse ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval // TODO: Wrap text if line is too long for the screen - ToolTip.text: i18n("No new messages can be sent or received, but you can browse cached content") + ToolTip.text: i18nd("kdeconnect-sms", "No new messages can be sent or received, but you can browse cached content") } } contextualActions: [ Kirigami.Action { - text: i18n("Refresh") + text: i18nd("kdeconnect-sms", "Refresh") icon.name: "view-refresh" enabled: devicesCombo.count > 0 onTriggered: { @@ -77,12 +77,12 @@ Kirigami.ScrollablePage header: Kirigami.InlineMessage { Layout.fillWidth: true visible: page.initialMessage.length > 0 - text: i18n("Choose recipient") + text: i18nd("kdeconnect-sms", "Choose recipient") actions: [ Kirigami.Action { iconName: "dialog-cancel" - text: i18n("Cancel") + text: i18nd("kdeconnect-sms", "Cancel") onTriggered: initialMessage = "" } ] @@ -91,7 +91,7 @@ Kirigami.ScrollablePage footer: ComboBox { id: devicesCombo enabled: count > 0 - displayText: !enabled ? i18n("No devices available") : undefined + displayText: !enabled ? i18nd("kdeconnect-sms", "No devices available") : undefined model: DevicesSortProxyModel { id: devicesModel //TODO: make it possible to filter if they can do sms @@ -137,7 +137,7 @@ Kirigami.ScrollablePage * Used as the filter of the list of messages */ id: filter - placeholderText: i18n("Filter...") + placeholderText: i18nd("kdeconnect-sms", "Filter...") width: parent.width z: 10 onTextChanged: { diff --git a/smsapp/qml/main.qml b/smsapp/qml/main.qml index bb9b570cc..9985314d0 100644 --- a/smsapp/qml/main.qml +++ b/smsapp/qml/main.qml @@ -32,7 +32,7 @@ Kirigami.ApplicationWindow height: 600 pageStack.initialPage: ConversationList { - title: i18n("KDE Connect SMS") + title: i18nd("kdeconnect-sms", "KDE Connect SMS") initialMessage: _initialMessage } @@ -47,7 +47,7 @@ Kirigami.ApplicationWindow actions: [ Kirigami.Action { - text: i18n("About...") + text: i18nd("kdeconnect-sms", "About...") icon.name: "help-about" onTriggered: { applicationWindow().pageStack.push(aboutPageComponent, { aboutData: aboutData });