Commit 41e41b19 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[Notifications] Fix translations in popup

The popup is a pure QML singleton and as such doesn't inherit the i18n context from the applet. Use i18nd explicitly.

BUG: 407927

Differential Revision: https://phabricator.kde.org/D21422
parent 19e8b39b
......@@ -44,7 +44,7 @@ PlasmaComponents.ContextMenu {
}
PlasmaComponents.MenuItem {
text: i18n("Copy Link Address")
text: i18nd("plasma_applet_org.kde.plasma.notifications", "Copy Link Address")
onClicked: __clipboard.content = contextMenu.link
visible: contextMenu.link !== ""
}
......@@ -55,7 +55,7 @@ PlasmaComponents.ContextMenu {
}
PlasmaComponents.MenuItem {
text: i18n("Copy")
text: i18nd("plasma_applet_org.kde.plasma.notifications", "Copy")
icon: "edit-copy"
enabled: typeof target.selectionStart !== "undefined"
? target.selectionStart !== target.selectionEnd
......@@ -71,7 +71,7 @@ PlasmaComponents.ContextMenu {
PlasmaComponents.MenuItem {
id: selectAllAction
text: i18n("Select All")
text: i18nd("plasma_applet_org.kde.plasma.notifications", "Select All")
onClicked: target.selectAll()
visible: typeof target.selectAll === "function"
}
......
......@@ -46,7 +46,7 @@ GridLayout {
Layout.row: index
Layout.alignment: Qt.AlignTop | Qt.AlignRight
text: jobDetails["descriptionLabel" + modelData] && jobDetails["descriptionValue" + modelData]
? i18nc("Row description, e.g. Source", "%1:", jobDetails["descriptionLabel" + modelData]) : ""
? i18ndc("plasma_applet_org.kde.plasma.notifications", "Row description, e.g. Source", "%1:", jobDetails["descriptionLabel" + modelData]) : ""
font: theme.smallestFont
textFormat: Text.PlainText
visible: text !== ""
......@@ -110,14 +110,14 @@ GridLayout {
if (processed > 0 && total > 0 && processed <= total) {
switch(modelData) {
case "Bytes":
return i18nc("How many bytes have been copied", "%2 of %1",
return i18ndc("plasma_applet_org.kde.plasma.notifications", "How many bytes have been copied", "%2 of %1",
KCoreAddons.Format.formatByteSize(total),
KCoreAddons.Format.formatByteSize(processed))
case "Files":
return i18ncp("How many files have been copied", "%2 of %1 file", "%2 of %1 files",
return i18ndcp("plasma_applet_org.kde.plasma.notifications", "How many files have been copied", "%2 of %1 file", "%2 of %1 files",
total, processed);
case "Directories":
return i18ncp("How many dirs have been copied", "%2 of %1 folder", "%2 of %1 folders",
return i18ndcp("plasma_applet_org.kde.plasma.notifications", "How many dirs have been copied", "%2 of %1 folder", "%2 of %1 folders",
total, processed);
}
} else {
......@@ -125,9 +125,9 @@ GridLayout {
case "Bytes":
return KCoreAddons.Format.formatByteSize(processed || total)
case "Files":
return i18np("%1 file", "%1 files", (processed || total));
return i18ndp("plasma_applet_org.kde.plasma.notifications", "%1 file", "%1 files", (processed || total));
case "Directories":
return i18np("%1 folder", "%1 folders", (processed || total));
return i18ndp("plasma_applet_org.kde.plasma.notifications", "%1 folder", "%1 folders", (processed || total));
}
}
}
......@@ -144,7 +144,7 @@ GridLayout {
Layout.column: 1
Layout.row: 2 + 3
Layout.fillWidth: true
text: jobDetails.speed > 0 ? i18nc("Bytes per second", "%1/s",
text: jobDetails.speed > 0 ? i18ndc("plasma_applet_org.kde.plasma.notifications", "Bytes per second", "%1/s",
KCoreAddons.Format.formatByteSize(jobDetails.speed)) : ""
font: theme.smallestFont
textFormat: Text.PlainText
......
......@@ -79,7 +79,7 @@ ColumnLayout {
PlasmaComponents.ToolButton {
id: suspendButton
tooltip: i18nc("Pause running job", "Pause")
tooltip: i18ndc("plasma_applet_org.kde.plasma.notifications", "Pause running job", "Pause")
iconSource: "media-playback-pause"
onClicked: jobItem.jobState === NotificationManager.Notifications.JobStateSuspended ? jobItem.resumeJobClicked()
: jobItem.suspendJobClicked()
......@@ -87,7 +87,7 @@ ColumnLayout {
PlasmaComponents.ToolButton {
id: killButton
tooltip: i18nc("Cancel running job", "Cancel")
tooltip: i18ndc("plasma_applet_org.kde.plasma.notifications", "Cancel running job", "Cancel")
iconSource: "media-playback-stop"
onClicked: jobItem.killJobClicked()
}
......@@ -96,8 +96,8 @@ ColumnLayout {
id: expandButton
Layout.leftMargin: units.smallSpacing
iconSource: checked ? "arrow-down" : (LayoutMirroring.enabled ? "arrow-left" : "arrow-right")
tooltip: checked ? i18nc("A button tooltip; hides item details", "Hide Details")
: i18nc("A button tooltip; expands the item to show details", "Show Details")
tooltip: checked ? i18ndc("plasma_applet_org.kde.plasma.notifications", "A button tooltip; hides item details", "Hide Details")
: i18ndc("plasma_applet_org.kde.plasma.notifications", "A button tooltip; expands the item to show details", "Show Details")
checkable: true
enabled: jobItem.jobDetails && jobItem.jobDetails.hasDetails
}
......@@ -143,7 +143,7 @@ ColumnLayout {
id: otherFileActionsButton
height: Math.max(implicitHeight, openButton.implicitHeight)
iconName: "application-menu"
tooltip: i18n("More Options...")
tooltip: i18nd("plasma_applet_org.kde.plasma.notifications", "More Options...")
checkable: true
onPressedChanged: {
if (pressed) {
......@@ -166,7 +166,9 @@ ColumnLayout {
id: openButton
height: Math.max(implicitHeight, otherFileActionsButton.implicitHeight)
// would be nice to have the file icon here?
text: jobItem.jobDetails && jobItem.jobDetails.totalFiles > 1 ? i18n("Open Containing Folder") : i18n("Open")
text: jobItem.jobDetails && jobItem.jobDetails.totalFiles > 1
? i18nd("plasma_applet_org.kde.plasma.notifications", "Open Containing Folder")
: i18nd("plasma_applet_org.kde.plasma.notifications", "Open")
onClicked: jobItem.openUrl(jobDoneActions.url)
width: minimumWidth
}
......@@ -177,7 +179,7 @@ ColumnLayout {
when: jobItem.jobState === NotificationManager.Notifications.JobStateSuspended
PropertyChanges {
target: suspendButton
tooltip: i18nc("Resume paused job", "Resume")
tooltip: i18ndc("plasma_applet_org.kde.plasma.notifications", "Resume paused job", "Resume")
iconSource: "media-playback-start"
}
PropertyChanges {
......
......@@ -114,7 +114,7 @@ RowLayout {
// Received less than an hour ago, show relative minutes
if (deltaMinutes < 60) {
return i18ncp("Notification was added minutes ago, keep short", "%1 min ago", "%1 min ago", deltaMinutes);
return i18ndcp("plasma_applet_org.kde.plasma.notifications", "Notification was added minutes ago, keep short", "%1 min ago", "%1 min ago", deltaMinutes);
}
// Received less than a day ago, show time, 22 hours so the time isn't as ambiguous between today and yesterday
if (deltaMinutes < 60 * 22) {
......@@ -147,16 +147,16 @@ RowLayout {
}
if (eta < 60) { // 1 minute
return i18ncp("seconds remaining, keep short",
return i18ndcp("plasma_applet_org.kde.plasma.notifications", "seconds remaining, keep short",
"%1 s remaining", "%1 s remaining", Math.round(eta));
}
if (eta < 60 * 60) {// 1 hour
return i18ncp("minutes remaining, keep short",
return i18ndcp("plasma_applet_org.kde.plasma.notifications", "minutes remaining, keep short",
"%1 min remaining", "%1 min remaining",
Math.round(eta / 60));
}
if (eta < 60 * 60 * 5) { // 5 hours max, if it takes even longer there's no real point in shoing that
return i18ncp("hours remaining, keep short",
return i18ndcp("plasma_applet_org.kde.plasma.notifications", "hours remaining, keep short",
"%1 h remaining", "%1 h remaining",
Math.round(eta / 60 / 60));
}
......@@ -177,7 +177,7 @@ RowLayout {
PlasmaComponents.ToolButton {
id: configureButton
tooltip: notificationHeading.configureActionLabel || i18n("Configure")
tooltip: notificationHeading.configureActionLabel || i18nd("plasma_applet_org.kde.plasma.notifications", "Configure")
iconSource: "configure"
visible: false
onClicked: notificationHeading.configureClicked()
......@@ -185,7 +185,9 @@ RowLayout {
PlasmaComponents.ToolButton {
id: dismissButton
tooltip: notificationHeading.dismissed ? i18nc("Opposite of minimize", "Restore") : i18n("Minimize")
tooltip: notificationHeading.dismissed
? i18ndc("plasma_applet_org.kde.plasma.notifications", "Opposite of minimize", "Restore")
: i18nd("plasma_applet_org.kde.plasma.notifications", "Minimize")
iconSource: notificationHeading.dismissed ? "window-restore" : "window-minimize"
visible: false
onClicked: notificationHeading.dismissClicked()
......@@ -193,7 +195,7 @@ RowLayout {
PlasmaComponents.ToolButton {
id: closeButton
tooltip: i18n("Close")
tooltip: i18nd("plasma_applet_org.kde.plasma.notifications", "Close")
iconSource: "window-close"
visible: false
onClicked: notificationHeading.closeClicked()
......
......@@ -148,20 +148,20 @@ ColumnLayout {
if (notificationItem.notificationType === NotificationManager.Notifications.JobType) {
if (notificationItem.jobState === NotificationManager.Notifications.JobStateSuspended) {
if (notificationItem.summary) {
return i18nc("Job name, e.g. Copying is paused", "%1 (Paused)", notificationItem.summary);
return i18ndc("plasma_applet_org.kde.plasma.notifications", "Job name, e.g. Copying is paused", "%1 (Paused)", notificationItem.summary);
}
} else if (notificationItem.jobState === NotificationManager.Notifications.JobStateStopped) {
if (notificationItem.jobError) {
if (notificationItem.summary) {
return i18nc("Job name, e.g. Copying has failed", "%1 (Failed)", notificationItem.summary);
return i18ndc("plasma_applet_org.kde.plasma.notifications", "Job name, e.g. Copying has failed", "%1 (Failed)", notificationItem.summary);
} else {
return i18n("Job Failed");
return i18nd("plasma_applet_org.kde.plasma.notifications", "Job Failed");
}
} else {
if (notificationItem.summary) {
return i18nc("Job name, e.g. Copying has finished", "%1 (Finished)", notificationItem.summary);
return i18ndc("plasma_applet_org.kde.plasma.notifications", "Job name, e.g. Copying has finished", "%1 (Finished)", notificationItem.summary);
} else {
return i18n("Job Finished");
return i18nd("plasma_applet_org.kde.plasma.notifications", "Job Finished");
}
}
}
......
......@@ -165,7 +165,7 @@ MouseArea {
right: parent.right
margins: units.smallSpacing
}
tooltip: i18n("More Options...")
tooltip: i18nd("plasma_applet_org.kde.plasma.notifications", "More Options...")
Accessible.name: tooltip
iconName: "application-menu"
checkable: true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment