Skip to content

Commit

Permalink
fix: Add dde-control-center translations in notifications
Browse files Browse the repository at this point in the history
Issue: linuxdeepin/developer-center#8859
Log: Add dde-control-center translations in notifications
  • Loading branch information
ArchieMeng authored and zsien committed Jun 21, 2024
1 parent 3945d68 commit 9c41e3f
Show file tree
Hide file tree
Showing 18 changed files with 55 additions and 23 deletions.
2 changes: 1 addition & 1 deletion audio1/audio.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ func sendNotify(icon, summary, body string) {
return
}
n := notifications.NewNotifications(sessionBus)
_, err = n.Notify(0, "dde-control-center", 0,
_, err = n.Notify(0, Tr("dde-control-center"), 0,
icon, summary, body,
nil, nil, -1)
logger.Debugf("send notification icon: %q, summary: %q, body: %q",
Expand Down
2 changes: 1 addition & 1 deletion audio1/audio_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ func (a *Audio) notifyPortDisabled(cardId uint32, port pulse.CardPortInfo) {
notify := notifications.NewNotifications(session)
_, err = notify.Notify(
0,
"dde-control-center",
gettext.Tr("dde-control-center"),
0,
icon,
message,
Expand Down
2 changes: 1 addition & 1 deletion bin/dde-session-daemon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ func sendLoginNotify() {
notify := notifications.NewNotifications(session)
_, err = notify.Notify(
0,
"dde-control-center",
Tr("dde-control-center"),
0,
icon,
"",
Expand Down
10 changes: 5 additions & 5 deletions bluetooth1/obex_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ func (a *obexAgent) notifyProgress(notify notifications.Notifications, replaceID
hints := map[string]dbus.Variant{"suppress-sound": dbus.MakeVariant(true)}

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

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

actions := []string{"decline", gettext.Tr("Decline"), "receive", gettext.Tr("Receive")}
notifyID, err := notify.Notify(0,
"dde-control-center",
gettext.Tr("dde-control-center"),
0,
notifyIconBluetoothConnected,
gettext.Tr("Bluetooth File Transfer"),
Expand Down Expand Up @@ -507,7 +507,7 @@ func (a *obexAgent) requestReceive(deviceName, filename string) (bool, error) {
// notifyReceiveFileTimeout 接收文件请求超时通知
func (a *obexAgent) notifyReceiveFileTimeout(notify notifications.Notifications, replaceID uint32, filename string) {
_, err := notify.Notify(0,
"dde-control-center",
gettext.Tr("dde-control-center"),
replaceID,
notifyIconBluetoothConnectFailed,
gettext.Tr("Stop Receiving Files"),
Expand Down
4 changes: 2 additions & 2 deletions bluetooth1/utils_notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func notify(icon, summary, body string) {
nid := globalNotifyId
globalNotifyMu.Unlock()

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

// notify connect request to dde-control-center
// set notify time out as -1, default time out is 5 seconds
nid, err = globalNotifications.Notify(0, "dde-control-center", nid, notifyIconBluetoothConnected,
nid, err = globalNotifications.Notify(0, Tr("dde-control-center"), nid, notifyIconBluetoothConnected,
summary, body, as, hints, 30*1000)
if err != nil {
logger.Warningf("notify message failed,err:%v", err)
Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
dde-daemon (6.0.41) unstable; urgency=medium

* Add translations of dde-control-center in notification titles

-- Yutao Meng <[email protected]> Thu, 06 Jun 2024 13:28:25 +0800

dde-daemon (6.0.40) unstable; urgency=medium

* chore(deps): bump golang.org/x/net from 0.17.0 to 0.23.0
Expand Down
2 changes: 1 addition & 1 deletion housekeeping/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func sendNotify(icon, summary, body string) error {
return err
}
notifier := notifications.NewNotifications(sessionConn)
_, err = notifier.Notify(0, "dde-control-center", 0,
_, err = notifier.Notify(0, Tr("dde-control-center"), 0,
icon, summary, body,
nil, nil, -1)
return err
Expand Down
4 changes: 2 additions & 2 deletions langselector1/locale.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (

gio "github.com/linuxdeepin/go-gir/gio-2.0"
"github.com/linuxdeepin/go-lib/dbusutil"
. "github.com/linuxdeepin/go-lib/gettext"
. "github.com/linuxdeepin/go-lib/gettext"
"github.com/linuxdeepin/go-lib/gsettings"
"github.com/linuxdeepin/go-lib/strv"
"github.com/linuxdeepin/go-lib/xdg/basedir"
Expand Down Expand Up @@ -236,7 +236,7 @@ func sendNotify(icon, summary, body string) {
return
}
n := notifications.NewNotifications(sessionBus)
_, err = n.Notify(0, "dde-control-center", 0,
_, err = n.Notify(0, Tr("dde-control-center"), 0,
icon, summary, body,
nil, nil, -1)
logger.Debugf("send notification icon: %q, summary: %q, body: %q",
Expand Down
8 changes: 4 additions & 4 deletions lastore1/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,20 @@ func (l *Lastore) notifyLowPower() {

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

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

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

// 默认弹出横幅时间为每2小时
l.resetUpdateSucceedNotifyTimer(l.intervalTime)
Expand All @@ -139,7 +139,7 @@ func (l *Lastore) lowBatteryInUpdatingNotify() {
msg := gettext.Tr("Your system is being updated, but the capacity is lower than 50%, please plug in to avoid power outage")
actions := []string{"ok", gettext.Tr("OK")}
notifyID, err := l.notifications.Notify(0,
"dde-control-center",
gettext.Tr("dde-control-center"),
0,
systemUpdatedIcon,
"",
Expand Down
7 changes: 6 additions & 1 deletion misc/po/dde-daemon.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-03-19 13:21+0800\n"
"POT-Creation-Date: 2024-06-04 07:52+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -505,6 +505,11 @@ msgstr ""
msgid "Package cache wiped"
msgstr ""

#: ../../lastore1/notify.go:119 ../../lastore1/notify.go:124
#: ../../lastore1/notify.go:132
msgid "dde-control-center"
msgstr "deepin Control Center"

#: ../../lastore1/notify.go:123
msgid "Updates Available"
msgstr ""
Expand Down
5 changes: 5 additions & 0 deletions misc/po/en_US.po
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,11 @@ msgstr ""
msgid "Package cache wiped"
msgstr "Package cache wiped"

#: ../../lastore1/notify.go:119 ../../lastore1/notify.go:124
#: ../../lastore1/notify.go:132
msgid "dde-control-center"
msgstr "Control Center"

#: ../../lastore1/notify.go:123
msgid "Updates Available"
msgstr "Updates Available"
Expand Down
6 changes: 6 additions & 0 deletions misc/po/zh_CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,12 @@ msgstr "为防止自动关机,请连接电源以保证安全更新。"
msgid "Package cache wiped"
msgstr "已成功清理软件包缓存"

#: ../../lastore1/notify.go:119 ../../lastore1/notify.go:124
#: ../../lastore1/notify.go:132
msgid "dde-control-center"
msgstr "控制中心"


#: ../../lastore1/notify.go:123
msgid "Updates Available"
msgstr "检测到有更新可用"
Expand Down
5 changes: 5 additions & 0 deletions misc/po/zh_HK.po
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,11 @@ msgstr "為免自動關機,更新時請接上電源。"
msgid "Package cache wiped"
msgstr "已成功清理軟件包緩存 "

#: ../../lastore1/notify.go:119 ../../lastore1/notify.go:124
#: ../../lastore1/notify.go:132
msgid "dde-control-center"
msgstr "控制中心"

#: ../../lastore1/notify.go:123
msgid "Updates Available"
msgstr "檢測到有更新可用"
Expand Down
5 changes: 5 additions & 0 deletions misc/po/zh_TW.po
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,11 @@ msgstr "為防止自動關機,請在更新期間接上電源。"
msgid "Package cache wiped"
msgstr "已清除軟體包快取"

#: ../../lastore1/notify.go:119 ../../lastore1/notify.go:124
#: ../../lastore1/notify.go:132
msgid "dde-control-center"
msgstr "控制中心"

#: ../../lastore1/notify.go:123
msgid "Updates Available"
msgstr "檢測到有更新可用"
Expand Down
2 changes: 1 addition & 1 deletion network/proxychains/utils_notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func createNotify(appName string) func(string, string, string) {
}
}

var notify = createNotify("dde-control-center")
var notify = createNotify(Tr("dde-control-center"))

func notifyAppProxyEnabled() {
notify(notifyIconProxyEnabled, Tr("Network"), Tr("Application proxy is set successfully"))
Expand Down
2 changes: 1 addition & 1 deletion network/utils_notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func _notify(icon, summary, body string) {
nid := notifyId
notifyIdMu.Unlock()

nid, err := notification.Notify(0, "dde-control-center", nid,
nid, err := notification.Notify(0, Tr("dde-control-center"), nid,
icon, summary, body, nil, nil, -1)
if err != nil {
logger.Warning(err)
Expand Down
2 changes: 1 addition & 1 deletion service_trigger/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (m *Manager) notify(bodyNotify *sessionmsg.BodyNotify) {

appName := bodyNotify.AppName
if appName == "" {
appName = "dde-control-center"
appName = Tr("dde-control-center")
}

_, err := m.notifications.Notify(0, appName, 0, bodyNotify.Icon,
Expand Down
4 changes: 2 additions & 2 deletions session/power1/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,15 +331,15 @@ func (m *Manager) sendNotify(icon, summary, body string) {
return
}
n := m.helper.Notifications
_, err := n.Notify(0, "dde-control-center", 0, icon, summary, body, nil, nil, -1)
_, err := n.Notify(0, Tr("dde-control-center"), 0, icon, summary, body, nil, nil, -1)
if err != nil {
logger.Warning(err)
}
}

func (m *Manager) sendChangeNotify(icon, summary, body string) {
n := m.helper.Notifications
_, err := n.Notify(0, "dde-control-center", 0, icon, summary, body, nil, nil, -1)
_, err := n.Notify(0, Tr("dde-control-center"), 0, icon, summary, body, nil, nil, -1)
if err != nil {
logger.Warning(err)
}
Expand Down

0 comments on commit 9c41e3f

Please sign in to comment.