From 03767093259d1e02726026319b9810caa1081863 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Sat, 14 Dec 2024 09:56:12 -0500 Subject: [PATCH] Enhance localization support; update error messages and add translations for adventure calendar --- docker-compose.yml | 4 +- documentation/docs/install/docker.md | 24 ++++----- frontend/src/locales/de.json | 20 +++++++- frontend/src/locales/en.json | 18 ++++++- frontend/src/locales/es.json | 20 +++++++- frontend/src/locales/fr.json | 20 +++++++- frontend/src/locales/it.json | 20 +++++++- frontend/src/locales/nl.json | 20 +++++++- frontend/src/locales/pl.json | 20 +++++++- frontend/src/locales/sv.json | 20 +++++++- frontend/src/locales/zh.json | 20 +++++++- frontend/src/routes/calendar/+page.svelte | 3 +- frontend/src/routes/dashboard/+page.svelte | 50 +++++++++---------- frontend/src/routes/settings/+page.svelte | 4 +- frontend/src/routes/signup/+page.server.ts | 6 +-- frontend/src/routes/signup/+page.svelte | 2 +- .../user/verify-email/[key]/+page.server.ts | 9 ++-- 17 files changed, 212 insertions(+), 68 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6ec6bba..efaf95d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -38,10 +38,10 @@ services: - DJANGO_ADMIN_USERNAME=admin - DJANGO_ADMIN_PASSWORD=admin - DJANGO_ADMIN_EMAIL=admin@example.com - - PUBLIC_URL='http://localhost:8016' # Match the outward port, used for the creation of image urls + - PUBLIC_URL=http://localhost:8016 # Match the outward port, used for the creation of image urls - CSRF_TRUSTED_ORIGINS=http://localhost:8016,http://localhost:8015 # Comma separated list of trusted origins for CSRF - DEBUG=False - - FRONTEND_URL='http://localhost:8015' # Used for email generation. This should be the url of the frontend + - FRONTEND_URL=http://localhost:8015 # Used for email generation. This should be the url of the frontend ports: - "8016:80" depends_on: diff --git a/documentation/docs/install/docker.md b/documentation/docs/install/docker.md index 8bcaad0..43fe68f 100644 --- a/documentation/docs/install/docker.md +++ b/documentation/docs/install/docker.md @@ -31,18 +31,18 @@ Here is a summary of the configuration options available in the `docker-compose. ### Backend Container (server) -| Name | Required | Description | Default Value | -| ----------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | -| `PGHOST` | Yes | Databse host. | db | -| `PGDATABASE` | Yes | Database. | database | -| `PGUSER` | Yes | Database user. | adventure | -| `PGPASSWORD` | Yes | Database password. | changeme123 | -| `DJANGO_ADMIN_USERNAME` | Yes | Default username. | admin | -| `DJANGO_ADMIN_PASSWORD` | Yes | Default password, change after inital login. | admin | -| `DJANGO_ADMIN_EMAIL` | Yes | Default user's email. | admin@example.com | -| `PUBLIC_URL` | Yes | This needs to match the outward port of the server and be accessible from where the app is used. It is used for the creation of image urls. | 'http://localhost:8016' | -| `CSRF_TRUSTED_ORIGINS` | Yes | Need to be changed to the orgins where you use your backend server and frontend. These values are comma seperated. | http://localhost:8016 | -| `FRONTEND_URL` | Yes | This is the publically accessible url to the **frontend** container. This link should be accessable for all users. Used for email generation. | 'http://localhost:8015' | +| Name | Required | Description | Default Value | +| ----------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | +| `PGHOST` | Yes | Databse host. | db | +| `PGDATABASE` | Yes | Database. | database | +| `PGUSER` | Yes | Database user. | adventure | +| `PGPASSWORD` | Yes | Database password. | changeme123 | +| `DJANGO_ADMIN_USERNAME` | Yes | Default username. | admin | +| `DJANGO_ADMIN_PASSWORD` | Yes | Default password, change after inital login. | admin | +| `DJANGO_ADMIN_EMAIL` | Yes | Default user's email. | admin@example.com | +| `PUBLIC_URL` | Yes | This needs to match the outward port of the server and be accessible from where the app is used. It is used for the creation of image urls. | http://localhost:8016 | +| `CSRF_TRUSTED_ORIGINS` | Yes | Need to be changed to the orgins where you use your backend server and frontend. These values are comma seperated. | http://localhost:8016 | +| `FRONTEND_URL` | Yes | This is the publically accessible url to the **frontend** container. This link should be accessable for all users. Used for email generation. | http://localhost:8015 | ## Running the Containers diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index a03f541..1600f24 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -190,7 +190,8 @@ "set_to_pin": "Auf „Anpinnen“ setzen", "category_fetch_error": "Fehler beim Abrufen der Kategorien", "copied_to_clipboard": "In die Zwischenablage kopiert!", - "copy_failed": "Das Kopieren ist fehlgeschlagen" + "copy_failed": "Das Kopieren ist fehlgeschlagen", + "adventure_calendar": "Abenteuerkalender" }, "home": { "desc_1": "Entdecken, planen und erkunden Sie mit Leichtigkeit", @@ -333,7 +334,13 @@ "verified": "Verifiziert", "verify": "Verifizieren", "verify_email_error": "Fehler bei der E-Mail-Bestätigung. \nVersuchen Sie es in ein paar Minuten noch einmal.", - "verify_email_success": "E-Mail-Bestätigung erfolgreich gesendet!" + "verify_email_success": "E-Mail-Bestätigung erfolgreich gesendet!", + "add_email_blocked": "Sie können keine E-Mail-Adresse zu einem Konto hinzufügen, das durch die Zwei-Faktor-Authentifizierung geschützt ist.", + "required": "Dieses Feld ist erforderlich", + "csrf_failed": "CSRF-Token konnte nicht abgerufen werden", + "duplicate_email": "Diese E-Mail-Adresse wird bereits verwendet.", + "email_taken": "Diese E-Mail-Adresse wird bereits verwendet.", + "username_taken": "Dieser Benutzername wird bereits verwendet." }, "checklist": { "add_item": "Artikel hinzufügen", @@ -453,5 +460,14 @@ "no_categories_found": "Keine Kategorien gefunden.", "select_category": "Kategorie auswählen", "update_after_refresh": "Die Abenteuerkarten werden aktualisiert, sobald Sie die Seite aktualisieren." + }, + "dashboard": { + "add_some": "Warum beginnen Sie nicht mit der Planung Ihres nächsten Abenteuers? \nSie können ein neues Abenteuer hinzufügen, indem Sie auf die Schaltfläche unten klicken.", + "countries_visited": "Besuchte Länder", + "no_recent_adventures": "Keine aktuellen Abenteuer?", + "recent_adventures": "Aktuelle Abenteuer", + "total_adventures": "Totale Abenteuer", + "total_visited_regions": "Insgesamt besuchte Regionen", + "welcome_back": "Willkommen zurück" } } diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 46e9f58..b167429 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -208,6 +208,7 @@ "notes": "Notes", "checklists": "Checklists", "transportations": "Transportations", + "adventure_calendar": "Adventure Calendar", "day": "Day", "itineary_by_date": "Itinerary by Date", "nothing_planned": "Nothing planned for this day. Enjoy the journey!", @@ -333,7 +334,13 @@ "email_verified_erorr_desc": "Your email could not be verified. Please try again.", "invalid_code": "Invalid MFA code", "invalid_credentials": "Invalid username or password", - "mfa_required": "Multi-factor authentication is required" + "mfa_required": "Multi-factor authentication is required", + "required": "This field is required", + "add_email_blocked": "You cannot add an email address to an account protected by two-factor authentication.", + "duplicate_email": "This email address is already in use.", + "csrf_failed": "Failed to fetch CSRF token", + "email_taken": "This email address is already in use.", + "username_taken": "This username is already in use." }, "collection": { "collection_created": "Collection created successfully!", @@ -453,5 +460,14 @@ "update_after_refresh": "The adventure cards will be updated once you refresh the page.", "select_category": "Select Category", "category_name": "Category Name" + }, + "dashboard": { + "welcome_back": "Welcome back", + "countries_visited": "Countries Visited", + "total_adventures": "Total Adventures", + "total_visited_regions": "Total Visited Regions", + "recent_adventures": "Recent Adventures", + "no_recent_adventures": "No recent adventures?", + "add_some": "Why not start planning your next adventure? You can add a new adventure by clicking the button below." } } diff --git a/frontend/src/locales/es.json b/frontend/src/locales/es.json index 4ace85f..8506ddd 100644 --- a/frontend/src/locales/es.json +++ b/frontend/src/locales/es.json @@ -237,7 +237,8 @@ "set_to_pin": "Establecer en Fijar", "category_fetch_error": "Error al buscar categorías", "copied_to_clipboard": "¡Copiado al portapapeles!", - "copy_failed": "Copia fallida" + "copy_failed": "Copia fallida", + "adventure_calendar": "Calendario de aventuras" }, "worldtravel": { "all": "Todo", @@ -333,7 +334,13 @@ "email_verified_success": "Su correo electrónico ha sido verificado. \nAhora puedes iniciar sesión.", "invalid_code": "Código MFA no válido", "invalid_credentials": "Nombre de usuario o contraseña no válidos", - "mfa_required": "Se requiere autenticación multifactor" + "mfa_required": "Se requiere autenticación multifactor", + "add_email_blocked": "No puede agregar una dirección de correo electrónico a una cuenta protegida por autenticación de dos factores.", + "required": "Este campo es obligatorio", + "csrf_failed": "No se pudo recuperar el token CSRF", + "duplicate_email": "Esta dirección de correo electrónico ya está en uso.", + "email_taken": "Esta dirección de correo electrónico ya está en uso.", + "username_taken": "Este nombre de usuario ya está en uso." }, "checklist": { "add_item": "Agregar artículo", @@ -453,5 +460,14 @@ "no_categories_found": "No se encontraron categorías.", "select_category": "Seleccionar categoría", "update_after_refresh": "Las tarjetas de aventuras se actualizarán una vez que actualices la página." + }, + "dashboard": { + "add_some": "¿Por qué no empezar a planificar tu próxima aventura? \nPuedes agregar una nueva aventura haciendo clic en el botón de abajo.", + "countries_visited": "Países visitados", + "no_recent_adventures": "¿Sin aventuras recientes?", + "recent_adventures": "Aventuras recientes", + "total_adventures": "Aventuras totales", + "total_visited_regions": "Total de regiones visitadas", + "welcome_back": "Bienvenido de nuevo" } } diff --git a/frontend/src/locales/fr.json b/frontend/src/locales/fr.json index c78bd57..6d71969 100644 --- a/frontend/src/locales/fr.json +++ b/frontend/src/locales/fr.json @@ -190,7 +190,8 @@ "set_to_pin": "Définir sur Épingler", "category_fetch_error": "Erreur lors de la récupération des catégories", "copied_to_clipboard": "Copié dans le presse-papier !", - "copy_failed": "Échec de la copie" + "copy_failed": "Échec de la copie", + "adventure_calendar": "Calendrier d'aventure" }, "home": { "desc_1": "Découvrez, planifiez et explorez en toute simplicité", @@ -333,7 +334,13 @@ "verified": "Vérifié", "verify": "Vérifier", "verify_email_error": "Erreur lors de la vérification de l'e-mail. \nRéessayez dans quelques minutes.", - "verify_email_success": "Vérification par e-mail envoyée avec succès !" + "verify_email_success": "Vérification par e-mail envoyée avec succès !", + "add_email_blocked": "Vous ne pouvez pas ajouter une adresse e-mail à un compte protégé par une authentification à deux facteurs.", + "required": "Ce champ est obligatoire", + "csrf_failed": "Échec de la récupération du jeton CSRF", + "duplicate_email": "Cette adresse e-mail est déjà utilisée.", + "email_taken": "Cette adresse e-mail est déjà utilisée.", + "username_taken": "Ce nom d'utilisateur est déjà utilisé." }, "checklist": { "add_item": "Ajouter un article", @@ -453,5 +460,14 @@ "no_categories_found": "Aucune catégorie trouvée.", "select_category": "Sélectionnez une catégorie", "update_after_refresh": "Les cartes d'aventure seront mises à jour une fois que vous aurez actualisé la page." + }, + "dashboard": { + "add_some": "Pourquoi ne pas commencer à planifier votre prochaine aventure ? \nVous pouvez ajouter une nouvelle aventure en cliquant sur le bouton ci-dessous.", + "countries_visited": "Pays visités", + "no_recent_adventures": "Pas d'aventures récentes ?", + "recent_adventures": "Aventures récentes", + "total_adventures": "Aventures totales", + "total_visited_regions": "Total des régions visitées", + "welcome_back": "Content de te revoir" } } diff --git a/frontend/src/locales/it.json b/frontend/src/locales/it.json index 4c6928e..3cdaead 100644 --- a/frontend/src/locales/it.json +++ b/frontend/src/locales/it.json @@ -190,7 +190,8 @@ "set_to_pin": "Imposta su Blocca", "category_fetch_error": "Errore durante il recupero delle categorie", "copied_to_clipboard": "Copiato negli appunti!", - "copy_failed": "Copia non riuscita" + "copy_failed": "Copia non riuscita", + "adventure_calendar": "Calendario delle avventure" }, "home": { "desc_1": "Scopri, pianifica ed esplora con facilità", @@ -333,7 +334,13 @@ "verified": "Verificato", "verify_email_success": "Verifica email inviata con successo!", "verify": "Verificare", - "verify_email_error": "Errore durante la verifica dell'e-mail. \nRiprova tra qualche minuto." + "verify_email_error": "Errore durante la verifica dell'e-mail. \nRiprova tra qualche minuto.", + "add_email_blocked": "Non è possibile aggiungere un indirizzo email a un account protetto dall'autenticazione a due fattori.", + "required": "Questo campo è obbligatorio", + "csrf_failed": "Impossibile recuperare il token CSRF", + "duplicate_email": "Questo indirizzo email è già in uso.", + "email_taken": "Questo indirizzo email è già in uso.", + "username_taken": "Questo nome utente è già in uso." }, "checklist": { "add_item": "Aggiungi articolo", @@ -453,5 +460,14 @@ "no_categories_found": "Nessuna categoria trovata.", "select_category": "Seleziona Categoria", "update_after_refresh": "Le carte avventura verranno aggiornate una volta aggiornata la pagina." + }, + "dashboard": { + "add_some": "Perché non iniziare a pianificare la tua prossima avventura? \nPuoi aggiungere una nuova avventura facendo clic sul pulsante in basso.", + "countries_visited": "Paesi visitati", + "no_recent_adventures": "Nessuna avventura recente?", + "recent_adventures": "Avventure recenti", + "total_adventures": "Avventure totali", + "total_visited_regions": "Totale regioni visitate", + "welcome_back": "Bentornato" } } diff --git a/frontend/src/locales/nl.json b/frontend/src/locales/nl.json index 7d0317b..598ba05 100644 --- a/frontend/src/locales/nl.json +++ b/frontend/src/locales/nl.json @@ -190,7 +190,8 @@ "set_to_pin": "Stel in op pin", "category_fetch_error": "Fout bij ophalen van categorieën", "copied_to_clipboard": "Gekopieerd naar klembord!", - "copy_failed": "Kopiëren mislukt" + "copy_failed": "Kopiëren mislukt", + "adventure_calendar": "Avonturenkalender" }, "home": { "desc_1": "Ontdek, plan en verken met gemak", @@ -333,7 +334,13 @@ "verified": "Geverifieerd", "verify": "Verifiëren", "verify_email_error": "Fout bij het verifiëren van e-mailadres. \nProbeer het over een paar minuten opnieuw.", - "verify_email_success": "E-mailverificatie succesvol verzonden!" + "verify_email_success": "E-mailverificatie succesvol verzonden!", + "add_email_blocked": "U kunt geen e-mailadres toevoegen aan een account dat is beveiligd met tweefactorauthenticatie.", + "required": "Dit veld is verplicht", + "csrf_failed": "Kan CSRF-token niet ophalen", + "duplicate_email": "Dit e-mailadres is al in gebruik.", + "email_taken": "Dit e-mailadres is al in gebruik.", + "username_taken": "Deze gebruikersnaam is al in gebruik." }, "checklist": { "add_item": "Artikel toevoegen", @@ -453,5 +460,14 @@ "no_categories_found": "Geen categorieën gevonden.", "select_category": "Selecteer categorie", "update_after_refresh": "De avonturenkaarten worden bijgewerkt zodra u de pagina vernieuwt." + }, + "dashboard": { + "add_some": "Waarom begint u niet met het plannen van uw volgende avontuur? \nJe kunt een nieuw avontuur toevoegen door op de onderstaande knop te klikken.", + "countries_visited": "Bezochte landen", + "no_recent_adventures": "Geen recente avonturen?", + "recent_adventures": "Recente avonturen", + "total_adventures": "Totale avonturen", + "total_visited_regions": "Totaal bezochte regio's", + "welcome_back": "Welkom terug" } } diff --git a/frontend/src/locales/pl.json b/frontend/src/locales/pl.json index abf57fe..6b37bf3 100644 --- a/frontend/src/locales/pl.json +++ b/frontend/src/locales/pl.json @@ -237,7 +237,8 @@ "other": "Inne" }, "copied_to_clipboard": "Skopiowano do schowka!", - "copy_failed": "Kopiowanie nie powiodło się" + "copy_failed": "Kopiowanie nie powiodło się", + "adventure_calendar": "Kalendarz przygód" }, "worldtravel": { "country_list": "Lista krajów", @@ -333,7 +334,13 @@ "verified": "Zweryfikowano", "verify": "Zweryfikować", "verify_email_error": "Błąd podczas weryfikacji adresu e-mail. \nSpróbuj ponownie za kilka minut.", - "verify_email_success": "Weryfikacja e-mailowa została wysłana pomyślnie!" + "verify_email_success": "Weryfikacja e-mailowa została wysłana pomyślnie!", + "add_email_blocked": "Nie można dodać adresu e-mail do konta chronionego uwierzytelnianiem dwuskładnikowym.", + "required": "To pole jest wymagane", + "csrf_failed": "Nie udało się pobrać tokena CSRF", + "duplicate_email": "Ten adres e-mail jest już używany.", + "email_taken": "Ten adres e-mail jest już używany.", + "username_taken": "Ta nazwa użytkownika jest już używana." }, "collection": { "collection_created": "Kolekcja została pomyślnie utworzona!", @@ -453,5 +460,14 @@ "update_after_refresh": "Karty podróży zostaną zaktualizowane po odświeżeniu strony.", "select_category": "Wybierz kategorię", "category_name": "Nazwa kategorii" + }, + "dashboard": { + "add_some": "Dlaczego nie zacząć planować kolejnej przygody? \nMożesz dodać nową przygodę, klikając przycisk poniżej.", + "countries_visited": "Odwiedzone kraje", + "no_recent_adventures": "Brak nowych przygód?", + "recent_adventures": "Ostatnie przygody", + "total_adventures": "Totalne przygody", + "total_visited_regions": "Łączna liczba odwiedzonych regionów", + "welcome_back": "Witamy z powrotem" } } diff --git a/frontend/src/locales/sv.json b/frontend/src/locales/sv.json index ecf2670..29b7e53 100644 --- a/frontend/src/locales/sv.json +++ b/frontend/src/locales/sv.json @@ -190,7 +190,8 @@ "set_to_pin": "Ställ in på Pin", "category_fetch_error": "Det gick inte att hämta kategorier", "copied_to_clipboard": "Kopierat till urklipp!", - "copy_failed": "Kopieringen misslyckades" + "copy_failed": "Kopieringen misslyckades", + "adventure_calendar": "Äventyrskalender" }, "home": { "desc_1": "Upptäck, planera och utforska med lätthet", @@ -333,7 +334,13 @@ "verified": "Verifierad", "verify": "Kontrollera", "verify_email_error": "Fel vid verifiering av e-post. \nFörsök igen om några minuter.", - "verify_email_success": "E-postverifiering har skickats!" + "verify_email_success": "E-postverifiering har skickats!", + "add_email_blocked": "Du kan inte lägga till en e-postadress till ett konto som skyddas av tvåfaktorsautentisering.", + "required": "Detta fält är obligatoriskt", + "csrf_failed": "Det gick inte att hämta CSRF-token", + "duplicate_email": "Den här e-postadressen används redan.", + "email_taken": "Den här e-postadressen används redan.", + "username_taken": "Detta användarnamn används redan." }, "checklist": { "add_item": "Lägg till objekt", @@ -453,5 +460,14 @@ "no_categories_found": "Inga kategorier hittades.", "select_category": "Välj Kategori", "update_after_refresh": "Äventyrskorten kommer att uppdateras när du uppdaterar sidan." + }, + "dashboard": { + "add_some": "Varför inte börja planera ditt nästa äventyr? \nDu kan lägga till ett nytt äventyr genom att klicka på knappen nedan.", + "countries_visited": "Besökta länder", + "no_recent_adventures": "Inga nya äventyr?", + "recent_adventures": "Senaste äventyr", + "total_adventures": "Totala äventyr", + "total_visited_regions": "Totalt antal besökta regioner", + "welcome_back": "Välkommen tillbaka" } } diff --git a/frontend/src/locales/zh.json b/frontend/src/locales/zh.json index d97cf37..11202b8 100644 --- a/frontend/src/locales/zh.json +++ b/frontend/src/locales/zh.json @@ -190,7 +190,8 @@ "set_to_pin": "设置为固定", "category_fetch_error": "获取类别时出错", "copied_to_clipboard": "已复制到剪贴板!", - "copy_failed": "复制失败" + "copy_failed": "复制失败", + "adventure_calendar": "冒险日历" }, "home": { "desc_1": "轻松发现、规划和探索", @@ -333,7 +334,13 @@ "verified": "已验证", "verify": "核实", "verify_email_error": "验证电子邮件时出错。\n几分钟后重试。", - "verify_email_success": "邮箱验证发送成功!" + "verify_email_success": "邮箱验证发送成功!", + "add_email_blocked": "您无法将电子邮件地址添加到受双因素身份验证保护的帐户。", + "required": "此字段是必需的", + "csrf_failed": "获取 CSRF 令牌失败", + "duplicate_email": "该电子邮件地址已被使用。", + "email_taken": "该电子邮件地址已被使用。", + "username_taken": "该用户名已被使用。" }, "checklist": { "add_item": "添加项目", @@ -453,5 +460,14 @@ "no_categories_found": "未找到类别。", "select_category": "选择类别", "update_after_refresh": "刷新页面后,冒险卡将更新。" + }, + "dashboard": { + "add_some": "为什么不开始计划你的下一次冒险呢?\n您可以通过单击下面的按钮添加新的冒险。", + "countries_visited": "访问国家", + "no_recent_adventures": "最近没有冒险吗?", + "recent_adventures": "最近的冒险", + "total_adventures": "全面冒险", + "total_visited_regions": "总访问地区", + "welcome_back": "欢迎回来" } } diff --git a/frontend/src/routes/calendar/+page.svelte b/frontend/src/routes/calendar/+page.svelte index 80f4327..3dc5b2c 100644 --- a/frontend/src/routes/calendar/+page.svelte +++ b/frontend/src/routes/calendar/+page.svelte @@ -7,6 +7,7 @@ import TimeGrid from '@event-calendar/time-grid'; // @ts-ignore import DayGrid from '@event-calendar/day-grid'; + import { t } from 'svelte-i18n'; export let data: PageData; @@ -20,6 +21,6 @@ }; -

Adventure Calendar

+

{$t('adventures.adventure_calendar')}

diff --git a/frontend/src/routes/dashboard/+page.svelte b/frontend/src/routes/dashboard/+page.svelte index 1c9f986..2115977 100644 --- a/frontend/src/routes/dashboard/+page.svelte +++ b/frontend/src/routes/dashboard/+page.svelte @@ -1,22 +1,19 @@
-

Welcome back, {user?.first_name}!

+

{$t('dashboard.welcome_back')}, {user?.first_name}!

@@ -36,7 +33,7 @@ >
-
Countries Visited
+
{$t('dashboard.countries_visited')}
{stats.country_count}
@@ -54,7 +51,7 @@ >
-
Total Adventures
+
{$t('dashboard.total_adventures')}
{stats.adventure_count}
@@ -72,32 +69,31 @@ >
-
Total Visited Regions
+
{$t('dashboard.total_visited_regions')}
{stats.visited_region_count}
-

Recent Adventures

-
- {#each recentAdventures as adventure} - - {/each} -
- - -
-
- Inspiration -
-
-

Get Inspired

-

"{inspirationQuote}"

-
- -
+ {#if recentAdventures.length > 0} +

{$t('dashboard.recent_adventures')}

+
+ {#each recentAdventures as adventure} + + {/each}
-
+ {/if} + + + {#if recentAdventures.length === 0} +
+

{$t('dashboard.no_recent_adventures')}

+

+ {$t('dashboard.add_some')} +

+ {$t('map.add_adventure')} +
+ {/if}
diff --git a/frontend/src/routes/settings/+page.svelte b/frontend/src/routes/settings/+page.svelte index 1b9dd1d..2ad898b 100644 --- a/frontend/src/routes/settings/+page.svelte +++ b/frontend/src/routes/settings/+page.svelte @@ -100,7 +100,9 @@ emails = [...emails, { email: new_email, verified: false, primary: false }]; new_email = ''; } else { - addToast('error', $t('settings.email_added_error')); + let error = await res.json(); + let error_code = error.errors[0].code; + addToast('error', $t(`settings.${error_code}`) || $t('settings.generic_error')); } } diff --git a/frontend/src/routes/signup/+page.server.ts b/frontend/src/routes/signup/+page.server.ts index 2541936..4a1d857 100644 --- a/frontend/src/routes/signup/+page.server.ts +++ b/frontend/src/routes/signup/+page.server.ts @@ -41,11 +41,11 @@ export const actions: Actions = { if (!csrfTokenFetch.ok) { event.locals.user = null; - return fail(500, { message: 'Failed to fetch CSRF token' }); + return fail(500, { message: 'settings.csrf_failed' }); } if (password1 !== password2) { - return fail(400, { message: 'Passwords do not match' }); + return fail(400, { message: 'settings.password_does_not_match' }); } const tokenPromise = await csrfTokenFetch.json(); @@ -69,7 +69,7 @@ export const actions: Actions = { const loginResponse = await loginFetch.json(); if (!loginFetch.ok) { - return fail(loginFetch.status, loginResponse); + return fail(loginFetch.status, { message: loginResponse.errors[0].code }); } else { const setCookieHeader = loginFetch.headers.get('Set-Cookie'); diff --git a/frontend/src/routes/signup/+page.svelte b/frontend/src/routes/signup/+page.svelte index 7278785..6643e06 100644 --- a/frontend/src/routes/signup/+page.svelte +++ b/frontend/src/routes/signup/+page.svelte @@ -94,7 +94,7 @@ {#if $page.form?.message} -
{$page.form?.message}
+
{$t($page.form?.message)}
{/if} {:else}
diff --git a/frontend/src/routes/user/verify-email/[key]/+page.server.ts b/frontend/src/routes/user/verify-email/[key]/+page.server.ts index 86f82ee..d9b641b 100644 --- a/frontend/src/routes/user/verify-email/[key]/+page.server.ts +++ b/frontend/src/routes/user/verify-email/[key]/+page.server.ts @@ -21,13 +21,14 @@ export const load = (async (event) => { body: JSON.stringify({ key: key }) }); - if (!verifyFetch.ok) { + if (verifyFetch.ok || verifyFetch.status == 401) { + return { + verified: true + }; + } else { let error_message = await verifyFetch.json(); console.error(error_message); console.error('Failed to verify email'); return { status: 404 }; } - return { - verified: true - }; }) satisfies PageServerLoad;