feat: localize default strategy names by UI language at registration

- Pass `lang` from register request body to createDefaultStrategies
- Support zh/en/id locales for strategy names and descriptions
- Wrap strategy creation in a transaction to prevent partial writes
- Frontend sends current UI language in register request body
- Strategy list UI: 2-line clamp, unselected border, larger spacing, smaller font for non-zh
This commit is contained in:
Dean
2026-03-27 21:11:12 +08:00
committed by shinchan-zhai
parent 39782600a9
commit 1d897f635e
3 changed files with 73 additions and 21 deletions

View File

@@ -3,6 +3,7 @@ import { flushSync } from 'react-dom'
import { getSystemConfig } from '../lib/config'
import { reset401Flag, httpClient } from '../lib/httpClient'
import { getPostAuthPath, setUserMode, type UserMode } from '../lib/onboarding'
import { useLanguage } from './LanguageContext'
interface User {
id: string
@@ -41,6 +42,7 @@ interface AuthContextType {
const AuthContext = createContext<AuthContextType | undefined>(undefined)
export function AuthProvider({ children }: { children: React.ReactNode }) {
const { language } = useLanguage()
const [user, setUser] = useState<User | null>(null)
const [token, setToken] = useState<string | null>(null)
const [isLoading, setIsLoading] = useState(true)
@@ -208,7 +210,8 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
email: string
password: string
beta_code?: string
} = { email, password }
lang?: string
} = { email, password, lang: language }
if (betaCode) {
requestBody.beta_code = betaCode
}