Localize daemon notifications via stable message keys

This commit is contained in:
Viktor Liu
2026-08-05 17:53:02 +02:00
parent f2318a8fef
commit b3ead5ee7e
37 changed files with 1592 additions and 261 deletions
+9 -3
View File
@@ -1281,12 +1281,15 @@ func (d *Status) numOfPeers() int {
return len(d.peers) + len(d.offlinePeers)
}
// PublishEvent adds an event to the queue and distributes it to all subscribers
// PublishEvent adds an event to the queue and distributes it to all subscribers.
// msg is the English log-facing description; userMsg is the localizable
// user-facing message, or nil for an internal control event that must not
// surface as a notification.
func (d *Status) PublishEvent(
severity proto.SystemEvent_Severity,
category proto.SystemEvent_Category,
msg string,
userMsg string,
userMsg *proto.UserMessage,
metadata map[string]string,
) {
event := &proto.SystemEvent{
@@ -1294,7 +1297,10 @@ func (d *Status) PublishEvent(
Severity: severity,
Category: category,
Message: msg,
UserMessage: userMsg,
UserMessage: userMsg.Text(),
MessageKey: string(userMsg.Key()),
MessageArgs: userMsg.Args(),
TitleKey: string(userMsg.TitleKey()),
Metadata: metadata,
Timestamp: timestamppb.Now(),
}