diff --git a/Frontend/src/locales/en.json b/Frontend/src/locales/en.json index db0ca14..c0ad6f1 100644 --- a/Frontend/src/locales/en.json +++ b/Frontend/src/locales/en.json @@ -28,7 +28,37 @@ "not_found_title": "Page Not Found", "not_found_description": "Sorry, we couldn't find the page you were looking for. It may have been moved or deleted.", - "go_home": "Go Home" + "go_home": "Go Home", + + "login_title": "Log in", + "email_placeholder": "Enter your email", + "password_placeholder": "Enter your password", + "forgot_password": "Forgot password?", + "logging_in": "Logging In...", + "login": "Login", + "dont_have_account": "Don’t have an account?", + "sign_up": "Sign up", + "login_successful": "Login successful!", + "login_failed": "Login failed.", + "an_error_occurred": "An error occurred. Please try again.", + "logging_in_toast": "Logging in...", + + "signup_title": "Sign Up", + "first_name": "First Name", + "last_name": "Last Name", + "email_placeholder": "Enter your email", + "password_placeholder": "Enter your password", + "confirm_password_placeholder": "Confirm your password", + "signing_up": "Signing Up...", + "sign_up": "Sign Up", + "already_have_account": "Already have an account?", + "login": "Login", + "passwords_do_not_match": "Passwords do not match.", + "registering": "Registering...", + "signup_failed": "Signup failed.", + "folder_creation_failed": "Failed to create user folder.", + "signup_success": "Successfully registered and folder created!", + "an_error_occurred": "An error occurred. Please try again." } diff --git a/Frontend/src/locales/fr.json b/Frontend/src/locales/fr.json index f99df3f..94dd4e3 100644 --- a/Frontend/src/locales/fr.json +++ b/Frontend/src/locales/fr.json @@ -28,7 +28,36 @@ "not_found_title": "Page non trouvée", "not_found_description": "Désolé, nous n'avons pas pu trouver la page que vous cherchiez. Elle a peut-être été déplacée ou supprimée.", - "go_home": "Accueil" + "go_home": "Accueil", + + "login_title": "Connexion", + "email_placeholder": "Entrez votre e-mail", + "password_placeholder": "Entrez votre mot de passe", + "forgot_password": "Mot de passe oublié ?", + "logging_in": "Connexion...", + "login": "Connexion", + "dont_have_account": "Vous n'avez pas de compte ?", + "sign_up": "S'inscrire", + "login_successful": "Connexion réussie !", + "login_failed": "Échec de la connexion.", + "an_error_occurred": "Une erreur s'est produite. Veuillez réessayer.", + "logging_in_toast": "Connexion en cours...", + + "sign_up": "S'inscrire", + "first_name": "Prénom", + "last_name": "Nom de famille", + "email_placeholder": "Entrez votre e-mail", + "password_placeholder": "Entrez votre mot de passe", + "confirm_password_placeholder": "Confirmez votre mot de passe", + "already_have_account": "Vous avez déjà un compte ?", + "login": "Connexion", + "signing_up": "Inscription...", + "passwords_do_not_match": "Les mots de passe ne correspondent pas.", + "registering": "Enregistrement...", + "signup_failed": "Échec de l'inscription.", + "failed_create_folder": "Échec de la création du dossier utilisateur.", + "signup_success": "Inscription réussie et dossier créé !", + "an_error_occurred": "Une erreur s'est produite. Veuillez réessayer." } diff --git a/Frontend/src/pages/Authentication/Login.jsx b/Frontend/src/pages/Authentication/Login.jsx index 9fa60e0..20a8476 100644 --- a/Frontend/src/pages/Authentication/Login.jsx +++ b/Frontend/src/pages/Authentication/Login.jsx @@ -2,10 +2,12 @@ import { useState, useEffect } from "react"; import { FiEye, FiEyeOff } from "react-icons/fi"; import { Link, useNavigate } from "react-router-dom"; import toast from "react-hot-toast"; // Import React Hot Toast +import { useTranslation } from "react-i18next"; // for multilinguality const API_URL = import.meta.env.VITE_API_URL; // Using .env variable const Login = () => { + const { t } = useTranslation(); // for multilinguality const [showPassword, setShowPassword] = useState(false); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); @@ -28,7 +30,7 @@ const Login = () => { setLoading(true); // Show loading toast - const toastId = toast.loading("Logging in..."); + const toastId = toast.loading(t("logging_in_toast")); try { const response = await fetch(`${API_URL}/api/login`, { @@ -61,18 +63,17 @@ const Login = () => { }); // Show success toast - toast.success("Login successful!"); - + toast.success(t("login_successful")); // Redirect to Dashboard navigate("/dashboard"); } else { // Show error toast if login fails - toast.error(data.message || "Login failed."); + toast.error(data.message || t("login_failed")); } } catch (error) { // Dismiss the loading toast and show error toast.dismiss(toastId); - toast.error("An error occurred. Please try again.", error); + toast.error(t("an_error_occurred")); } finally { setLoading(false); } @@ -82,7 +83,7 @@ const Login = () => {
- Don’t have an account?{" "} + {t("dont_have_account")}{" "} - Sign up + {t("sign_up")}
- Already have an account?{" "} + {t("already_have_account")}{" "} - Login + {t("login")}