🌐 Fully localized notification
This commit is contained in:
parent
d7ee87433f
commit
b68aed0284
88
.idea/workspace.xml
generated
88
.idea/workspace.xml
generated
@ -4,29 +4,12 @@
|
||||
<option name="autoReloadType" value="ALL" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":sparkles: Account preferred language">
|
||||
<change afterPath="$PROJECT_DIR$/locales/en-US.json" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/locales/zh-CN.json" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/pkg/internal/services/i18n.go" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/templates/email/en-US/confirm-deletion.tmpl" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/templates/email/en-US/email-otp.tmpl" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/templates/email/en-US/register-confirm.tmpl" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/templates/email/en-US/reset-password.tmpl" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/templates/email/zh-CN/confirm-deletion.tmpl" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/templates/email/zh-CN/email-otp.tmpl" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/templates/email/zh-CN/register-confirm.tmpl" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/templates/email/zh-CN/reset-password.tmpl" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/dataSources.local.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources.local.xml" afterDir="false" />
|
||||
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":sparkles: Push email & notification localization">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dockerfile" beforeDir="false" afterPath="$PROJECT_DIR$/Dockerfile" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/go.mod" beforeDir="false" afterPath="$PROJECT_DIR$/go.mod" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/go.sum" beforeDir="false" afterPath="$PROJECT_DIR$/go.sum" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pkg/internal/http/api/accounts_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/http/api/accounts_api.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pkg/internal/http/api/factors_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/http/api/factors_api.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pkg/internal/services/factors.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/factors.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pkg/internal/services/tokens.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/tokens.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pkg/main.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/main.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/settings.toml" beforeDir="false" afterPath="$PROJECT_DIR$/settings.toml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/locales/en-US.json" beforeDir="false" afterPath="$PROJECT_DIR$/locales/en-US.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/locales/zh-CN.json" beforeDir="false" afterPath="$PROJECT_DIR$/locales/zh-CN.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pkg/internal/services/reports.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/reports.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pkg/internal/services/ticket.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/ticket.go" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -65,35 +48,35 @@
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"DefaultGoTemplateProperty": "Go File",
|
||||
"Go Build.Backend.executor": "Debug",
|
||||
"Go 构建.Backend.executor": "Run",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"RunOnceActivity.go.formatter.settings.were.checked": "true",
|
||||
"RunOnceActivity.go.migrated.go.modules.settings": "true",
|
||||
"RunOnceActivity.go.modules.automatic.dependencies.download": "true",
|
||||
"RunOnceActivity.go.modules.go.list.on.any.changes.was.set": "true",
|
||||
"git-widget-placeholder": "master",
|
||||
"go.import.settings.migrated": "true",
|
||||
"go.sdk.automatically.set": "true",
|
||||
"last_opened_file_path": "/Users/littlesheep/Documents/Projects/Hypernet/Passport",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"run.code.analysis.last.selected.profile": "pProject Default",
|
||||
"settings.editor.selected.configurable": "preferences.intentionPowerPack",
|
||||
"ts.external.directory.path": "/Users/littlesheep/Documents/Projects/Hydrogen/Passport/web/node_modules/typescript/lib",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"DefaultGoTemplateProperty": "Go File",
|
||||
"Go Build.Backend.executor": "Run",
|
||||
"Go 构建.Backend.executor": "Run",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"RunOnceActivity.go.formatter.settings.were.checked": "true",
|
||||
"RunOnceActivity.go.migrated.go.modules.settings": "true",
|
||||
"RunOnceActivity.go.modules.automatic.dependencies.download": "true",
|
||||
"RunOnceActivity.go.modules.go.list.on.any.changes.was.set": "true",
|
||||
"git-widget-placeholder": "master",
|
||||
"go.import.settings.migrated": "true",
|
||||
"go.sdk.automatically.set": "true",
|
||||
"last_opened_file_path": "/Users/littlesheep/Documents/Projects/Hypernet/Passport",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"run.code.analysis.last.selected.profile": "pProject Default",
|
||||
"settings.editor.selected.configurable": "preferences.intentionPowerPack",
|
||||
"ts.external.directory.path": "/Users/littlesheep/Documents/Projects/Hydrogen/Passport/web/node_modules/typescript/lib",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
},
|
||||
"keyToStringList": {
|
||||
"DatabaseDriversLRU": [
|
||||
"postgresql"
|
||||
"keyToStringList": {
|
||||
"DatabaseDriversLRU": [
|
||||
"postgresql"
|
||||
]
|
||||
}
|
||||
}</component>
|
||||
}]]></component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/keys" />
|
||||
@ -179,7 +162,6 @@
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
|
||||
<MESSAGE value=":loud_sound: Add verbose permission logging" />
|
||||
<MESSAGE value=":bug: Fix group permission didn't extend properly" />
|
||||
<MESSAGE value=":mute: Remove authenticate result logging" />
|
||||
<MESSAGE value=":truck: Rename daily-sign to check-in" />
|
||||
@ -204,7 +186,8 @@
|
||||
<MESSAGE value=":bug: Bug fixes on notifications" />
|
||||
<MESSAGE value=":bug: Fix list user relative return wrong data" />
|
||||
<MESSAGE value=":sparkles: Account preferred language" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value=":sparkles: Account preferred language" />
|
||||
<MESSAGE value=":sparkles: Push email & notification localization" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value=":sparkles: Push email & notification localization" />
|
||||
<option name="GROUP_MULTIFILE_MERGE_BY_DIRECTORY" value="true" />
|
||||
</component>
|
||||
<component name="VgoProject">
|
||||
@ -218,11 +201,6 @@
|
||||
<line>93</line>
|
||||
<option name="timeStamp" value="3" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/pkg/internal/services/notifications.go</url>
|
||||
<line>73</line>
|
||||
<option name="timeStamp" value="4" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
|
@ -3,5 +3,9 @@
|
||||
"shortBodyLoginOneTimePassword": "%s is your login verification code. It will expires in 30 minutes.",
|
||||
"subjectConfirmRegistration": "Confirm your registration",
|
||||
"subjectResetPassword": "Reset your password",
|
||||
"subjectDeleteAccount": "Confirm your account deletion"
|
||||
"subjectDeleteAccount": "Confirm your account deletion",
|
||||
"subjectLoginAlert": "Login alert",
|
||||
"shortBodyLoginAlert": "Your account got logged in from %s. If it's not your device, please deal with it immediately.",
|
||||
"subjectAbuseReportUpdated": "Abuse report status has been changed",
|
||||
"shortBodyAbuseReportUpdated": "Report #%d has been changed to %s. Moderator message: %s"
|
||||
}
|
@ -3,5 +3,9 @@
|
||||
"shortBodyLoginOneTimePassword": "%s 是您的登录验证码,它将在 30 分钟后过期。",
|
||||
"subjectConfirmRegistration": "确认您的注册",
|
||||
"subjectResetPassword": "重置您的密码",
|
||||
"subjectDeleteAccount": "确认您的帐户删除"
|
||||
"subjectDeleteAccount": "确认您的帐户删除",
|
||||
"subjectLoginAlert": "登陆提醒",
|
||||
"shortBodyLoginAlert": "您的帐户在 %s 登录,若它不是你的设备,请立即处理。",
|
||||
"subjectAbuseReportUpdated": "举报状态已更新",
|
||||
"shortBodyAbuseReportUpdated": "举报 #%d 已更新为 %s。管理员回复:%s"
|
||||
}
|
@ -42,9 +42,8 @@ func UpdateAbuseReportStatus(id uint, status, message string) error {
|
||||
|
||||
_ = NewNotification(models.Notification{
|
||||
Topic: "reports.feedback",
|
||||
Title: "Abuse report status has been changed.",
|
||||
Subtitle: fmt.Sprintf("The report #%d's status updated", id),
|
||||
Body: fmt.Sprintf("The report created by you with ID #%d's status has been changed to %s. Moderator message: %s", id, status, message),
|
||||
Title: GetLocalizedString("subjectAbuseReportUpdated", account.Language),
|
||||
Body: fmt.Sprintf(GetLocalizedString("shortBodyAbuseReportUpdated", account.Language), id, status, message),
|
||||
Account: account,
|
||||
AccountID: account.ID,
|
||||
})
|
||||
|
@ -130,9 +130,8 @@ func ActiveTicket(ticket models.AuthTicket) (models.AuthTicket, error) {
|
||||
} else {
|
||||
_ = NewNotification(models.Notification{
|
||||
Topic: "passport.security.alert",
|
||||
Title: "New sign in alert",
|
||||
Subtitle: fmt.Sprintf("New sign in from %s", ticket.IpAddress),
|
||||
Body: fmt.Sprintf("Your account just got a new sign in from %s. Make sure you recongize this device, or sign out it immediately and reset password.", ticket.IpAddress),
|
||||
Title: GetLocalizedString("subjectLoginAlert", ticket.Account.Language),
|
||||
Body: fmt.Sprintf(GetLocalizedString("shortBodyLoginAlert", ticket.Account.Language), ticket.IpAddress),
|
||||
Metadata: datatypes.JSONMap{
|
||||
"ip_address": ticket.IpAddress,
|
||||
"created_at": ticket.CreatedAt,
|
||||
|
Loading…
x
Reference in New Issue
Block a user