feat(i18n): loginpage translate
This commit is contained in:
@@ -4,6 +4,7 @@ import { LoginForm } from "@/components/auth/LoginForm";
|
|||||||
import { RegisterForm } from "@/components/auth/RegisterForm";
|
import { RegisterForm } from "@/components/auth/RegisterForm";
|
||||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||||
import { useTranslate } from "@/hooks/useTranslate";
|
import { useTranslate } from "@/hooks/useTranslate";
|
||||||
|
import LanguageSelector from "@/components/LanguageSelector";
|
||||||
|
|
||||||
interface LoginContentProps {
|
interface LoginContentProps {
|
||||||
searchParams: {
|
searchParams: {
|
||||||
@@ -18,6 +19,10 @@ export function LoginContent({ searchParams }: LoginContentProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container relative min-h-screen flex-col items-center justify-center grid lg:max-w-none lg:grid-cols-2 lg:px-0">
|
<div className="container relative min-h-screen flex-col items-center justify-center grid lg:max-w-none lg:grid-cols-2 lg:px-0">
|
||||||
|
<div className="absolute top-4 right-4 z-50">
|
||||||
|
<LanguageSelector />
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="relative hidden h-full flex-col bg-slate-800/80 p-10 text-white lg:flex dark:border-r overflow-hidden">
|
<div className="relative hidden h-full flex-col bg-slate-800/80 p-10 text-white lg:flex dark:border-r overflow-hidden">
|
||||||
<div
|
<div
|
||||||
className="absolute inset-0 bg-cover bg-center bg-no-repeat opacity-40 transition-opacity duration-200 ease-in-out"
|
className="absolute inset-0 bg-cover bg-center bg-no-repeat opacity-40 transition-opacity duration-200 ease-in-out"
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { useRouter } from "next/navigation";
|
|||||||
import { authService } from "@/lib/services/auth.service";
|
import { authService } from "@/lib/services/auth.service";
|
||||||
import { AuthError } from "@/types/auth";
|
import { AuthError } from "@/types/auth";
|
||||||
import { ErrorMessage } from "@/components/ui/ErrorMessage";
|
import { ErrorMessage } from "@/components/ui/ErrorMessage";
|
||||||
|
import { useTranslate } from "@/hooks/useTranslate";
|
||||||
|
|
||||||
interface LoginFormProps {
|
interface LoginFormProps {
|
||||||
from?: string;
|
from?: string;
|
||||||
@@ -14,6 +15,7 @@ export function LoginForm({ from }: LoginFormProps) {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [error, setError] = useState<AuthError | null>(null);
|
const [error, setError] = useState<AuthError | null>(null);
|
||||||
|
const { t } = useTranslate();
|
||||||
|
|
||||||
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
|
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -43,7 +45,7 @@ export function LoginForm({ from }: LoginFormProps) {
|
|||||||
htmlFor="email"
|
htmlFor="email"
|
||||||
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||||
>
|
>
|
||||||
Email
|
{t("login.form.email")}
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
id="email"
|
id="email"
|
||||||
@@ -60,7 +62,7 @@ export function LoginForm({ from }: LoginFormProps) {
|
|||||||
htmlFor="password"
|
htmlFor="password"
|
||||||
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||||
>
|
>
|
||||||
Mot de passe
|
{t("login.form.password")}
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
id="password"
|
id="password"
|
||||||
@@ -84,7 +86,7 @@ export function LoginForm({ from }: LoginFormProps) {
|
|||||||
htmlFor="remember"
|
htmlFor="remember"
|
||||||
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||||
>
|
>
|
||||||
Se souvenir de moi
|
{t("login.form.remember")}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
{error && <ErrorMessage message={error.message} variant="form" />}
|
{error && <ErrorMessage message={error.message} variant="form" />}
|
||||||
@@ -93,7 +95,7 @@ export function LoginForm({ from }: LoginFormProps) {
|
|||||||
disabled={isLoading}
|
disabled={isLoading}
|
||||||
className="inline-flex w-full items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground ring-offset-background transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
|
className="inline-flex w-full items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground ring-offset-background transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
|
||||||
>
|
>
|
||||||
{isLoading ? "Connexion en cours..." : "Se connecter"}
|
{isLoading ? t("login.form.submit.loading.login") : t("login.form.submit.login")}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { AuthError } from "@/types/auth";
|
|||||||
import { ERROR_CODES } from "@/constants/errorCodes";
|
import { ERROR_CODES } from "@/constants/errorCodes";
|
||||||
import { ERROR_MESSAGES } from "@/constants/errorMessages";
|
import { ERROR_MESSAGES } from "@/constants/errorMessages";
|
||||||
import { ErrorMessage } from "@/components/ui/ErrorMessage";
|
import { ErrorMessage } from "@/components/ui/ErrorMessage";
|
||||||
|
import { useTranslate } from "@/hooks/useTranslate";
|
||||||
|
|
||||||
interface RegisterFormProps {
|
interface RegisterFormProps {
|
||||||
from?: string;
|
from?: string;
|
||||||
@@ -16,6 +17,7 @@ export function RegisterForm({ from }: RegisterFormProps) {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [error, setError] = useState<AuthError | null>(null);
|
const [error, setError] = useState<AuthError | null>(null);
|
||||||
|
const { t } = useTranslate();
|
||||||
|
|
||||||
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
|
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -54,7 +56,7 @@ export function RegisterForm({ from }: RegisterFormProps) {
|
|||||||
htmlFor="email"
|
htmlFor="email"
|
||||||
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||||
>
|
>
|
||||||
Email
|
{t("login.form.email")}
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
id="email"
|
id="email"
|
||||||
@@ -70,7 +72,7 @@ export function RegisterForm({ from }: RegisterFormProps) {
|
|||||||
htmlFor="password"
|
htmlFor="password"
|
||||||
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||||
>
|
>
|
||||||
Mot de passe
|
{t("login.form.password")}
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
id="password"
|
id="password"
|
||||||
@@ -86,7 +88,7 @@ export function RegisterForm({ from }: RegisterFormProps) {
|
|||||||
htmlFor="confirmPassword"
|
htmlFor="confirmPassword"
|
||||||
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||||
>
|
>
|
||||||
Confirmer le mot de passe
|
{t("login.form.confirmPassword")}
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
id="confirmPassword"
|
id="confirmPassword"
|
||||||
@@ -103,7 +105,7 @@ export function RegisterForm({ from }: RegisterFormProps) {
|
|||||||
disabled={isLoading}
|
disabled={isLoading}
|
||||||
className="inline-flex w-full items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground ring-offset-background transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
|
className="inline-flex w-full items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground ring-offset-background transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
|
||||||
>
|
>
|
||||||
{isLoading ? "Inscription en cours..." : "S'inscrire"}
|
{isLoading ? t("login.form.submit.loading.register") : t("login.form.submit.register")}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -11,7 +11,21 @@
|
|||||||
"login": "Sign in",
|
"login": "Sign in",
|
||||||
"register": "Sign up"
|
"register": "Sign up"
|
||||||
},
|
},
|
||||||
"description": "Enjoy your favorite comics, manga and graphic novels with a modern and smooth reading experience."
|
"description": "Enjoy your favorite comics, manga and graphic novels with a modern and smooth reading experience.",
|
||||||
|
"form": {
|
||||||
|
"email": "Email",
|
||||||
|
"password": "Password",
|
||||||
|
"confirmPassword": "Confirm password",
|
||||||
|
"remember": "Remember me",
|
||||||
|
"submit": {
|
||||||
|
"login": "Sign in",
|
||||||
|
"register": "Sign up",
|
||||||
|
"loading": {
|
||||||
|
"login": "Signing in...",
|
||||||
|
"register": "Signing up..."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"home": {
|
"home": {
|
||||||
"hero": {
|
"hero": {
|
||||||
|
|||||||
@@ -11,7 +11,21 @@
|
|||||||
"login": "Connexion",
|
"login": "Connexion",
|
||||||
"register": "Inscription"
|
"register": "Inscription"
|
||||||
},
|
},
|
||||||
"description": "Profitez de vos BD, mangas et comics préférés avec une expérience de lecture moderne et fluide."
|
"description": "Profitez de vos BD, mangas et comics préférés avec une expérience de lecture moderne et fluide.",
|
||||||
|
"form": {
|
||||||
|
"email": "Email",
|
||||||
|
"password": "Mot de passe",
|
||||||
|
"confirmPassword": "Confirmer le mot de passe",
|
||||||
|
"remember": "Se souvenir de moi",
|
||||||
|
"submit": {
|
||||||
|
"login": "Se connecter",
|
||||||
|
"register": "S'inscrire",
|
||||||
|
"loading": {
|
||||||
|
"login": "Connexion en cours...",
|
||||||
|
"register": "Inscription en cours..."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"home": {
|
"home": {
|
||||||
"hero": {
|
"hero": {
|
||||||
|
|||||||
Reference in New Issue
Block a user