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 { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import { useTranslate } from "@/hooks/useTranslate";
|
||||
import LanguageSelector from "@/components/LanguageSelector";
|
||||
|
||||
interface LoginContentProps {
|
||||
searchParams: {
|
||||
@@ -18,6 +19,10 @@ export function LoginContent({ searchParams }: LoginContentProps) {
|
||||
|
||||
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="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="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 { AuthError } from "@/types/auth";
|
||||
import { ErrorMessage } from "@/components/ui/ErrorMessage";
|
||||
import { useTranslate } from "@/hooks/useTranslate";
|
||||
|
||||
interface LoginFormProps {
|
||||
from?: string;
|
||||
@@ -14,6 +15,7 @@ export function LoginForm({ from }: LoginFormProps) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [error, setError] = useState<AuthError | null>(null);
|
||||
const { t } = useTranslate();
|
||||
|
||||
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
@@ -43,7 +45,7 @@ export function LoginForm({ from }: LoginFormProps) {
|
||||
htmlFor="email"
|
||||
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||
>
|
||||
Email
|
||||
{t("login.form.email")}
|
||||
</label>
|
||||
<input
|
||||
id="email"
|
||||
@@ -60,7 +62,7 @@ export function LoginForm({ from }: LoginFormProps) {
|
||||
htmlFor="password"
|
||||
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||
>
|
||||
Mot de passe
|
||||
{t("login.form.password")}
|
||||
</label>
|
||||
<input
|
||||
id="password"
|
||||
@@ -84,7 +86,7 @@ export function LoginForm({ from }: LoginFormProps) {
|
||||
htmlFor="remember"
|
||||
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>
|
||||
</div>
|
||||
{error && <ErrorMessage message={error.message} variant="form" />}
|
||||
@@ -93,7 +95,7 @@ export function LoginForm({ from }: LoginFormProps) {
|
||||
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"
|
||||
>
|
||||
{isLoading ? "Connexion en cours..." : "Se connecter"}
|
||||
{isLoading ? t("login.form.submit.loading.login") : t("login.form.submit.login")}
|
||||
</button>
|
||||
</form>
|
||||
);
|
||||
|
||||
@@ -7,6 +7,7 @@ import { AuthError } from "@/types/auth";
|
||||
import { ERROR_CODES } from "@/constants/errorCodes";
|
||||
import { ERROR_MESSAGES } from "@/constants/errorMessages";
|
||||
import { ErrorMessage } from "@/components/ui/ErrorMessage";
|
||||
import { useTranslate } from "@/hooks/useTranslate";
|
||||
|
||||
interface RegisterFormProps {
|
||||
from?: string;
|
||||
@@ -16,6 +17,7 @@ export function RegisterForm({ from }: RegisterFormProps) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [error, setError] = useState<AuthError | null>(null);
|
||||
const { t } = useTranslate();
|
||||
|
||||
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
@@ -54,7 +56,7 @@ export function RegisterForm({ from }: RegisterFormProps) {
|
||||
htmlFor="email"
|
||||
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||
>
|
||||
Email
|
||||
{t("login.form.email")}
|
||||
</label>
|
||||
<input
|
||||
id="email"
|
||||
@@ -70,7 +72,7 @@ export function RegisterForm({ from }: RegisterFormProps) {
|
||||
htmlFor="password"
|
||||
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||
>
|
||||
Mot de passe
|
||||
{t("login.form.password")}
|
||||
</label>
|
||||
<input
|
||||
id="password"
|
||||
@@ -86,7 +88,7 @@ export function RegisterForm({ from }: RegisterFormProps) {
|
||||
htmlFor="confirmPassword"
|
||||
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>
|
||||
<input
|
||||
id="confirmPassword"
|
||||
@@ -103,7 +105,7 @@ export function RegisterForm({ from }: RegisterFormProps) {
|
||||
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"
|
||||
>
|
||||
{isLoading ? "Inscription en cours..." : "S'inscrire"}
|
||||
{isLoading ? t("login.form.submit.loading.register") : t("login.form.submit.register")}
|
||||
</button>
|
||||
</form>
|
||||
);
|
||||
|
||||
@@ -11,7 +11,21 @@
|
||||
"login": "Sign in",
|
||||
"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": {
|
||||
"hero": {
|
||||
|
||||
@@ -11,7 +11,21 @@
|
||||
"login": "Connexion",
|
||||
"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": {
|
||||
"hero": {
|
||||
|
||||
Reference in New Issue
Block a user