From 0e17427a586f77ce3a2ca3153bbc4c0fbddfd453 Mon Sep 17 00:00:00 2001 From: "Calum H." Date: Mon, 20 Oct 2025 01:23:06 +0100 Subject: [PATCH] fix: #4568 & i18n on user page (#4572) * fix: #4568 * fix: lint --- apps/frontend/src/locales/en-US/index.json | 57 ++++++-- apps/frontend/src/pages/user/[id].vue | 148 ++++++++++++++++----- 2 files changed, 160 insertions(+), 45 deletions(-) diff --git a/apps/frontend/src/locales/en-US/index.json b/apps/frontend/src/locales/en-US/index.json index 0666d2629..087870e3c 100644 --- a/apps/frontend/src/locales/en-US/index.json +++ b/apps/frontend/src/locales/en-US/index.json @@ -1112,6 +1112,12 @@ "moderation.technical.search.placeholder": { "message": "Search tech reviews..." }, + "profile.bio.fallback.creator": { + "message": "A Modrinth creator." + }, + "profile.bio.fallback.user": { + "message": "A Modrinth user." + }, "profile.button.billing": { "message": "Manage user billing" }, @@ -1124,18 +1130,48 @@ "profile.button.manage-projects": { "message": "Manage projects" }, + "profile.details.label.auth-providers": { + "message": "Auth providers" + }, + "profile.details.label.email": { + "message": "Email" + }, + "profile.details.label.has-password": { + "message": "Has password" + }, + "profile.details.label.has-totp": { + "message": "Has TOTP" + }, + "profile.details.label.payment-methods": { + "message": "Payment methods" + }, + "profile.details.tooltip.email-not-verified": { + "message": "Email not verified" + }, + "profile.details.tooltip.email-verified": { + "message": "Email verified" + }, "profile.error.not-found": { "message": "User not found" }, - "profile.joined-at": { - "message": "Joined {ago}" - }, "profile.label.badges": { "message": "Badges" }, + "profile.label.collection": { + "message": "Collection" + }, "profile.label.details": { "message": "Details" }, + "profile.label.downloads": { + "message": "{count} {count, plural, one {download} other {downloads}}" + }, + "profile.label.joined": { + "message": "Joined" + }, + "profile.label.no": { + "message": "No" + }, "profile.label.no-collections": { "message": "This user has no collections!" }, @@ -1151,18 +1187,21 @@ "profile.label.organizations": { "message": "Organizations" }, + "profile.label.projects": { + "message": "{count} {count, plural, one {project} other {projects}}" + }, + "profile.label.saving": { + "message": "Saving..." + }, + "profile.label.yes": { + "message": "Yes" + }, "profile.meta.description": { "message": "Download {username}'s projects on Modrinth" }, "profile.meta.description-with-bio": { "message": "{bio} - Download {username}'s projects on Modrinth" }, - "profile.stats.downloads": { - "message": "{count, plural, one {{count} project download} other {{count} project downloads}}" - }, - "profile.stats.projects": { - "message": "{count, plural, one {{count} project} other {{count} projects}}" - }, "profile.stats.projects-followers": { "message": "{count, plural, one {{count} project follower} other {{count} project followers}}" }, diff --git a/apps/frontend/src/pages/user/[id].vue b/apps/frontend/src/pages/user/[id].vue index 09eabae61..38182a890 100644 --- a/apps/frontend/src/pages/user/[id].vue +++ b/apps/frontend/src/pages/user/[id].vue @@ -16,7 +16,7 @@ @@ -25,9 +25,11 @@ @click="saveRoleEdit" > + - @@ -36,10 +38,16 @@
- Email + {{ + formatMessage(messages.emailLabel) + }}
{{ user.email }} @@ -50,12 +58,16 @@
- Auth providers + {{ + formatMessage(messages.authProvidersLabel) + }} {{ user.auth_providers.join(', ') }}
- Payment methods + {{ + formatMessage(messages.paymentMethodsLabel) + }} @@ -287,7 +311,7 @@

{{ collection.name }}

@@ -298,25 +322,27 @@
{{ - `${$formatNumber(collection.projects?.length || 0, false)} project${(collection.projects?.length || 0) !== 1 ? 's' : ''}` + `${$formatNumber(collection.projects?.length || 0, false)} project${ + (collection.projects?.length || 0) !== 1 ? 's' : '' + }` }}
@@ -450,25 +476,75 @@ const formatRelativeTime = useRelativeTime() const { addNotification } = injectNotificationManager() const messages = defineMessages({ - profileProjectsStats: { - id: 'profile.stats.projects', - defaultMessage: - '{count, plural, one {{count} project} other {{count} projects}}', + profileProjectsLabel: { + id: 'profile.label.projects', + defaultMessage: '{count} {count, plural, one {project} other {projects}}', }, - profileDownloadsStats: { - id: 'profile.stats.downloads', - defaultMessage: - '{count, plural, one {{count} project download} other {{count} project downloads}}', + profileDownloadsLabel: { + id: 'profile.label.downloads', + defaultMessage: '{count} {count, plural, one {download} other {downloads}}', + }, + profileJoinedLabel: { + id: 'profile.label.joined', + defaultMessage: 'Joined', + }, + savingLabel: { + id: 'profile.label.saving', + defaultMessage: 'Saving...', + }, + emailLabel: { + id: 'profile.details.label.email', + defaultMessage: 'Email', + }, + emailVerifiedTooltip: { + id: 'profile.details.tooltip.email-verified', + defaultMessage: 'Email verified', + }, + emailNotVerifiedTooltip: { + id: 'profile.details.tooltip.email-not-verified', + defaultMessage: 'Email not verified', + }, + authProvidersLabel: { + id: 'profile.details.label.auth-providers', + defaultMessage: 'Auth providers', + }, + paymentMethodsLabel: { + id: 'profile.details.label.payment-methods', + defaultMessage: 'Payment methods', + }, + hasPasswordLabel: { + id: 'profile.details.label.has-password', + defaultMessage: 'Has password', + }, + hasTotpLabel: { + id: 'profile.details.label.has-totp', + defaultMessage: 'Has TOTP', + }, + yesLabel: { + id: 'profile.label.yes', + defaultMessage: 'Yes', + }, + noLabel: { + id: 'profile.label.no', + defaultMessage: 'No', + }, + bioFallbackUser: { + id: 'profile.bio.fallback.user', + defaultMessage: 'A Modrinth user.', + }, + bioFallbackCreator: { + id: 'profile.bio.fallback.creator', + defaultMessage: 'A Modrinth creator.', + }, + collectionLabel: { + id: 'profile.label.collection', + defaultMessage: 'Collection', }, profileProjectsFollowersStats: { id: 'profile.stats.projects-followers', defaultMessage: '{count, plural, one {{count} project follower} other {{count} project followers}}', }, - profileJoinedAt: { - id: 'profile.joined-at', - defaultMessage: 'Joined {ago}', - }, profileUserId: { id: 'profile.user-id', defaultMessage: 'User ID: {id}',