import type { AppLocale } from "../locale"; import { DEFAULT_LOCALE } from "../locale"; export type LoginMessages = { title: string; description: string; emailLabel: string; passwordLabel: string; submitIdle: string; submitLoading: string; themeToggleLabel: string; errorLoginFailed: string; errorNetwork: string; signupPromptPrefix: string; signupLinkText: string; signupPromptSuffix: string; }; export type SignupMessages = { title: string; description: string; emailLabel: string; passwordLabel: string; passwordConfirmLabel: string; submitIdle: string; submitLoading: string; mismatchError: string; signupFailedFallbackError: string; errorNetwork: string; passwordStrengthPrefix: string; passwordStrengthWeak: string; passwordStrengthMedium: string; passwordStrengthStrong: string; loginPromptPrefix: string; loginLinkText: string; loginPromptSuffix: string; }; export type AuthMessages = { login: LoginMessages; signup: SignupMessages; }; const AUTH_MESSAGES: Record = { en: { login: { title: "Log in", description: "Sign in to manage and save your projects.", emailLabel: "Email", passwordLabel: "Password", submitIdle: "Log in", submitLoading: "Logging in...", themeToggleLabel: "Toggle theme", errorLoginFailed: "Failed to log in. Please try again.", errorNetwork: "A network error occurred. Please try again later.", signupPromptPrefix: "Don't have an account yet?", signupLinkText: "Sign up", signupPromptSuffix: "", }, signup: { title: "Sign up", description: "Create a new account to save and manage your projects.", emailLabel: "Email", passwordLabel: "Password", passwordConfirmLabel: "Confirm password", submitIdle: "Sign up", submitLoading: "Signing up...", mismatchError: "Password and confirmation do not match.", signupFailedFallbackError: "Failed to sign up. Please try again.", errorNetwork: "A network error occurred. Please try again later.", passwordStrengthPrefix: "Password strength:", passwordStrengthWeak: "Weak", passwordStrengthMedium: "Medium", passwordStrengthStrong: "Strong", loginPromptPrefix: "Already have an account?", loginLinkText: "Log in", loginPromptSuffix: "", }, }, ko: { login: { title: "로그인", description: "프로젝트를 관리하려면 먼저 계정으로 로그인하세요.", emailLabel: "이메일", passwordLabel: "비밀번호", submitIdle: "로그인", submitLoading: "로그인 중...", themeToggleLabel: "테마 전환", errorLoginFailed: "로그인에 실패했습니다. 다시 시도해 주세요.", errorNetwork: "네트워크 오류가 발생했습니다. 잠시 후 다시 시도해 주세요.", signupPromptPrefix: "아직 계정이 없다면", signupLinkText: "회원가입", signupPromptSuffix: "을 진행해 주세요.", }, signup: { title: "회원가입", description: "새 계정을 생성한 뒤 프로젝트를 저장하고 관리할 수 있습니다.", emailLabel: "이메일", passwordLabel: "비밀번호", passwordConfirmLabel: "비밀번호 확인", submitIdle: "회원가입", submitLoading: "회원가입 중...", mismatchError: "비밀번호와 비밀번호 확인이 일치하지 않습니다.", signupFailedFallbackError: "회원가입에 실패했습니다. 다시 시도해 주세요.", errorNetwork: "네트워크 오류가 발생했습니다. 잠시 후 다시 시도해 주세요.", passwordStrengthPrefix: "비밀번호 난이도:", passwordStrengthWeak: "약함", passwordStrengthMedium: "보통", passwordStrengthStrong: "강함", loginPromptPrefix: "이미 계정이 있다면", loginLinkText: "로그인", loginPromptSuffix: "으로 이동해 주세요.", }, }, }; export function getAuthMessages(locale: AppLocale | null | undefined): AuthMessages { const key = (locale ?? DEFAULT_LOCALE) as AppLocale; return AUTH_MESSAGES[key] ?? AUTH_MESSAGES[DEFAULT_LOCALE]; }