feat: i18n (i18next + react-i18next) zh/en + hydration fixes

- i18next + react-i18next: zh/en locales, language detection
  (localStorage > navigator > zh), settings language switcher
- Components i18n'd: Navbar, Feed, NewPost, Modals, SettingsPage,
  SettingsProfile, AccountSecurity, RecoveryCodes
- Fix hydration mismatch (spinner restart): forum name via cookie
  (Server Component reads cookie, SSR outputs name, no inline script
  DOM injection); remove createPortal in RecoveryCodes modal; i18n
  sync init (initImmediate) so SSR/CSR text matches
- LoadingScreen: React-state name rendering (no script-injected nodes)
- Fix double spinner in Feed; DM icon emoji → SVG in ConversationList
This commit is contained in:
lezi-fun committed 2026-08-11 11:32:15 +08:00
1 parent 82bc2eb885
commit 0562dd735a
20 files changed
+599 -168

No files matched your search

+154
View File
@@ -0,0 +1,154 @@
{
"appName": "Forumlify",
"nav": {
"home": "Home",
"messages": "Messages",
"settings": "Settings",
"admin": "Admin",
"login": "Login",
"register": "Register",
"logout": "Logout",
"darkMode": "Dark mode",
"lightMode": "Light mode",
"logoutConfirm": "Are you sure you want to log out?"
},
"feed": {
"latest": "Latest posts",
"hot": "Latest replies",
"newPost": "New post",
"loading": "Loading...",
"empty": "✨ No posts yet — be the first to publish!",
"pinned": "📌 Pinned",
"deleted": "(edited)",
"report": "Report",
"delete": "Delete",
"confirmDelete": "Are you sure you want to delete this post?",
"deleteFailed": "Delete failed: {{msg}}",
"noTitle": "Untitled",
"anonymous": "Anonymous"
},
"post": {
"title": "Post detail",
"back": "← Back",
"edit": "Edit",
"save": "Save",
"cancel": "Cancel",
"editFailed": "Load failed: {{msg}}",
"contentRequired": "Please fill in the content",
"reply": "Reply",
"replyCount": "{{count}} replies",
"reportReason": "Report reason",
"confirmDelete": "Are you sure you want to delete this post?",
"reportTitle": "Report post",
"submitReport": "Submit report"
},
"newPost": {
"title": "Title",
"content": "Say something...",
"publish": "Publish post",
"uploading": "Uploading...",
"pleaseLogin": "Please log in first",
"captchaError": "Wrong captcha, please try again",
"publishSuccess": "Post published",
"publishFailed": "Publish failed: {{msg}}",
"answer": "Answer",
"captchaLoading": "Loading captcha...",
"drop": "Release to upload",
"dropHint": "Click or drag to upload image"
},
"reply": {
"submit": "Submit reply",
"placeholder": "Write your reply...",
"empty": "No replies yet — be the first to comment 🛋️",
"replyFailed": "Reply failed: {{msg}}",
"delete": "Delete",
"confirmDelete": "Are you sure you want to delete this reply?",
"deleteFailed": "Delete failed: {{msg}}"
},
"auth": {
"email": "Email",
"password": "Password",
"username": "Username",
"passwordHint": "Password (min 6 chars)",
"forgotPassword": "Forgot password?",
"captchaError": "Wrong captcha, please try again",
"registerSuccess": "🎉 Registration successful",
"loginSuccess": "Logged in",
"logoutSuccess": "Logged out",
"login": "Login",
"register": "Register"
},
"settings": {
"title": "Settings",
"profile": "Profile",
"security": "Security",
"recovery": "Recovery codes",
"language": "Language",
"languageZh": "中文",
"languageEn": "English",
"username": "Username",
"bio": "Bio",
"signature": "Signature",
"save": "Save settings",
"saved": "Saved!",
"saveFailed": "Save failed: {{msg}}",
"usernameRequired": "Username cannot be empty",
"pleaseLogin": "Please log in first"
},
"user": {
"title": "User profile",
"bioEmpty": "This user hasn't written a bio yet",
"sendMessage": "Send message",
"joined": "📅 Joined {{date}}",
"posts": "📝 {{count}} posts",
"admin": "🛡️ Admin",
"noPosts": "No posts yet",
"notFound": "User not found",
"loading": "Loading..."
},
"stats": {
"topics": "Topics",
"posts": "Posts",
"users": "Users",
"links": "Links"
},
"loading": "Loading...",
"common": {
"confirm": "Confirm",
"cancel": "Cancel",
"close": "Close"
},
"report": {
"spam": "Spam",
"abuse": "Harassment",
"illegal": "Illegal content",
"nsfw": "Inappropriate content",
"other": "Other"
},
"security": {
"title": "Account security",
"currentPw": "Current password",
"newPw": "New password",
"changePw": "Change password",
"currentPwVerify": "Current password (verify identity)",
"newEmail": "New email",
"changeEmail": "Change email",
"fillAll": "Please fill in all fields",
"pwMin": "New password must be at least 6 characters",
"pwChanged": "✅ Password changed",
"emailChanged": "✅ Email changed"
},
"recovery": {
"title": "Recovery codes",
"desc": "Use these to reset your account if you forget your password. Each code works once.",
"view": "View recovery codes",
"regenerate": "Regenerate",
"remaining": "{{count}} recovery codes remaining",
"confirmRegenerate": "Regenerating will invalidate all old codes. Continue?",
"genFailed": "Generation failed: {{msg}}",
"fetchFailed": "Fetch failed: {{msg}}",
"newCodes": "🆕 New recovery codes",
"saveWarning": "⚠️ Save these codes now — they cannot be viewed again after closing.",
"saved": "I have saved them"
}
}
+151
View File
@@ -0,0 +1,151 @@
{
"appName": "Forumlify",
"nav": {
"home": "首页",
"messages": "消息",
"settings": "设置",
"admin": "管理后台",
"login": "登录",
"register": "注册",
"logout": "退出",
"darkMode": "暗色模式",
"lightMode": "亮色模式",
"logoutConfirm": "确定要退出吗?"
},
"feed": {
"latest": "最新发布",
"hot": "最新回复",
"newPost": "发布新帖",
"loading": "加载中...",
"empty": "✨ 还没有帖子,快来发布第一条吧!",
"pinned": "📌 置顶",
"deleted": "(已编辑)",
"report": "举报",
"delete": "删除",
"confirmDelete": "确定要删除这条帖子吗?",
"deleteFailed": "删除失败:{{msg}}",
"noTitle": "无标题",
"anonymous": "匿名用户"
},
"post": {
"title": "帖子详情",
"back": "← 返回",
"edit": "编辑",
"save": "保存",
"cancel": "取消",
"editFailed": "加载失败:{{msg}}",
"contentRequired": "请填写内容",
"reply": "回复",
"replyCount": "{{count}} 条回复",
"reportReason": "举报原因",
"confirmDelete": "确定要删除这条帖子吗?",
"reportTitle": "举报帖子",
"submitReport": "提交举报"
},
"newPost": {
"title": "标题",
"content": "说点什么...",
"publish": "发布帖子",
"uploading": "上传中...",
"pleaseLogin": "请先登录",
"captchaError": "验证码错误,请重新计算",
"publishSuccess": "发布成功",
"publishFailed": "发布失败:{{msg}}",
"answer": "答案",
"captchaLoading": "验证码加载中...",
"drop": "松开上传",
"dropHint": "点击或拖拽上传图片"
},
"reply": {
"submit": "提交回复",
"placeholder": "写下你的回复...",
"empty": "还没有回复,快来抢沙发吧 🛋️",
"replyFailed": "回复失败:{{msg}}",
"delete": "删除",
"confirmDelete": "确定要删除这条回复吗?",
"deleteFailed": "删除失败:{{msg}}"
},
"auth": {
"email": "邮箱",
"password": "密码",
"username": "用户名",
"passwordHint": "密码(至少6位)",
"forgotPassword": "忘记密码?",
"captchaError": "验证码错误,请重新计算",
"registerSuccess": "🎉 注册成功",
"loginSuccess": "登录成功",
"logoutSuccess": "已退出登录",
"login": "登录",
"register": "注册"
},
"settings": {
"title": "设置",
"profile": "个人资料",
"security": "安全设置",
"recovery": "恢复码",
"username": "用户名",
"bio": "个人简介",
"signature": "个性签名",
"save": "保存设置",
"saved": "保存成功!",
"saveFailed": "保存失败:{{msg}}",
"usernameRequired": "用户名不能为空",
"pleaseLogin": "请先登录"
},
"user": {
"title": "用户主页",
"bioEmpty": "这个人很懒,什么都没写",
"sendMessage": "发私信",
"joined": "📅 加入于 {{date}}",
"posts": "📝 发了 {{count}} 个帖子",
"admin": "🛡️ 管理员",
"noPosts": "还没有发帖",
"notFound": "用户不存在",
"loading": "加载中..."
},
"stats": {
"topics": "主题",
"posts": "帖子",
"users": "用户",
"links": "友情链接"
},
"loading": "加载中...",
"common": {
"confirm": "确定",
"cancel": "取消",
"close": "关闭"
},
"report": {
"spam": "垃圾广告",
"abuse": "人身攻击",
"illegal": "违法内容",
"nsfw": "不适当内容",
"other": "其他"
},
"security": {
"title": "账户安全",
"currentPw": "当前密码",
"newPw": "新密码",
"changePw": "修改密码",
"currentPwVerify": "当前密码(验证身份)",
"newEmail": "新邮箱",
"changeEmail": "修改邮箱",
"fillAll": "请填写完整信息",
"pwMin": "新密码至少6位",
"pwChanged": "✅ 密码修改成功",
"emailChanged": "✅ 邮箱修改成功"
},
"recovery": {
"title": "恢复码",
"desc": "用于忘记密码时重置账户。每个恢复码只能使用一次。",
"view": "查看恢复码",
"regenerate": "重新生成",
"remaining": "剩余 {{count}} 个可用恢复码",
"confirmRegenerate": "重新生成将使所有旧恢复码失效,确定继续吗?",
"genFailed": "生成失败:{{msg}}",
"fetchFailed": "获取失败:{{msg}}",
"newCodes": "🆕 新恢复码",
"saveWarning": "⚠️ 请妥善保存这些恢复码,关闭窗口后无法再次查看。",
"saved": "我已保存"
}
}