Skip to content

Commit 2097a48

Browse files
author
Lobster
committed
Fix translation when user has no language set
1 parent 14f195f commit 2097a48

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/redmine_zulip/issue_patch.rb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ def zulip_api
110110
end
111111

112112
def notify_assignment
113-
locale = assigned_to.language
113+
locale = assigned_to.language.present? ?
114+
assigned_to.language : Setting.default_language
114115
message = I18n.t("zulip_notify_assignment", {
115116
locale: locale,
116117
user: User.current.name,
@@ -141,12 +142,15 @@ def notify_unassignment
141142
previous_assigned_to = User.find(
142143
previous_changes["assigned_to_id"].first
143144
)
145+
locale = previous_assigned_to.language.present? ?
146+
previous_assigned_to.language : Setting.default_language
144147
message = I18n.t("zulip_notify_unassignment", {
145148
user: User.current.name,
146149
id: id,
147150
url: url,
148151
project: project.name,
149-
subject: subject_without_punctuation
152+
subject: subject_without_punctuation,
153+
locale: locale
150154
})
151155
zulip_api.messages.send(
152156
type: "private",
@@ -156,7 +160,8 @@ def notify_unassignment
156160
end
157161

158162
def notify_assigned_to_issue_updated
159-
locale = assigned_to.language
163+
locale = assigned_to.language.present? ?
164+
assigned_to.language : Setting.default_language
160165
message = I18n.t("zulip_notify_updated", {
161166
user: User.current.name,
162167
id: id,
@@ -216,7 +221,8 @@ def notify_assigned_to_issue_updated
216221
end
217222

218223
def notify_assigned_to_issue_destroyed
219-
locale = assigned_to.language
224+
locale = assigned_to.language.present? ?
225+
assigned_to.language : Setting.default_language
220226
message = I18n.t("zulip_notify_destroyed", {
221227
user: User.current.name,
222228
id: id,

0 commit comments

Comments
 (0)