From c7207ccf52d205b2465b8bd8731e767474939ea2 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Tue, 5 Nov 2024 14:40:32 -0500 Subject: [PATCH] Add internationalization support for profile and shared collections; update translations in multiple languages --- frontend/src/lib/components/NewCollection.svelte | 2 +- frontend/src/locales/de.json | 11 ++++++++++- frontend/src/locales/en.json | 11 ++++++++++- frontend/src/locales/es.json | 11 ++++++++++- frontend/src/locales/fr.json | 11 ++++++++++- frontend/src/locales/it.json | 11 ++++++++++- frontend/src/locales/nl.json | 11 ++++++++++- frontend/src/locales/sv.json | 11 ++++++++++- frontend/src/locales/zh.json | 11 ++++++++++- frontend/src/routes/profile/+page.svelte | 13 +++++++------ frontend/src/routes/shared/+page.svelte | 8 +++++--- 11 files changed, 93 insertions(+), 18 deletions(-) diff --git a/frontend/src/lib/components/NewCollection.svelte b/frontend/src/lib/components/NewCollection.svelte index 519b2a4..29887a7 100644 --- a/frontend/src/lib/components/NewCollection.svelte +++ b/frontend/src/lib/components/NewCollection.svelte @@ -119,7 +119,7 @@
export let data; + import { t } from 'svelte-i18n'; let stats: { country_count: number; @@ -36,7 +37,7 @@

{data.user.username}

{#if data.user && data.user.date_joined} -

Member Since

+

{$t('profile.member_since')}

@@ -49,23 +50,23 @@

-

User Stats

+

{$t('profile.user_stats')}

-
Adventures
+
{$t('navbar.adventures')}
{stats.adventure_count}
-
Collections
+
{$t('navbar.collections')}
{stats.trips_count}
-
Visited Countries
+
{$t('profile.visited_countries')}
{Math.round((stats.country_count / stats.total_countries) * 100)}%
@@ -75,7 +76,7 @@
-
Visited Regions
+
{$t('profile.visited_regions')}
{Math.round((stats.visited_region_count / stats.total_regions) * 100)}%
diff --git a/frontend/src/routes/shared/+page.svelte b/frontend/src/routes/shared/+page.svelte index 231935e..6207c15 100644 --- a/frontend/src/routes/shared/+page.svelte +++ b/frontend/src/routes/shared/+page.svelte @@ -3,6 +3,7 @@ import CollectionCard from '$lib/components/CollectionCard.svelte'; import type { Collection } from '$lib/types'; import type { PageData } from './$types'; + import { t } from 'svelte-i18n'; export let data: PageData; console.log(data); @@ -17,10 +18,11 @@
{:else}

- No collections found that are shared with you. + {$t('share.no_shared_found')} {#if data.user && !data.user?.public_profile} -

In order to allow users to share with you, you need your profile set to public.

- {$t('share.set_public')}

+ {/if}