Skip to content

Commit 9c41e3f

Browse files
ArchieMengzsien
authored andcommitted
fix: Add dde-control-center translations in notifications
Issue: linuxdeepin/developer-center#8859 Log: Add dde-control-center translations in notifications
1 parent 3945d68 commit 9c41e3f

File tree

18 files changed

+55
-23
lines changed

18 files changed

+55
-23
lines changed

audio1/audio.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ func sendNotify(icon, summary, body string) {
326326
return
327327
}
328328
n := notifications.NewNotifications(sessionBus)
329-
_, err = n.Notify(0, "dde-control-center", 0,
329+
_, err = n.Notify(0, Tr("dde-control-center"), 0,
330330
icon, summary, body,
331331
nil, nil, -1)
332332
logger.Debugf("send notification icon: %q, summary: %q, body: %q",

audio1/audio_events.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ func (a *Audio) notifyPortDisabled(cardId uint32, port pulse.CardPortInfo) {
474474
notify := notifications.NewNotifications(session)
475475
_, err = notify.Notify(
476476
0,
477-
"dde-control-center",
477+
gettext.Tr("dde-control-center"),
478478
0,
479479
icon,
480480
message,

bin/dde-session-daemon/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ func sendLoginNotify() {
476476
notify := notifications.NewNotifications(session)
477477
_, err = notify.Notify(
478478
0,
479-
"dde-control-center",
479+
Tr("dde-control-center"),
480480
0,
481481
icon,
482482
"",

bluetooth1/obex_agent.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ func (a *obexAgent) notifyProgress(notify notifications.Notifications, replaceID
377377
hints := map[string]dbus.Variant{"suppress-sound": dbus.MakeVariant(true)}
378378

379379
notifyID, err = notify.Notify(0,
380-
"dde-control-center",
380+
gettext.Tr("dde-control-center"),
381381
replaceID,
382382
notifyIconBluetoothConnected,
383383
fmt.Sprintf(gettext.Tr("Receiving %[1]q from %[2]q"), filename, device),
@@ -392,7 +392,7 @@ func (a *obexAgent) notifyProgress(notify notifications.Notifications, replaceID
392392
actions = []string{"_view", gettext.Tr("View")}
393393
hints := map[string]dbus.Variant{"x-deepin-action-_view": dbus.MakeVariant("xdg-open," + receiveBaseDir)}
394394
notifyID, err = notify.Notify(0,
395-
"dde-control-center",
395+
gettext.Tr("dde-control-center"),
396396
replaceID,
397397
notifyIconBluetoothConnected,
398398
fmt.Sprintf(gettext.Tr("You have received files from %q successfully"), device),
@@ -419,7 +419,7 @@ func (a *obexAgent) notifyFailed(notify notifications.Notifications, replaceID u
419419
}
420420

421421
notifyID, err := notify.Notify(0,
422-
"dde-control-center",
422+
gettext.Tr("dde-control-center"),
423423
replaceID,
424424
notifyIconBluetoothConnectFailed,
425425
summary,
@@ -452,7 +452,7 @@ func (a *obexAgent) requestReceive(deviceName, filename string) (bool, error) {
452452

453453
actions := []string{"decline", gettext.Tr("Decline"), "receive", gettext.Tr("Receive")}
454454
notifyID, err := notify.Notify(0,
455-
"dde-control-center",
455+
gettext.Tr("dde-control-center"),
456456
0,
457457
notifyIconBluetoothConnected,
458458
gettext.Tr("Bluetooth File Transfer"),
@@ -507,7 +507,7 @@ func (a *obexAgent) requestReceive(deviceName, filename string) (bool, error) {
507507
// notifyReceiveFileTimeout 接收文件请求超时通知
508508
func (a *obexAgent) notifyReceiveFileTimeout(notify notifications.Notifications, replaceID uint32, filename string) {
509509
_, err := notify.Notify(0,
510-
"dde-control-center",
510+
gettext.Tr("dde-control-center"),
511511
replaceID,
512512
notifyIconBluetoothConnectFailed,
513513
gettext.Tr("Stop Receiving Files"),

bluetooth1/utils_notify.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func notify(icon, summary, body string) {
7474
nid := globalNotifyId
7575
globalNotifyMu.Unlock()
7676

77-
nid, err := globalNotifications.Notify(0, "dde-control-center", nid, icon,
77+
nid, err := globalNotifications.Notify(0, Tr("dde-control-center"), nid, icon,
7878
summary, body, nil, nil, -1)
7979
if err != nil {
8080
logger.Warning(err)
@@ -140,7 +140,7 @@ func notifyPassiveConnect(dev *DeviceInfo, pinCode string) error {
140140

141141
// notify connect request to dde-control-center
142142
// set notify time out as -1, default time out is 5 seconds
143-
nid, err = globalNotifications.Notify(0, "dde-control-center", nid, notifyIconBluetoothConnected,
143+
nid, err = globalNotifications.Notify(0, Tr("dde-control-center"), nid, notifyIconBluetoothConnected,
144144
summary, body, as, hints, 30*1000)
145145
if err != nil {
146146
logger.Warningf("notify message failed,err:%v", err)

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
dde-daemon (6.0.41) unstable; urgency=medium
2+
3+
* Add translations of dde-control-center in notification titles
4+
5+
-- Yutao Meng <mengyutao@deepin.org> Thu, 06 Jun 2024 13:28:25 +0800
6+
17
dde-daemon (6.0.40) unstable; urgency=medium
28

39
* chore(deps): bump golang.org/x/net from 0.17.0 to 0.23.0

housekeeping/init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func sendNotify(icon, summary, body string) error {
103103
return err
104104
}
105105
notifier := notifications.NewNotifications(sessionConn)
106-
_, err = notifier.Notify(0, "dde-control-center", 0,
106+
_, err = notifier.Notify(0, Tr("dde-control-center"), 0,
107107
icon, summary, body,
108108
nil, nil, -1)
109109
return err

langselector1/locale.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828

2929
gio "github.com/linuxdeepin/go-gir/gio-2.0"
3030
"github.com/linuxdeepin/go-lib/dbusutil"
31-
. "github.com/linuxdeepin/go-lib/gettext"
31+
. "github.com/linuxdeepin/go-lib/gettext"
3232
"github.com/linuxdeepin/go-lib/gsettings"
3333
"github.com/linuxdeepin/go-lib/strv"
3434
"github.com/linuxdeepin/go-lib/xdg/basedir"
@@ -236,7 +236,7 @@ func sendNotify(icon, summary, body string) {
236236
return
237237
}
238238
n := notifications.NewNotifications(sessionBus)
239-
_, err = n.Notify(0, "dde-control-center", 0,
239+
_, err = n.Notify(0, Tr("dde-control-center"), 0,
240240
icon, summary, body,
241241
nil, nil, -1)
242242
logger.Debugf("send notification icon: %q, summary: %q, body: %q",

lastore1/notify.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,20 @@ func (l *Lastore) notifyLowPower() {
116116

117117
func (l *Lastore) notifyAutoClean() {
118118
msg := gettext.Tr("Package cache wiped")
119-
l.sendNotify("deepin-appstore", "", msg, nil, nil, notifyExpireTimeoutDefault, "dde-control-center")
119+
l.sendNotify("deepin-appstore", "", msg, nil, nil, notifyExpireTimeoutDefault, gettext.Tr("dde-control-center"))
120120
}
121121

122122
func (l *Lastore) notifyUpdateSource(actions []NotifyAction) {
123123
msg := gettext.Tr("Updates Available")
124-
l.sendNotify("preferences-system", "", msg, actions, nil, notifyExpireTimeoutDefault, "dde-control-center")
124+
l.sendNotify("preferences-system", "", msg, actions, nil, notifyExpireTimeoutDefault, gettext.Tr(gettext.Tr("dde-control-center")))
125125
}
126126

127127
func (l *Lastore) updateSucceedNotify(actions []NotifyAction) {
128128
summary := gettext.Tr("Reboot after Updates")
129129
msg := gettext.Tr("Restart the computer to use the system and applications properly")
130130
hints := map[string]dbus.Variant{"x-deepin-action-RebootNow": dbus.MakeVariant("busctl,--user,call,org.deepin.dde.SessionManager1," +
131131
"/org/deepin/dde/SessionManager1,org.deepin.dde.SessionManager1,RequestReboot")}
132-
l.sendNotify(systemUpdatedIcon, summary, msg, actions, hints, notifyExpireTimeoutReboot, "dde-control-center")
132+
l.sendNotify(systemUpdatedIcon, summary, msg, actions, hints, notifyExpireTimeoutReboot, gettext.Tr(gettext.Tr("dde-control-center")))
133133

134134
// 默认弹出横幅时间为每2小时
135135
l.resetUpdateSucceedNotifyTimer(l.intervalTime)
@@ -139,7 +139,7 @@ func (l *Lastore) lowBatteryInUpdatingNotify() {
139139
msg := gettext.Tr("Your system is being updated, but the capacity is lower than 50%, please plug in to avoid power outage")
140140
actions := []string{"ok", gettext.Tr("OK")}
141141
notifyID, err := l.notifications.Notify(0,
142-
"dde-control-center",
142+
gettext.Tr("dde-control-center"),
143143
0,
144144
systemUpdatedIcon,
145145
"",

misc/po/dde-daemon.pot

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2024-03-19 13:21+0800\n"
11+
"POT-Creation-Date: 2024-06-04 07:52+0000\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -505,6 +505,11 @@ msgstr ""
505505
msgid "Package cache wiped"
506506
msgstr ""
507507

508+
#: ../../lastore1/notify.go:119 ../../lastore1/notify.go:124
509+
#: ../../lastore1/notify.go:132
510+
msgid "dde-control-center"
511+
msgstr "deepin Control Center"
512+
508513
#: ../../lastore1/notify.go:123
509514
msgid "Updates Available"
510515
msgstr ""

0 commit comments

Comments
 (0)