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

# Conflicts:
#	components/AppProvider.js
#	components/NewPost.js
This commit is contained in:
lezi-fun committed 2026-08-11 11:33:57 +08:00
1 parent 024b678ad3
commit 1934edebd5
20 files changed
+600 -169

No files matched your search

+2 -1
View File
@@ -3,6 +3,7 @@
// 私信 - 会话列表
import { useEffect, useState } from 'react';
import { API } from '@/lib/api';
import { Icon } from '../Icons';
function avatar(username) {
return 'https://ui-avatars.com/api/?name=' + encodeURIComponent(username || 'U') +
@@ -24,7 +25,7 @@ export default function ConversationList({ onOpenChat, onClose }) {
<div className="modal active" onClick={(e) => { if (e.target === e.currentTarget) onClose(); }}>
<div className="modal-content" style={{ display: 'flex', flexDirection: 'column', height: '70vh', maxHeight: '70vh', padding: 0, overflow: 'hidden' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '16px 20px', borderBottom: '1px solid var(--border)' }}>
<h2 style={{ fontSize: 18, margin: 0 }}>✉️ 私信</h2>
<h2 style={{ fontSize: 18, margin: 0 }}><Icon name="message" size={18} style={{ verticalAlign: -3, marginRight: 6 }} /> 私信</h2>
<span className="close" onClick={onClose} style={{ fontSize: 24, cursor: 'pointer', color: 'var(--text-light)', lineHeight: 1 }}>&times;</span>
</div>
<div id="messageListContent" style={{ flex: 1, overflowY: 'auto', padding: 0 }}>