feat(auth/i18n): 手机短信文案国际化(模板可定制 + 内置中英,#2815)#2826
Merged
Conversation
- phone-sms-texts.ts: built-in en/zh bodies for auth.phone_otp /
auth.phone_invite, {{hole}} interpolation (same semantics as the
messaging renderer, kept dependency-free), locale chain
(zh-CN -> zh -> en), best-effort sys_notification_template loader, and
an insert-if-missing seeder (tenant edits never overwritten)
- auth-manager: deliverPhoneOtp/sendPhoneInviteSms render through the
template-then-builtin resolution; setDefaultSmsLocale() mirrors
setAppName(); OTP wording is now purpose-neutral (one provider template
covers sign-in and reset; the SMS reveals nothing about what the code
unlocks)
- auth-plugin: binds localization.locale (live re-bind on settings
changes) and seeds the built-in template rows at kernel:ready when
phone sign-in is enabled
Template lookups are best-effort - an outage never blocks an OTP send.
No-OTP-in-logs red line unchanged.
Closes #2815
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013LXUXU66dBaP3SSG4ZVtuH
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 9 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013LXUXU66dBaP3SSG4ZVtuH
os-zhuang
marked this pull request as ready for review
July 11, 2026 03:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2815
#2780 的 OTP / 邀请短信正文是英文硬编码。本 PR 实现两层解析:
方案(issue 里的首选路线:复用
sys_notification_template)(topic: auth.phone_otp | auth.phone_invite, channel: 'sms', locale)的sys_notification_template行——与 messagingsmschannel 同一对象、同一 locale fallback 语义(zh-CN → zh → en),可在 Setup 中编辑。AuthPlugin 在 kernel:ready(phone 登录开启时)seed 内置中英四行,只在缺失时插入,租户定制(含停用)永不覆盖。关键决策
localization.locale设置,live 重绑定):sys_user目前没有 locale 字段,按用户 locale 解析留待该字段落地后跟进(已在 feat(sms/i18n): 邀请/OTP 短信文案国际化(按用户 locale 渲染) #2815 注明)。这已解决核心痛点——中文部署统一收中文短信。{{ hole }},单遍、无逻辑),本地 20 行实现——plugin-auth 不新增对 service-messaging 的依赖。测试
plugin-auth 全套 385 通过(新增 15 个:locale 链、内置双语完整性、插值、模板加载 fallback、seed 幂等与失败隔离、zh-CN 部署 OTP/邀请中文渲染、租户模板覆盖、模板故障回退)。
🤖 Generated with Claude Code
https://claude.ai/code/session_013LXUXU66dBaP3SSG4ZVtuH
Generated by Claude Code