From 3275b8f68f167c9b533ff215091e4fd4e132069a Mon Sep 17 00:00:00 2001 From: keven1024 Date: Sat, 23 May 2026 21:16:55 +0800 Subject: [PATCH] feat(i18n): update email notification translations across multiple languages for improved clarity and consistency --- pkg/i18n/locales/active.de.toml | 13 +++----- pkg/i18n/locales/active.en.toml | 13 +++----- pkg/i18n/locales/active.fr.toml | 13 +++----- pkg/i18n/locales/active.ja.toml | 13 +++----- pkg/i18n/locales/active.ko.toml | 13 +++----- pkg/i18n/locales/active.zh-CN.toml | 13 +++----- pkg/i18n/locales/active.zh-TW.toml | 13 +++----- pkg/mail/emails/pull-notify.tsx | 49 ++++++++++++++++++++++++++++++ pkg/mail/go.mod | 3 ++ pkg/mail/mail.go | 29 ++++++++++++++++++ pkg/mail/package.json | 20 ++++++++++++ pkg/mail/tsconfig.json | 14 +++++++++ 12 files changed, 150 insertions(+), 56 deletions(-) create mode 100644 pkg/mail/emails/pull-notify.tsx create mode 100644 pkg/mail/go.mod create mode 100644 pkg/mail/mail.go create mode 100644 pkg/mail/package.json create mode 100644 pkg/mail/tsconfig.json diff --git a/pkg/i18n/locales/active.de.toml b/pkg/i18n/locales/active.de.toml index 43cbb99..a91a12e 100644 --- a/pkg/i18n/locales/active.de.toml +++ b/pkg/i18n/locales/active.de.toml @@ -1,11 +1,8 @@ [notify_email_subject] -other = "Benachrichtigung zum Share-Download - {{.SiteURL}}" +other = "Benachrichtigung zum Zugriff auf die Freigabe - {{.SiteURL}}" -[notify_email_body] -other = "Ihr geteilter {{.ShareType}} {{.FileName}} wurde heruntergeladen." +[notify_email_intro] +other = "Ihre Freigabe wurde von einem anderen Nutzer abgerufen" -[share_type_file] -other = "Datei" - -[share_type_text] -other = "Text" +[notify_email_label_region] +other = "Region" diff --git a/pkg/i18n/locales/active.en.toml b/pkg/i18n/locales/active.en.toml index 59b0acd..66f699b 100644 --- a/pkg/i18n/locales/active.en.toml +++ b/pkg/i18n/locales/active.en.toml @@ -1,11 +1,8 @@ [notify_email_subject] -other = "Share download notification - {{.SiteURL}}" +other = "Share access notification - {{.SiteURL}}" -[notify_email_body] -other = "Your shared {{.ShareType}} {{.FileName}} was downloaded." +[notify_email_intro] +other = "Your share has been accessed by another user" -[share_type_file] -other = "file" - -[share_type_text] -other = "text" +[notify_email_label_region] +other = "Region" diff --git a/pkg/i18n/locales/active.fr.toml b/pkg/i18n/locales/active.fr.toml index fd5645a..eef3d98 100644 --- a/pkg/i18n/locales/active.fr.toml +++ b/pkg/i18n/locales/active.fr.toml @@ -1,11 +1,8 @@ [notify_email_subject] -other = "Notification de téléchargement du partage - {{.SiteURL}}" +other = "Notification d'accès au partage - {{.SiteURL}}" -[notify_email_body] -other = "Votre {{.ShareType}} partagé {{.FileName}} a été téléchargé." +[notify_email_intro] +other = "Votre partage a été consulté par un autre utilisateur" -[share_type_file] -other = "fichier" - -[share_type_text] -other = "texte" +[notify_email_label_region] +other = "Région" diff --git a/pkg/i18n/locales/active.ja.toml b/pkg/i18n/locales/active.ja.toml index 9ed077b..97c78e0 100644 --- a/pkg/i18n/locales/active.ja.toml +++ b/pkg/i18n/locales/active.ja.toml @@ -1,11 +1,8 @@ [notify_email_subject] -other = "共有ダウンロード通知 - {{.SiteURL}}" +other = "共有アクセス通知 - {{.SiteURL}}" -[notify_email_body] -other = "共有した{{.ShareType}} {{.FileName}} がダウンロードされました。" +[notify_email_intro] +other = "あなたの共有が別のユーザーにアクセスされました" -[share_type_file] -other = "ファイル" - -[share_type_text] -other = "テキスト" +[notify_email_label_region] +other = "地域" diff --git a/pkg/i18n/locales/active.ko.toml b/pkg/i18n/locales/active.ko.toml index c7eaa4c..881b823 100644 --- a/pkg/i18n/locales/active.ko.toml +++ b/pkg/i18n/locales/active.ko.toml @@ -1,11 +1,8 @@ [notify_email_subject] -other = "공유 다운로드 알림 - {{.SiteURL}}" +other = "공유 접근 알림 - {{.SiteURL}}" -[notify_email_body] -other = "공유한 {{.ShareType}} {{.FileName}} 이(가) 다운로드되었습니다." +[notify_email_intro] +other = "공유가 다른 사용자에 의해 접근되었습니다" -[share_type_file] -other = "파일" - -[share_type_text] -other = "텍스트" +[notify_email_label_region] +other = "지역" diff --git a/pkg/i18n/locales/active.zh-CN.toml b/pkg/i18n/locales/active.zh-CN.toml index ff53b2b..483608e 100644 --- a/pkg/i18n/locales/active.zh-CN.toml +++ b/pkg/i18n/locales/active.zh-CN.toml @@ -1,11 +1,8 @@ [notify_email_subject] -other = "分享下载通知 - {{.SiteURL}}" +other = "分享访问通知 - {{.SiteURL}}" -[notify_email_body] -other = "IP为{{.IP}}的访客下载了你的{{.FileName}}的{{.ShareType}}。" +[notify_email_intro] +other = "您的分享已被其他用户访问" -[share_type_file] -other = "文件" - -[share_type_text] -other = "文本" +[notify_email_label_region] +other = "区域" \ No newline at end of file diff --git a/pkg/i18n/locales/active.zh-TW.toml b/pkg/i18n/locales/active.zh-TW.toml index 670b9d8..df392b1 100644 --- a/pkg/i18n/locales/active.zh-TW.toml +++ b/pkg/i18n/locales/active.zh-TW.toml @@ -1,11 +1,8 @@ [notify_email_subject] -other = "分享下載通知 - {{.SiteURL}}" +other = "分享存取通知 - {{.SiteURL}}" -[notify_email_body] -other = "IP為{{.IP}}的訪客下載了你的{{.FileName}}的{{.ShareType}}。" +[notify_email_intro] +other = "您的分享已被其他用戶存取" -[share_type_file] -other = "檔案" - -[share_type_text] -other = "文字" +[notify_email_label_region] +other = "區域" diff --git a/pkg/mail/emails/pull-notify.tsx b/pkg/mail/emails/pull-notify.tsx new file mode 100644 index 0000000..20d53f4 --- /dev/null +++ b/pkg/mail/emails/pull-notify.tsx @@ -0,0 +1,49 @@ +import { Body, Container, Head, Heading, Html, Tailwind, Text, Img, Row, Column, Hr, Link } from 'react-email' + +export const NotionMagicLinkEmail = () => ( + + + + + + EMAIL-TITLE + EMAIL-INTRO + + + + + + + EMAIL-FILENAME + + + + + + + EMAIL-IP + + + IP + + + + + EMAIL-REGION + + + EMAIL-LABEL-REGION + + + +
+ + Powered by 015 + +
+ +
+ +) + +export default NotionMagicLinkEmail diff --git a/pkg/mail/go.mod b/pkg/mail/go.mod new file mode 100644 index 0000000..d2a11fc --- /dev/null +++ b/pkg/mail/go.mod @@ -0,0 +1,3 @@ +module pkg/mail + +go 1.25.5 diff --git a/pkg/mail/mail.go b/pkg/mail/mail.go new file mode 100644 index 0000000..32f78a1 --- /dev/null +++ b/pkg/mail/mail.go @@ -0,0 +1,29 @@ +package mail + +import ( + "embed" + "fmt" + "strings" +) + +//go:embed out/*.html +var templates embed.FS + +func GetMailTemplate(name string) (string, error) { + data, err := templates.ReadFile(fmt.Sprintf("out/%s.html", name)) + if err != nil { + return "", fmt.Errorf("mail template %q not found", name) + } + return string(data), nil +} + +func RenderMailTemplate(name string, vars map[string]string) (string, error) { + html, err := GetMailTemplate(name) + if err != nil { + return "", err + } + for k, v := range vars { + html = strings.ReplaceAll(html, k, v) + } + return html, nil +} diff --git a/pkg/mail/package.json b/pkg/mail/package.json new file mode 100644 index 0000000..7156c39 --- /dev/null +++ b/pkg/mail/package.json @@ -0,0 +1,20 @@ +{ + "name": "react-email-starter", + "version": "1.1.0", + "private": true, + "scripts": { + "build": "email build", + "dev": "email dev", + "export": "email export" + }, + "dependencies": { + "react-email": "6.0.7", + "react-dom": "19.2.4", + "react": "19.2.4" + }, + "devDependencies": { + "@react-email/ui": "6.0.7", + "@types/react": "19.2.14", + "@types/react-dom": "19.2.3" + } +} diff --git a/pkg/mail/tsconfig.json b/pkg/mail/tsconfig.json new file mode 100644 index 0000000..0a11af2 --- /dev/null +++ b/pkg/mail/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "composite": false, + "module": "ESNext", + "moduleResolution": "bundler", + "jsx": "react-jsx", + "skipLibCheck": true, + "strict": true, + "noEmit": true, + "strictNullChecks": true + }, + "include": ["**/*.ts", "**/*.tsx"], + "exclude": ["node_modules", ".react-email"] +}