From 5634555d89ded089830939a9834587f4989aea0d Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Fri, 26 Dec 2025 18:14:04 +0100 Subject: [PATCH] feat: Internationalize login and registration pages by adding new translation keys and applying them to UI texts. --- .../public/locales/de/translation.json | 26 ++++++++++++++----- .../public/locales/en/translation.json | 26 ++++++++++++++----- .../public/locales/es/translation.json | 26 ++++++++++++++----- .../public/locales/fr/translation.json | 26 ++++++++++++++----- .../public/locales/pl/translation.json | 26 ++++++++++++++----- k-notes-frontend/src/pages/login.tsx | 18 +++++++------ k-notes-frontend/src/pages/register.tsx | 24 +++++++++-------- 7 files changed, 118 insertions(+), 54 deletions(-) diff --git a/k-notes-frontend/public/locales/de/translation.json b/k-notes-frontend/public/locales/de/translation.json index 0217c55..4e3f97c 100644 --- a/k-notes-frontend/public/locales/de/translation.json +++ b/k-notes-frontend/public/locales/de/translation.json @@ -2,6 +2,7 @@ "{{count}} selected_one": "{{count}} ausgewählt", "{{count}} selected_other": "{{count}} ausgewählt", "Add a new note to your collection.": "Füge eine neue Notiz zu deiner Sammlung hinzu.", + "Already have an account?": "Hast du schon ein Konto?", "API Configuration": "API-Konfiguration", "API URL reset to default. Please reload the page.": "API-URL auf Standard zurückgesetzt. Bitte Seite neu laden.", "API URL updated successfully. Please reload the page.": "API-URL erfolgreich aktualisiert. Bitte Seite neu laden.", @@ -14,12 +15,16 @@ "Backend URL": "Backend-URL", "Choose your preferred language": "Wähle deine bevorzugte Sprache", "Color": "Farbe", + "Confirm Password": "Passwort bestätigen", "Configure the application settings.": "Konfiguriere die Anwendungseinstellungen.", "Configure the backend API URL for this application": "Konfiguriere die Backend-API-URL für diese Anwendung", "Content": "Inhalt", "Copy note": "Notiz kopieren", "Create": "Erstellen", + "Create account": "Konto erstellen", + "Create an account": "Konto erstellen", "Create Note": "Notiz erstellen", + "Creating account...": "Konto wird erstellt...", "Current API URL": "Aktuelle API-URL", "Custom API URL": "Benutzerdefinierte API-URL", "Data Management": "Datenverwaltung", @@ -27,12 +32,18 @@ "Delete tag \"{{name}}\"? Notes will keep their content.": "Tag \"{{name}}\" löschen? Notizen behalten ihren Inhalt.", "Deleted {{count}} note_one": "{{count}} Notiz gelöscht", "Deleted {{count}} note_other": "{{count}} Notizen gelöscht", + "Don't have an account?": "Hast du noch kein Konto?", "Edit Note": "Notiz bearbeiten", + "Email": "E-Mail", + "Enter your email below to create your account": "Gib deine E-Mail ein, um dein Konto zu erstellen", + "Enter your email to sign in to your account": "Gib deine E-Mail ein, um dich anzumelden", "Export Data": "Daten exportieren", "Export failed": "Export fehlgeschlagen", "Export successful": "Export erfolgreich", "Export your notes for backup or import from a JSON file.": "Exportiere deine Notizen für ein Backup oder importiere aus einer JSON-Datei.", "Failed to copy note": "Fehler beim Kopieren der Notiz", + "Failed to login": "Anmeldung fehlgeschlagen", + "Failed to register": "Registrierung fehlgeschlagen", "Grid View": "Rasteransicht", "History": "Verlauf", "Import Data": "Daten importieren", @@ -53,24 +64,24 @@ "Note created": "Notiz erstellt", "Note title": "Notiztitel", "Note updated": "Notiz aktualisiert", + "Notes": "Notizen", "Others": "Andere", + "Password": "Passwort", "Pin this note": "Diese Notiz anheften", "Pinned": "Angeheftet", "Please enter a URL": "Bitte gib eine URL ein", + "Registration is currently disabled": "Registrierung ist derzeit deaktiviert", "Reload": "Neu laden", "Rename": "Umbenennen", "Reset to Default": "Auf Standard zurücksetzen", "Save": "Speichern", "Save changes": "Änderungen speichern", - "Saving": { - "": { - "": { - "": "" - } - } - }, + "Saving...": "Speichern...", "Search your notes...": "Durchsuche deine Notizen...", "Settings": "Einstellungen", + "Sign in": "Anmelden", + "Sign up": "Registrieren", + "Signing in...": "Anmeldung läuft...", "Tag deleted": "Tag gelöscht", "Tag renamed": "Tag umbenannt", "Tags": "Tags", @@ -79,6 +90,7 @@ "Title is required": "Titel ist erforderlich", "Title too long": "Titel zu lang", "Update": "Aktualisieren", + "Welcome back": "Willkommen zurück", "work, todo, ideas": "Arbeit, Aufgaben, Ideen", "Your notes will appear here. Click + to create one.": "Deine Notizen werden hier erscheinen. Klicke +, um eine zu erstellen." } \ No newline at end of file diff --git a/k-notes-frontend/public/locales/en/translation.json b/k-notes-frontend/public/locales/en/translation.json index 171c6dc..203c5f4 100644 --- a/k-notes-frontend/public/locales/en/translation.json +++ b/k-notes-frontend/public/locales/en/translation.json @@ -2,6 +2,7 @@ "{{count}} selected_one": "{{count}} selected", "{{count}} selected_other": "{{count}} selected", "Add a new note to your collection.": "Add a new note to your collection.", + "Already have an account?": "Already have an account?", "API Configuration": "API Configuration", "API URL reset to default. Please reload the page.": "API URL reset to default. Please reload the page.", "API URL updated successfully. Please reload the page.": "API URL updated successfully. Please reload the page.", @@ -14,12 +15,16 @@ "Backend URL": "Backend URL", "Choose your preferred language": "Choose your preferred language", "Color": "Color", + "Confirm Password": "Confirm Password", "Configure the application settings.": "Configure the application settings.", "Configure the backend API URL for this application": "Configure the backend API URL for this application", "Content": "Content", "Copy note": "Copy note", "Create": "Create", + "Create account": "Create account", + "Create an account": "Create an account", "Create Note": "Create Note", + "Creating account...": "Creating account...", "Current API URL": "Current API URL", "Custom API URL": "Custom API URL", "Data Management": "Data Management", @@ -27,12 +32,18 @@ "Delete tag \"{{name}}\"? Notes will keep their content.": "Delete tag \"{{name}}\"? Notes will keep their content.", "Deleted {{count}} note_one": "Deleted {{count}} notes", "Deleted {{count}} note_other": "Deleted {{count}} notes", + "Don't have an account?": "Don't have an account?", "Edit Note": "Edit Note", + "Email": "Email", + "Enter your email below to create your account": "Enter your email below to create your account", + "Enter your email to sign in to your account": "Enter your email to sign in to your account", "Export Data": "Export Data", "Export failed": "Export failed", "Export successful": "Export successful", "Export your notes for backup or import from a JSON file.": "Export your notes for backup or import from a JSON file.", "Failed to copy note": "Failed to copy note", + "Failed to login": "Failed to login", + "Failed to register": "Failed to register", "Grid View": "Grid View", "History": "History", "Import Data": "Import Data", @@ -53,24 +64,24 @@ "Note created": "Note created", "Note title": "Note title", "Note updated": "Note updated", + "Notes": "Notes", "Others": "Others", + "Password": "Password", "Pin this note": "Pin this note", "Pinned": "Pinned", "Please enter a URL": "Please enter a URL", + "Registration is currently disabled": "Registration is currently disabled", "Reload": "Reload", "Rename": "Rename", "Reset to Default": "Reset to Default", "Save": "Save", "Save changes": "Save changes", - "Saving": { - "": { - "": { - "": "Saving..." - } - } - }, + "Saving...": "Saving...", "Search your notes...": "Search your notes...", "Settings": "Settings", + "Sign in": "Sign in", + "Sign up": "Sign up", + "Signing in...": "Signing in...", "Tag deleted": "Tag deleted", "Tag renamed": "Tag renamed", "Tags": "Tags", @@ -79,6 +90,7 @@ "Title is required": "Title is required", "Title too long": "Title too long", "Update": "Update", + "Welcome back": "Welcome back", "work, todo, ideas": "work, todo, ideas", "Your notes will appear here. Click + to create one.": "Your notes will appear here. Click + to create one." } \ No newline at end of file diff --git a/k-notes-frontend/public/locales/es/translation.json b/k-notes-frontend/public/locales/es/translation.json index 76a2fc5..804f3af 100644 --- a/k-notes-frontend/public/locales/es/translation.json +++ b/k-notes-frontend/public/locales/es/translation.json @@ -3,6 +3,7 @@ "{{count}} selected_many": "", "{{count}} selected_other": "{{count}} seleccionados", "Add a new note to your collection.": "Añade una nueva nota a tu colección.", + "Already have an account?": "¿Ya tienes una cuenta?", "API Configuration": "Configuración de API", "API URL reset to default. Please reload the page.": "URL de API restablecido a predeterminado. Recarga la página.", "API URL updated successfully. Please reload the page.": "URL de API actualizado correctamente. Recarga la página.", @@ -17,12 +18,16 @@ "Backend URL": "URL del backend", "Choose your preferred language": "Elige tu idioma preferido", "Color": "Color", + "Confirm Password": "Confirmar contraseña", "Configure the application settings.": "Configura los ajustes de la aplicación.", "Configure the backend API URL for this application": "Configura la URL de API del backend para esta aplicación", "Content": "Contenido", "Copy note": "Copiar nota", "Create": "Crear", + "Create account": "Crear cuenta", + "Create an account": "Crear una cuenta", "Create Note": "Crear nota", + "Creating account...": "Creando cuenta...", "Current API URL": "URL de API actual", "Custom API URL": "URL de API personalizado", "Data Management": "Gestión de datos", @@ -31,12 +36,18 @@ "Deleted {{count}} note_one": "{{count}} nota eliminada", "Deleted {{count}} note_many": "", "Deleted {{count}} note_other": "{{count}} notas eliminadas", + "Don't have an account?": "¿No tienes una cuenta?", "Edit Note": "Editar nota", + "Email": "Correo electrónico", + "Enter your email below to create your account": "Ingresa tu correo electrónico para crear tu cuenta", + "Enter your email to sign in to your account": "Ingresa tu correo electrónico para iniciar sesión", "Export Data": "Exportar datos", "Export failed": "Exportación fallida", "Export successful": "Exportación exitosa", "Export your notes for backup or import from a JSON file.": "Exporta tus notas para hacer una copia de seguridad o importa desde un archivo JSON.", "Failed to copy note": "Error al copiar la nota", + "Failed to login": "Error al iniciar sesión", + "Failed to register": "Error al registrarse", "Grid View": "Vista de cuadrícula", "History": "Historial", "Import Data": "Importar datos", @@ -57,24 +68,24 @@ "Note created": "Nota creada", "Note title": "Título de la nota", "Note updated": "Nota actualizada", + "Notes": "Notas", "Others": "Otros", + "Password": "Contraseña", "Pin this note": "Fijar esta nota", "Pinned": "Fijadas", "Please enter a URL": "Por favor, introduce una URL", + "Registration is currently disabled": "El registro está actualmente deshabilitado", "Reload": "Recargar", "Rename": "Renombrar", "Reset to Default": "Restablecer a predeterminado", "Save": "Guardar", "Save changes": "Guardar cambios", - "Saving": { - "": { - "": { - "": "" - } - } - }, + "Saving...": "Guardando...", "Search your notes...": "Busca tus notas...", "Settings": "Configuración", + "Sign in": "Iniciar sesión", + "Sign up": "Registrarse", + "Signing in...": "Iniciando sesión...", "Tag deleted": "Etiqueta eliminada", "Tag renamed": "Etiqueta renombrada", "Tags": "Etiquetas", @@ -83,6 +94,7 @@ "Title is required": "El título es obligatorio", "Title too long": "Título demasiado largo", "Update": "Actualizar", + "Welcome back": "Bienvenido de nuevo", "work, todo, ideas": "trabajo, tareas, ideas", "Your notes will appear here. Click + to create one.": "Tus notas aparecerán aquí. Haz clic en + para crear una." } \ No newline at end of file diff --git a/k-notes-frontend/public/locales/fr/translation.json b/k-notes-frontend/public/locales/fr/translation.json index 0836afc..d0d6ff7 100644 --- a/k-notes-frontend/public/locales/fr/translation.json +++ b/k-notes-frontend/public/locales/fr/translation.json @@ -3,6 +3,7 @@ "{{count}} selected_many": "", "{{count}} selected_other": "{{count}} sélectionnés", "Add a new note to your collection.": "Ajoute une nouvelle note à ta collection.", + "Already have an account?": "Tu as déjà un compte ?", "API Configuration": "Configuration de l'API", "API URL reset to default. Please reload the page.": "URL de l'API réinitialisée par défaut. Veuillez recharger la page.", "API URL updated successfully. Please reload the page.": "URL de l'API mise à jour avec succès. Veuillez recharger la page.", @@ -17,12 +18,16 @@ "Backend URL": "URL du backend", "Choose your preferred language": "Choisis ta langue préférée", "Color": "Couleur", + "Confirm Password": "Confirmer le mot de passe", "Configure the application settings.": "Configure les paramètres de l'application.", "Configure the backend API URL for this application": "Configure l'URL de l'API backend pour cette application", "Content": "Contenu", "Copy note": "Copier la note", "Create": "Créer", + "Create account": "Créer un compte", + "Create an account": "Créer un compte", "Create Note": "Créer une note", + "Creating account...": "Création du compte...", "Current API URL": "URL de l'API actuelle", "Custom API URL": "URL de l'API personnalisée", "Data Management": "Gestion des données", @@ -31,12 +36,18 @@ "Deleted {{count}} note_one": "{{count}} note supprimée", "Deleted {{count}} note_many": "", "Deleted {{count}} note_other": "{{count}} notes supprimées", + "Don't have an account?": "Tu n'as pas de compte ?", "Edit Note": "Modifier la note", + "Email": "Email", + "Enter your email below to create your account": "Entre ton email ci-dessous pour créer ton compte", + "Enter your email to sign in to your account": "Entre ton email pour te connecter", "Export Data": "Exporter les données", "Export failed": "Échec de l'exportation", "Export successful": "Exportation réussie", "Export your notes for backup or import from a JSON file.": "Exporte tes notes pour une sauvegarde ou importe depuis un fichier JSON.", "Failed to copy note": "Échec de la copie de la note", + "Failed to login": "Échec de la connexion", + "Failed to register": "Échec de l'inscription", "Grid View": "Vue en grille", "History": "Historique", "Import Data": "Importer les données", @@ -57,24 +68,24 @@ "Note created": "Note créée", "Note title": "Titre de la note", "Note updated": "Note mise à jour", + "Notes": "Notes", "Others": "Autres", + "Password": "Mot de passe", "Pin this note": "Épingler cette note", "Pinned": "Épinglées", "Please enter a URL": "Veuillez entrer une URL", + "Registration is currently disabled": "L'inscription est actuellement désactivée", "Reload": "Recharger", "Rename": "Renommer", "Reset to Default": "Réinitialiser par défaut", "Save": "Enregistrer", "Save changes": "Enregistrer les modifications", - "Saving": { - "": { - "": { - "": "" - } - } - }, + "Saving...": "Enregistrement...", "Search your notes...": "Recherche dans tes notes...", "Settings": "Paramètres", + "Sign in": "Se connecter", + "Sign up": "S'inscrire", + "Signing in...": "Connexion en cours...", "Tag deleted": "Étiquette supprimée", "Tag renamed": "Étiquette renommée", "Tags": "Étiquettes", @@ -83,6 +94,7 @@ "Title is required": "Le titre est requis", "Title too long": "Titre trop long", "Update": "Mettre à jour", + "Welcome back": "Bon retour", "work, todo, ideas": "travail, tâches, idées", "Your notes will appear here. Click + to create one.": "Tes notes apparaîtront ici. Clique sur + pour en créer une." } \ No newline at end of file diff --git a/k-notes-frontend/public/locales/pl/translation.json b/k-notes-frontend/public/locales/pl/translation.json index 221789c..68e0955 100644 --- a/k-notes-frontend/public/locales/pl/translation.json +++ b/k-notes-frontend/public/locales/pl/translation.json @@ -4,6 +4,7 @@ "{{count}} selected_many": "{{count}} zaznaczonych", "{{count}} selected_other": "{{count}} zaznaczonych", "Add a new note to your collection.": "Dodaj nową notatkę do swojej kolekcji.", + "Already have an account?": "Masz już konto?", "API Configuration": "Konfiguracja API", "API URL reset to default. Please reload the page.": "URL API zresetowano do domyślnego. Przeładuj stronę.", "API URL updated successfully. Please reload the page.": "URL API zaktualizowano pomyślnie. Przeładuj stronę.", @@ -20,12 +21,16 @@ "Backend URL": "Adres URL backendu", "Choose your preferred language": "Wybierz preferowany język", "Color": "Kolor", + "Confirm Password": "Potwierdź hasło", "Configure the application settings.": "Skonfiguruj ustawienia aplikacji.", "Configure the backend API URL for this application": "Skonfiguruj URL API backendu dla tej aplikacji", "Content": "Treść", "Copy note": "Kopiuj notatkę", "Create": "Utwórz", + "Create account": "Utwórz konto", + "Create an account": "Utwórz konto", "Create Note": "Utwórz notatkę", + "Creating account...": "Tworzenie konta...", "Current API URL": "Aktualny URL API", "Custom API URL": "Własny URL API", "Data Management": "Zarządzanie danymi", @@ -35,12 +40,18 @@ "Deleted {{count}} note_few": "Usunięto {{count}} notatki", "Deleted {{count}} note_many": "Usunięto {{count}} notatek", "Deleted {{count}} note_other": "Usunięto {{count}} notatek", + "Don't have an account?": "Nie masz konta?", "Edit Note": "Edytuj notatkę", + "Email": "Email", + "Enter your email below to create your account": "Wpisz swój email poniżej, aby utworzyć konto", + "Enter your email to sign in to your account": "Wpisz swój email, aby się zalogować", "Export Data": "Eksportuj dane", "Export failed": "Eksport nie powiódł się", "Export successful": "Eksport zakończony sukcesem", "Export your notes for backup or import from a JSON file.": "Wyeksportuj swoje notatki do kopii zapasowej lub zaimportuj z pliku JSON.", "Failed to copy note": "Nie udało się skopiować notatki", + "Failed to login": "Nie udało się zalogować", + "Failed to register": "Nie udało się zarejestrować", "Grid View": "Widok siatki", "History": "Historia", "Import Data": "Importuj dane", @@ -61,24 +72,24 @@ "Note created": "Notatka utworzona", "Note title": "Tytuł notatki", "Note updated": "Notatka zaktualizowana", + "Notes": "Notatki", "Others": "Inne", + "Password": "Hasło", "Pin this note": "Przypnij tę notatkę", "Pinned": "Przypięte", "Please enter a URL": "Proszę podać URL", + "Registration is currently disabled": "Rejestracja jest obecnie wyłączona", "Reload": "Przeładuj", "Rename": "Zmień nazwę", "Reset to Default": "Przywróć domyślne", "Save": "Zapisz", "Save changes": "Zapisz zmiany", - "Saving": { - "": { - "": { - "": "" - } - } - }, + "Saving...": "Zapisywanie...", "Search your notes...": "Szukaj swoich notatek...", "Settings": "Ustawienia", + "Sign in": "Zaloguj się", + "Sign up": "Zarejestruj się", + "Signing in...": "Logowanie...", "Tag deleted": "Tag usunięty", "Tag renamed": "Nazwę tagu zmieniono", "Tags": "Tagi", @@ -87,6 +98,7 @@ "Title is required": "Tytuł jest wymagany", "Title too long": "Tytuł za długi", "Update": "Aktualizuj", + "Welcome back": "Witaj ponownie", "work, todo, ideas": "praca, zadania, pomysły", "Your notes will appear here. Click + to create one.": "Twoje notatki pojawią się tutaj. Kliknij +, aby utworzyć notatkę." } \ No newline at end of file diff --git a/k-notes-frontend/src/pages/login.tsx b/k-notes-frontend/src/pages/login.tsx index a7bcc13..acfa012 100644 --- a/k-notes-frontend/src/pages/login.tsx +++ b/k-notes-frontend/src/pages/login.tsx @@ -13,6 +13,7 @@ import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form"; import { ApiError } from "@/lib/api"; import { toast } from "sonner"; +import { useTranslation } from "react-i18next"; const loginSchema = z.object({ email: z.string().email("Invalid email address"), @@ -24,6 +25,7 @@ type LoginFormValues = z.infer; export default function LoginPage() { const { mutate: login, isPending } = useLogin(); const { data: config } = useConfig(); + const { t } = useTranslation(); const form = useForm({ resolver: zodResolver(loginSchema), @@ -39,7 +41,7 @@ export default function LoginPage() { if (error instanceof ApiError) { toast.error(error.message); } else { - toast.error("Failed to login"); + toast.error(t("Failed to login")); } }, }); @@ -56,9 +58,9 @@ export default function LoginPage() { - Welcome back + {t("Welcome back")} - Enter your email to sign in to your account + {t("Enter your email to sign in to your account")} @@ -69,7 +71,7 @@ export default function LoginPage() { name="email" render={({ field }) => ( - Email + {t("Email")} @@ -82,7 +84,7 @@ export default function LoginPage() { name="password" render={({ field }) => ( - Password + {t("Password")} @@ -91,7 +93,7 @@ export default function LoginPage() { )} /> @@ -99,9 +101,9 @@ export default function LoginPage() { {config?.allow_registration !== false && (

- Don't have an account?{" "} + {t("Don't have an account?")}{" "} - Sign up + {t("Sign up")}

)} diff --git a/k-notes-frontend/src/pages/register.tsx b/k-notes-frontend/src/pages/register.tsx index 506ad8b..1e95b8d 100644 --- a/k-notes-frontend/src/pages/register.tsx +++ b/k-notes-frontend/src/pages/register.tsx @@ -13,6 +13,7 @@ import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form"; import { ApiError } from "@/lib/api"; import { toast } from "sonner"; +import { useTranslation } from "react-i18next"; const registerSchema = z.object({ email: z.string().email("Invalid email address"), @@ -29,13 +30,14 @@ export default function RegisterPage() { const { mutate: register, isPending } = useRegister(); const { data: config, isLoading: isConfigLoading } = useConfig(); const navigate = useNavigate(); + const { t } = useTranslation(); useEffect(() => { if (!isConfigLoading && config?.allow_registration === false) { - toast.error("Registration is currently disabled"); + toast.error(t("Registration is currently disabled")); navigate("/login"); } - }, [config, isConfigLoading, navigate]); + }, [config, isConfigLoading, navigate, t]); if (isConfigLoading || config?.allow_registration === false) { return null; // Or a loading spinner @@ -59,7 +61,7 @@ export default function RegisterPage() { if (error instanceof ApiError) { toast.error(error.message); } else { - toast.error("Failed to register"); + toast.error(t("Failed to register")); } }, }); @@ -76,9 +78,9 @@ export default function RegisterPage() { - Create an account + {t("Create an account")} - Enter your email below to create your account + {t("Enter your email below to create your account")} @@ -89,7 +91,7 @@ export default function RegisterPage() { name="email" render={({ field }) => ( - Email + {t("Email")} @@ -102,7 +104,7 @@ export default function RegisterPage() { name="password" render={({ field }) => ( - Password + {t("Password")} @@ -115,7 +117,7 @@ export default function RegisterPage() { name="confirmPassword" render={({ field }) => ( - Confirm Password + {t("Confirm Password")} @@ -124,16 +126,16 @@ export default function RegisterPage() { )} />

- Already have an account?{" "} + {t("Already have an account?")}{" "} - Sign in + {t("Sign in")}