From e3f006c5274fbb25f542a2fe594e9a1343bca8c9 Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 20 Mar 2025 17:41:45 +0100 Subject: [PATCH] fix(i18n): add missing translations --- pkg/i18n/lang/en.json | 14 ++++++++++++- pkg/models/notifications.go | 20 +++++++++---------- .../migration/handler/notifications.go | 2 +- pkg/user/notifications.go | 12 +++++------ 4 files changed, 30 insertions(+), 18 deletions(-) diff --git a/pkg/i18n/lang/en.json b/pkg/i18n/lang/en.json index 40276f0c8..7c7b5be19 100644 --- a/pkg/i18n/lang/en.json +++ b/pkg/i18n/lang/en.json @@ -132,7 +132,19 @@ }, "common": { "have_nice_day": "Have a nice day!", - "copy_url": "If the button above doesn't work, copy the url below and paste it in your browser's address bar:" + "copy_url": "If the button above doesn't work, copy the url below and paste it in your browser's address bar:", + "actions": { + "open_task": "Open Task", + "open_vikunja": "Open Vikunja", + "open_project": "Open Project", + "open_team": "Open Team", + "download": "Download", + "reset_password": "Reset your password", + "go_to_settings": "Go to settings", + "confirm_email": "Confirm your email address", + "abort_deletion": "Abort the deletion", + "confirm_account_deletion": "Confirm the deletion of my account" + } } } } \ No newline at end of file diff --git a/pkg/models/notifications.go b/pkg/models/notifications.go index 07023798b..0a6120c7d 100644 --- a/pkg/models/notifications.go +++ b/pkg/models/notifications.go @@ -43,7 +43,7 @@ func (n *ReminderDueNotification) ToMail(lang string) *notifications.Mail { Subject(i18n.T(lang, "notifications.task.reminder.subject", n.Task.Title, n.Project.Title)). Greeting(i18n.T(lang, "notifications.greeting", n.User.GetName())). Line(i18n.T(lang, "notifications.task.reminder.message", n.Task.Title, n.Project.Title)). - Action("Open Task", config.ServicePublicURL.GetString()+"tasks/"+strconv.FormatInt(n.Task.ID, 10)). + Action(i18n.T(lang, "notifications.common.actions.open_task"), config.ServicePublicURL.GetString()+"tasks/"+strconv.FormatInt(n.Task.ID, 10)). Line(i18n.T(lang, "notifications.common.have_nice_day")) } @@ -88,7 +88,7 @@ func (n *TaskCommentNotification) ToMail(lang string) *notifications.Mail { mail.HTML(n.Comment.Comment) return mail. - Action("View Task", n.Task.GetFrontendURL()) + Action(i18n.T(lang, "notifications.common.actions.open_task"), n.Task.GetFrontendURL()) } // ToDB returns the TaskCommentNotification notification in a format which can be saved in the db @@ -115,13 +115,13 @@ func (n *TaskAssignedNotification) ToMail(lang string) *notifications.Mail { return notifications.NewMail(). Subject(i18n.T(lang, "notifications.task.assigned.subject_to_assignee", n.Task.Title, n.Task.GetFullIdentifier())). Line(i18n.T(lang, "notifications.task.assigned.message_to_assignee", n.Doer.GetName(), n.Task.Title)). - Action("View Task", n.Task.GetFrontendURL()) + Action(i18n.T(lang, "notifications.common.actions.open_task"), n.Task.GetFrontendURL()) } return notifications.NewMail(). Subject(i18n.T(lang, "notifications.task.assigned.subject_to_others", n.Task.Title, n.Task.GetFullIdentifier(), n.Assignee.GetName())). Line(i18n.T(lang, "notifications.task.assigned.message_to_others", n.Doer.GetName(), n.Assignee.GetName())). - Action("View Task", n.Task.GetFrontendURL()) + Action(i18n.T(lang, "notifications.common.actions.open_task"), n.Task.GetFrontendURL()) } // ToDB returns the TaskAssignedNotification notification in a format which can be saved in the db @@ -168,7 +168,7 @@ func (n *ProjectCreatedNotification) ToMail(lang string) *notifications.Mail { return notifications.NewMail(). Subject(i18n.T(lang, "notifications.project.created", n.Doer.GetName(), n.Project.Title)). Line(i18n.T(lang, "notifications.project.created", n.Doer.GetName(), n.Project.Title)). - Action("View Project", config.ServicePublicURL.GetString()+"projects/") + Action(i18n.T(lang, "notifications.common.actions.open_project"), config.ServicePublicURL.GetString()+"projects/") } // ToDB returns the ProjectCreatedNotification notification in a format which can be saved in the db @@ -195,7 +195,7 @@ func (n *TeamMemberAddedNotification) ToMail(lang string) *notifications.Mail { From(n.Doer.GetNameAndFromEmail()). Greeting(i18n.T(lang, "notifications.greeting", n.Member.GetName())). Line(i18n.T(lang, "notifications.team.member_added.message", n.Doer.GetName(), n.Team.Name)). - Action("View Team", config.ServicePublicURL.GetString()+"teams/"+strconv.FormatInt(n.Team.ID, 10)+"/edit") + Action(i18n.T(lang, "notifications.common.actions.open_team"), config.ServicePublicURL.GetString()+"teams/"+strconv.FormatInt(n.Team.ID, 10)+"/edit") } // ToDB returns the TeamMemberAddedNotification notification in a format which can be saved in the db @@ -232,7 +232,7 @@ func (n *UndoneTaskOverdueNotification) ToMail(lang string) *notifications.Mail Subject(i18n.T(lang, "notifications.task.overdue.subject", n.Task.Title, n.Project.Title)). Greeting(i18n.T(lang, "notifications.greeting", n.User.GetName())). Line(i18n.T(lang, "notifications.task.overdue.message", n.Task.Title, n.Project.Title, getOverdueSinceString(until, n.User.Language))). - Action("Open Task", config.ServicePublicURL.GetString()+"tasks/"+strconv.FormatInt(n.Task.ID, 10)). + Action(i18n.T(lang, "notifications.common.actions.open_task"), config.ServicePublicURL.GetString()+"tasks/"+strconv.FormatInt(n.Task.ID, 10)). Line(i18n.T(lang, "notifications.common.have_nice_day")) } @@ -277,7 +277,7 @@ func (n *UndoneTasksOverdueNotification) ToMail(lang string) *notifications.Mail Greeting(i18n.T(lang, "notifications.greeting", n.User.GetName())). Line(i18n.T(lang, "notifications.task.overdue.multiple_message")). Line(overdueLine). - Action("Open Vikunja", config.ServicePublicURL.GetString()). + Action(i18n.T(lang, "notifications.common.actions.open_vikunja"), config.ServicePublicURL.GetString()). Line(i18n.T(lang, "notifications.common.have_nice_day")) } @@ -318,7 +318,7 @@ func (n *UserMentionedInTaskNotification) ToMail(lang string) *notifications.Mai HTML(n.Task.Description) return mail. - Action("View Task", n.Task.GetFrontendURL()) + Action(i18n.T(lang, "notifications.common.actions.open_task"), n.Task.GetFrontendURL()) } // ToDB returns the UserMentionedInTaskNotification notification in a format which can be saved in the db @@ -342,7 +342,7 @@ func (n *DataExportReadyNotification) ToMail(lang string) *notifications.Mail { Subject(i18n.T(lang, "notifications.data_export.ready.subject")). Greeting(i18n.T(lang, "notifications.greeting", n.User.GetName())). Line(i18n.T(lang, "notifications.data_export.ready.message")). - Action("Download", config.ServicePublicURL.GetString()+"user/export/download"). + Action(i18n.T(lang, "notifications.common.actions.download"), config.ServicePublicURL.GetString()+"user/export/download"). Line(i18n.T(lang, "notifications.data_export.ready.availability")). Line(i18n.T(lang, "notifications.common.have_nice_day")) } diff --git a/pkg/modules/migration/handler/notifications.go b/pkg/modules/migration/handler/notifications.go index 5c2633bf0..f5e437c18 100644 --- a/pkg/modules/migration/handler/notifications.go +++ b/pkg/modules/migration/handler/notifications.go @@ -37,7 +37,7 @@ func (n *MigrationDoneNotification) ToMail(lang string) *notifications.Mail { return notifications.NewMail(). Subject(i18n.T(lang, "notifications.migration.done.subject", kind)). Line(i18n.T(lang, "notifications.migration.done.imported", kind)). - Action("View your imported projects in Vikunja", config.ServicePublicURL.GetString()). + Action(i18n.T(lang, "notifications.common.actions.open_vikunja"), config.ServicePublicURL.GetString()). Line(i18n.T(lang, "notifications.migration.done.have_fun")) } diff --git a/pkg/user/notifications.go b/pkg/user/notifications.go index 82db479e2..40d42cb82 100644 --- a/pkg/user/notifications.go +++ b/pkg/user/notifications.go @@ -49,7 +49,7 @@ func (n *EmailConfirmNotification) ToMail(lang string) *notifications.Mail { return nn. Line(i18n.T(lang, "notifications.email_confirm.confirm")). - Action("Confirm your email address", config.ServicePublicURL.GetString()+"?userEmailConfirm="+n.ConfirmToken). + Action(i18n.T(lang, "notifications.common.actions.confirm_email"), config.ServicePublicURL.GetString()+"?userEmailConfirm="+n.ConfirmToken). Line(i18n.T(lang, "notifications.common.have_nice_day")) } @@ -99,7 +99,7 @@ func (n *ResetPasswordNotification) ToMail(lang string) *notifications.Mail { Subject(i18n.T(lang, "notifications.password.reset.subject")). Greeting(i18n.T(lang, "notifications.greeting", n.User.GetName())). Line(i18n.T(lang, "notifications.password.reset.instructions")). - Action("Reset your password", config.ServicePublicURL.GetString()+"?userPasswordReset="+n.Token.Token). + Action(i18n.T(lang, "notifications.common.actions.reset_password"), config.ServicePublicURL.GetString()+"?userPasswordReset="+n.Token.Token). Line(i18n.T(lang, "notifications.password.reset.valid_duration")). Line(i18n.T(lang, "notifications.common.have_nice_day")) } @@ -126,7 +126,7 @@ func (n *InvalidTOTPNotification) ToMail(lang string) *notifications.Mail { Greeting(i18n.T(lang, "notifications.greeting", n.User.GetName())). Line(i18n.T(lang, "notifications.totp.invalid.message")). Line(i18n.T(lang, "notifications.totp.invalid.warning")). - Action("Reset your password", config.ServicePublicURL.GetString()+"get-password-reset") + Action(i18n.T(lang, "notifications.common.actions.reset_password"), config.ServicePublicURL.GetString()+"get-password-reset") } // ToDB returns the InvalidTOTPNotification notification in a format which can be saved in the db @@ -178,7 +178,7 @@ func (n *FailedLoginAttemptNotification) ToMail(lang string) *notifications.Mail Line(i18n.T(lang, "notifications.login.failed.message")). Line(i18n.T(lang, "notifications.login.failed.warning")). Line(i18n.T(lang, "notifications.login.failed.enhance_security")). - Action("Go to settings", config.ServicePublicURL.GetString()+"user/settings") + Action(i18n.T(lang, "notifications.common.actions.go_to_settings"), config.ServicePublicURL.GetString()+"user/settings") } // ToDB returns the FailedLoginAttemptNotification notification in a format which can be saved in the db @@ -203,7 +203,7 @@ func (n *AccountDeletionConfirmNotification) ToMail(lang string) *notifications. Subject(i18n.T(lang, "notifications.account.deletion.confirm.subject")). Greeting(i18n.T(lang, "notifications.greeting", n.User.GetName())). Line(i18n.T(lang, "notifications.account.deletion.confirm.request")). - Action("Confirm the deletion of my account", config.ServicePublicURL.GetString()+"?accountDeletionConfirm="+n.ConfirmToken). + Action(i18n.T(lang, "notifications.common.actions.confirm_account_deletion"), config.ServicePublicURL.GetString()+"?accountDeletionConfirm="+n.ConfirmToken). Line(i18n.T(lang, "notifications.account.deletion.confirm.valid_duration")). Line(i18n.T(lang, "notifications.account.deletion.confirm.schedule_info")). Line(i18n.T(lang, "notifications.account.deletion.confirm.consequences")). @@ -247,7 +247,7 @@ func (n *AccountDeletionNotification) ToMail(lang string) *notifications.Mail { Line(i18n.T(lang, "notifications.account.deletion.scheduled.request_reminder")). Line(deletionTimeLine). Line(i18n.T(lang, "notifications.account.deletion.scheduled.changed_mind")). - Action("Abort the deletion", config.ServicePublicURL.GetString()). + Action(i18n.T(lang, "notifications.common.actions.abort_deletion"), config.ServicePublicURL.GetString()). Line(i18n.T(lang, "notifications.common.have_nice_day")) }