mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-09 22:10:57 +08:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user