"""动态广场域(feed)通知模板 —— @提及 / 评论 / 点赞。 推翻 2026-06-01 的「feed 系统文案只发英文」决定:这四条通知与其它域的 通知混在同一个铃铛里,收件人看到的是中英混排。系统文案改为按收件人语言 渲染,用户手写内容(动态正文、评论正文)仍原样透传、不翻译 —— 作者写 什么语言就是什么语言。 覆盖的 key: * ``feed.mention.post`` — 有人在动态里 @ 你 * ``feed.mention.comment`` — 有人在评论里 @ 你 * ``feed.comment.added`` — 有人评论了你的动态 * ``feed.like.aggregated`` — 有人赞了你的动态(仅站内铃铛,不推飞书) * ``feed.blessing.received.birthday`` / ``.anniversary`` — 有人给你送祝福 * ``feed.blessing.aggregated`` — 同一场庆祝短时间内的后续祝福,折叠成一条 * ``feed.celebration.self.{birthday,anniversary,welcome}`` — 生日 / 周年 / 入职欢迎,发给本人 * ``feed.celebration.{manager,hrbp}.{birthday,anniversary}`` — 发给经理 / HRBP cron 驱动的庆祝卡片这一族 **2026-08-17 补齐**:在此之前它们是生产端渲染的 纯英文,全公司(含 107 位 zh_CN 读者)都只收到英文;卡片 section / subtitle 现在在生产方用 ``LocalizedText``,正文与标题在这里。 Placeholder 来自 ``app/domains/feed/notifications.py`` 各调用点的 envelope ``context``。这四条只走 ``push_inbox_and_feishu``(铃铛 + 飞书 卡片,无邮件),所以正文里不放 ``{cta_line}`` —— 那条线在这两个渠道上 恒为空,只会多出空行。飞书卡片的按钮文案走 ``card_button_label``。 """ from __future__ import annotations TEMPLATES: dict[str, dict[str, str]] = { # ── @提及:动态正文里 @ 了收件人 ────────────────────────────── # context: author_name, post_body "feed.mention.post": { "subject": "📣 {author_name} 在动态里 @ 了你", "subject_en": "📣 {author_name} mentioned you in a post", "subject_ja": "📣 {author_name} さんが投稿であなたをメンションしました", "body_text": "{post_body}", "body_text_en": "{post_body}", "body_text_ja": "{post_body}", "card_button_label": "查看动态", "card_button_label_en": "View post", "card_button_label_ja": "投稿を見る", }, # ── @提及:评论里 @ 了收件人 ────────────────────────────────── # context: author_name, comment_body "feed.mention.comment": { "subject": "📣 {author_name} 在评论里 @ 了你", "subject_en": "📣 {author_name} mentioned you in a comment", "subject_ja": "📣 {author_name} さんがコメントであなたをメンションしました", "body_text": "{comment_body}", "body_text_en": "{comment_body}", "body_text_ja": "{comment_body}", "card_button_label": "查看评论", "card_button_label_en": "View comment", "card_button_label_ja": "コメントを見る", }, # ── 评论:有人评论了你的动态 ────────────────────────────────── # context: commenter_name, comment_body(调用点已把贴纸 emoji 前缀 # 拼进 comment_body,三语共用同一条正文) "feed.comment.added": { "subject": "💬 {commenter_name} 回复了你的动态", "subject_en": "💬 {commenter_name} replied to your post", "subject_ja": "💬 {commenter_name} さんがあなたの投稿に返信しました", "body_text": "{comment_body}", "body_text_en": "{comment_body}", "body_text_ja": "{comment_body}", "card_button_label": "查看动态", "card_button_label_en": "View post", "card_button_label_ja": "投稿を見る", }, # ── 点赞:仅站内铃铛(channels=[],不推飞书) ───────────────── # context: liker_name, post_preview "feed.like.aggregated": { "subject": "{liker_name} 赞了你的动态", "subject_en": "{liker_name} liked your post", "subject_ja": "{liker_name} さんがあなたの投稿にいいねしました", "body_text": "{post_preview}", "body_text_en": "{post_preview}", "body_text_ja": "{post_preview}", "card_button_label": "查看动态", "card_button_label_en": "View post", "card_button_label_ja": "投稿を見る", }, # ── 祝福:有人给你送上生日祝福 ──────────────────────────────── # context: sender_name, blessing_body, years(生日不用 years) # 正文是送祝福的人自己写的话,三语共用、原样透传。 "feed.blessing.received.birthday": { "subject": "🎂 {sender_name} 送来一份生日祝福", "subject_en": "🎂 A birthday blessing for you — from {sender_name}", "subject_ja": "🎂 {sender_name} さんからお誕生日のお祝いが届きました", "body_text": "{blessing_body}", "body_text_en": "{blessing_body}", "body_text_ja": "{blessing_body}", "card_button_label": "查看祝福墙", "card_button_label_en": "View the wall", "card_button_label_ja": "お祝いボードを見る", }, # ── 祝福:入职周年 ──────────────────────────────────────────── # context: sender_name, blessing_body, years(周年场次 years >= 1, # 由 celebration_service 的扫描保证) "feed.blessing.received.anniversary": { "subject": "🎉 {sender_name} 送来一份入职 {years} 周年祝福", "subject_en": ( "🎉 A {years}-year anniversary blessing for you — " "from {sender_name}" ), "subject_ja": "🎉 {sender_name} さんから入社 {years} 周年のお祝いが届きました", "body_text": "{blessing_body}", "body_text_en": "{blessing_body}", "body_text_ja": "{blessing_body}", "card_button_label": "查看祝福墙", "card_button_label_en": "View the wall", "card_button_label_ja": "お祝いボードを見る", }, # ── 祝福聚合:短时间内的后续祝福折叠进同一条 ────────────────── # context: count, blessing_body # 折叠只影响推送条数,不吞信息:卡片仍然指向庆祝页,那里逐条列出 # 全部祝福。正文放最新一条祝福的原文。 # ── cron 驱动的庆祝卡片(本人侧) ──────────────────────────── # context: first_name, years "feed.celebration.self.birthday": { "subject": "🎂 生日快乐,{first_name}!", "subject_en": "🎂 Happy Birthday, {first_name}!", "subject_ja": "🎂 お誕生日おめでとうございます、{first_name} さん!", "body_text": "祝你今天开心满满 —— 有蛋糕,也有那些让一年变得特别的小惊喜。", "body_text_en": "Wishing you a fantastic day full of joy, cake, and the small surprises that make a year special.", "body_text_ja": "喜びとケーキ、そして一年を特別にする小さなサプライズにあふれた一日になりますように。", "card_button_label": "去看看", "card_button_label_en": "Open the page", "card_button_label_ja": "ページを開く", }, "feed.celebration.self.anniversary": { "subject": "🎉 {years} 周年快乐,{first_name}!", "subject_en": "🎉 Happy {years}-year anniversary, {first_name}!", "subject_ja": "🎉 入社 {years} 周年おめでとうございます、{first_name} さん!", "body_text": "谢谢你这 {years} 年的搭建、交付与每一天的在场。今天,轮到团队来庆祝你。", "body_text_en": "Thank you for {years} years of building, shipping, and showing up. Today the team gets to celebrate you.", "body_text_ja": "{years} 年にわたる開発とリリース、そして日々の積み重ねをありがとうございます。今日はチームがあなたを祝う日です。", "card_button_label": "去看看", "card_button_label_en": "Open the page", "card_button_label_ja": "ページを開く", }, "feed.celebration.self.welcome": { "subject": "🎉 欢迎加入,{first_name}!", "subject_en": "🎉 Welcome aboard, {first_name}!", "subject_ja": "🎉 ようこそ、{first_name} さん!", "body_text": "谢谢你选择 PingCAP,团队很高兴你来了。", "body_text_en": "Thank you for joining PingCAP. The team is glad you're here.", "body_text_ja": "PingCAP へのご入社ありがとうございます。チーム一同、心から歓迎します。", "card_button_label": "去看看", "card_button_label_en": "Open the page", "card_button_label_ja": "ページを開く", }, # ── cron 驱动的庆祝卡片(经理 / HRBP 侧) ───────────────────── # context: name, years "feed.celebration.manager.birthday": { "subject": "🎂 今天是 {name} 的生日", "subject_en": "🎂 Today is {name}'s birthday", "subject_ja": "🎂 本日は {name} さんの誕生日です", "body_text": "去动态页给 TA 送一句祝福吧。", "body_text_en": "Send them a blessing on the moments page.", "body_text_ja": "モーメントページからお祝いのメッセージを送りましょう。", "card_button_label": "去看看", "card_button_label_en": "Open the page", "card_button_label_ja": "ページを開く", }, "feed.celebration.manager.anniversary": { "subject": "🎉 {name} 今天迎来在 PingCAP 的第 {years} 年", "subject_en": "🎉 {name} hits {years} years at PingCAP today", "subject_ja": "🎉 {name} さんは本日 PingCAP 入社 {years} 周年です", "body_text": "去动态页给 TA 送一句祝福吧。", "body_text_en": "Send them a blessing on the moments page.", "body_text_ja": "モーメントページからお祝いのメッセージを送りましょう。", "card_button_label": "去看看", "card_button_label_en": "Open the page", "card_button_label_ja": "ページを開く", }, "feed.celebration.hrbp.birthday": { "subject": "🎂 今天是 {name} 的生日", "subject_en": "🎂 Today is {name}'s birthday", "subject_ja": "🎂 本日は {name} さんの誕生日です", "body_text": "去动态页给 TA 送一句祝福吧。", "body_text_en": "Send them a blessing on the moments page.", "body_text_ja": "モーメントページからお祝いのメッセージを送りましょう。", "card_button_label": "去看看", "card_button_label_en": "Open the page", "card_button_label_ja": "ページを開く", }, "feed.celebration.hrbp.anniversary": { "subject": "🎉 {name} 今天迎来在 PingCAP 的第 {years} 年", "subject_en": "🎉 {name} hits {years} years at PingCAP today", "subject_ja": "🎉 {name} さんは本日 PingCAP 入社 {years} 周年です", "body_text": "去动态页给 TA 送一句祝福吧。", "body_text_en": "Send them a blessing on the moments page.", "body_text_ja": "モーメントページからお祝いのメッセージを送りましょう。", "card_button_label": "去看看", "card_button_label_en": "Open the page", "card_button_label_ja": "ページを開く", }, "feed.blessing.aggregated": { "subject": "🎉 今天已有 {count} 位同事为你送上祝福", "subject_en": "🎉 {count} teammates have sent you blessings today", "subject_ja": "🎉 本日 {count} 名の同僚からお祝いが届いています", "body_text": "{blessing_body}", "body_text_en": "{blessing_body}", "body_text_ja": "{blessing_body}", "card_button_label": "查看全部祝福", "card_button_label_en": "View all blessings", "card_button_label_ja": "すべてのお祝いを見る", }, } __all__ = ["TEMPLATES"]