From 0379c95f9b3978f0cf4a0754e54faa81395dcbce Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Thu, 5 Mar 2026 15:48:25 +0100 Subject: [PATCH] Add translations --- common/messages/de.json | 7 ++++++- common/messages/fr.json | 7 ++++++- web/pages/[username]/index.tsx | 17 ++++++++++------- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/common/messages/de.json b/common/messages/de.json index dc6aeaf5..c8819a03 100644 --- a/common/messages/de.json +++ b/common/messages/de.json @@ -1271,5 +1271,10 @@ "share_profile.on_x": "Auf X teilen", "share_profile.on_linkedin": "Auf LinkedIn teilen", "share_profile.view_profile_card": "Profilkarte ansehen", - "profile_card.loading": "Ihre Karte wird geladen, es kann ein paar Sekunden dauern..." + "profile_card.loading": "Ihre Karte wird geladen, es kann ein paar Sekunden dauern...", + "userpage.failedToFetch": "Profil konnte nicht geladen werden.", + "userpage.accountDeleted": "Dieses Konto wurde gelöscht.", + "userpage.accountSuspended": "Dieses Konto wurde gesperrt.", + "userpage.profileNotCreated": "Dieser Benutzer hat noch kein Profil erstellt.", + "userpage.profileDisabled": "Der Benutzer hat sein Profil deaktiviert." } diff --git a/common/messages/fr.json b/common/messages/fr.json index 4d16319c..92978728 100644 --- a/common/messages/fr.json +++ b/common/messages/fr.json @@ -1270,5 +1270,10 @@ "share_profile.on_x": "Partager sur X", "share_profile.on_linkedin": "Partager sur LinkedIn", "share_profile.view_profile_card": "Voir la carte de profil", - "profile_card.loading": "Chargement de votre carte, cela peut prendre quelques secondes..." + "profile_card.loading": "Chargement de votre carte, cela peut prendre quelques secondes...", + "userpage.failedToFetch": "Échec du chargement du profil.", + "userpage.accountDeleted": "Ce compte a été supprimé.", + "userpage.accountSuspended": "Ce compte a été suspendu.", + "userpage.profileNotCreated": "Cet utilisateur n'a pas encore créé de profil.", + "userpage.profileDisabled": "L'utilisateur a désactivé son profil." } diff --git a/web/pages/[username]/index.tsx b/web/pages/[username]/index.tsx index 7d5f9b65..03837184 100644 --- a/web/pages/[username]/index.tsx +++ b/web/pages/[username]/index.tsx @@ -20,6 +20,7 @@ import {useProfileByUser} from 'web/hooks/use-profile' import {useSaveReferral} from 'web/hooks/use-save-referral' import {useTracking} from 'web/hooks/use-tracking' import {useUser} from 'web/hooks/use-user' +import {useT} from 'web/lib/locale' import {db} from 'web/lib/supabase/db' import {safeLocalStorage} from 'web/lib/util/local' import {getPageData} from 'web/lib/util/page-data' @@ -117,7 +118,7 @@ export const getStaticProps = async ( debug('No profile', `${user.username} hasn't created a profile yet.`) return { props: { - notFoundCustomText: `${user.username} hasn't created a profile yet.`, + notFoundCustomText: null, }, revalidate: 1, } @@ -135,7 +136,7 @@ export const getStaticProps = async ( // Runs at build time for SSG (native mobile), or at runtime for ISR fallback in web export const getStaticPaths = () => { - console.log('Starting getStaticPaths in /[username]', isNativeMobile()) + // console.log('Starting getStaticPaths in /[username]', isNativeMobile()) return {paths: [], fallback: 'blocking'} } @@ -153,6 +154,7 @@ type ActiveUserPageProps = { export default function UserPage(props: UserPageProps) { const nativeMobile = isNativeMobile() const router = useRouter() + const t = useT() const username = (nativeMobile ? router.query.username : props.username) as string const [loading, setLoading] = useState(nativeMobile) const fromSignup = router?.query?.fromSignup === 'true' @@ -201,7 +203,7 @@ export default function UserPage(props: UserPageProps) { console.error('Failed to fetch profile for native mobile', e) setFetchedProps({ username, - notFoundCustomText: 'Failed to fetch profile.', + notFoundCustomText: t('userpage.failedToFetch', 'Failed to fetch profile.'), }) } setLoading(false) @@ -231,7 +233,7 @@ export default function UserPage(props: UserPageProps) {
- This account has been deleted. + {t('userpage.accountDeleted', 'This account has been deleted.')}
@@ -243,7 +245,7 @@ export default function UserPage(props: UserPageProps) {
- This account has been suspended. + {t('userpage.accountSuspended', 'This account has been suspended.')}
@@ -255,7 +257,7 @@ export default function UserPage(props: UserPageProps) {
- This user hasn't created a profile yet. + {t('userpage.profileNotCreated', "This user hasn't created a profile yet.")}
@@ -269,6 +271,7 @@ function UserPageInner(props: ActiveUserPageProps) { // debug('Starting UserPageInner in /[username]') const {user, username} = props const router = useRouter() + const t = useT() const {query} = router const fromSignup = query.fromSignup === 'true' @@ -289,7 +292,7 @@ function UserPageInner(props: ActiveUserPageProps) {
- The user disabled their profile. + {t('userpage.profileDisabled', 'The user disabled their profile.')}