From eff812eaa8b37909163771b5401aa91843dd8417 Mon Sep 17 00:00:00 2001 From: Lokowitz Date: Sat, 17 May 2025 18:17:22 +0000 Subject: [PATCH] first fixes --- messages/de-DE.json | 6 ++--- messages/en-US.json | 26 ++++--------------- messages/fr-FR.json | 6 ++--- messages/it-IT.json | 6 ++--- messages/pl-PL.json | 6 ++--- messages/pt-PT.json | 2 +- messages/tr-TR.json | 4 +-- .../settings/access/roles/CreateRoleForm.tsx | 5 ++-- .../settings/access/roles/DeleteRoleForm.tsx | 5 ++-- .../settings/access/users/create/page.tsx | 21 +++++++-------- .../[orgId]/settings/access/users/page.tsx | 4 +-- .../settings/api-keys/[apiKeyId]/layout.tsx | 5 ++-- .../api-keys/[apiKeyId]/permissions/page.tsx | 12 ++++----- src/app/[orgId]/settings/api-keys/page.tsx | 5 ++-- src/app/[orgId]/settings/layout.tsx | 4 +-- .../settings/resources/ResourcesTable.tsx | 7 ++--- .../resources/[resourceId]/general/page.tsx | 21 +++++---------- .../resources/[resourceId]/proxy/page.tsx | 7 +++-- src/app/[orgId]/settings/resources/page.tsx | 5 ++-- src/app/admin/api-keys/[apiKeyId]/layout.tsx | 4 +-- src/app/admin/idp/[idpId]/layout.tsx | 4 +-- src/app/admin/idp/create/page.tsx | 5 ++-- src/app/admin/idp/page.tsx | 5 ++-- src/app/admin/users/page.tsx | 4 +-- src/app/auth/layout.tsx | 4 +-- src/app/auth/login/page.tsx | 4 +-- src/app/not-found.tsx | 7 ++--- 27 files changed, 80 insertions(+), 114 deletions(-) diff --git a/messages/de-DE.json b/messages/de-DE.json index d710e14b..c94c7786 100644 --- a/messages/de-DE.json +++ b/messages/de-DE.json @@ -359,10 +359,10 @@ "inviteRemoveErrorDescription": "Beim Entfernen der Einladung ist ein Fehler aufgetreten.", "inviteRemoved": "Einladung entfernt", "inviteRemovedDescription": "Die Einladung für {email} wurde entfernt.", - "inviteQuestionRemove": "Sind Sie sicher, dass Sie die Einladung{email, plural, ='' {}, other { für #}} entfernen möchten?", + "inviteQuestionRemove": "Sind Sie sicher, dass Sie die Einladung {email} entfernen möchten?", "inviteMessageRemove": "Sobald entfernt, wird diese Einladung nicht mehr gültig sein. Sie können den Benutzer später jederzeit erneut einladen.", "inviteMessageConfirm": "Bitte geben Sie zur Bestätigung die E-Mail-Adresse der Einladung unten ein.", - "inviteQuestionRegenerate": "Sind Sie sicher, dass Sie die Einladung{email, plural, ='' {}, other { für #}} neu generieren möchten? Dies wird die vorherige Einladung widerrufen.", + "inviteQuestionRegenerate": "Sind Sie sicher, dass Sie die Einladung {email} neu generieren möchten? Dies wird die vorherige Einladung widerrufen.", "inviteRemoveConfirm": "Entfernen der Einladung bestätigen", "inviteRegenerated": "Einladung neu generiert", "inviteSent": "Eine neue Einladung wurde an {email} gesendet.", @@ -431,7 +431,7 @@ "accessRoleSelect": "Rolle auswählen", "inviteEmailSentDescription": "Eine E-Mail mit dem Zugangslink wurde an den Benutzer gesendet. Er muss den Link aufrufen, um die Einladung anzunehmen.", "inviteSentDescription": "Der Benutzer wurde eingeladen. Er muss den unten stehenden Link aufrufen, um die Einladung anzunehmen.", - "inviteExpiresIn": "Die Einladung läuft in {days, plural, =1 {einem Tag} other {# Tagen}} ab.", + "inviteExpiresIn": "Die Einladung läuft in {days, plural, =1 {einem Tag} other {# Tagen}} ab.", "idpTitle": "Identitätsanbieter", "idpSelect": "Wählen Sie den Identitätsanbieter für den externen Benutzer", "idpNotConfigured": "Es sind keine Identitätsanbieter konfiguriert. Bitte konfigurieren Sie einen Identitätsanbieter, bevor Sie externe Benutzer erstellen.", diff --git a/messages/en-US.json b/messages/en-US.json index bd279447..112a39db 100644 --- a/messages/en-US.json +++ b/messages/en-US.json @@ -359,7 +359,7 @@ "inviteRemoveErrorDescription": "An error occurred while removing the invitation.", "inviteRemoved": "Invitation removed", "inviteRemovedDescription": "The invitation for {email} has been removed.", - "inviteQuestionRemove": "Are you sure you want to remove the invitation {email}?", + "inviteQuestionRemove ": "Are you sure you want to remove the invitation {email}?", "inviteMessageRemove": "Once removed, this invitation will no longer be valid. You can always re-invite the user later.", "inviteMessageConfirm": "To confirm, please type the email address of the invitation below.", "inviteQuestionRegenerate": "Are you sure you want to regenerate the invitation for {email}? This will revoke the previous invitation.", @@ -431,7 +431,7 @@ "accessRoleSelect": "Select role", "inviteEmailSentDescription": "An email has been sent to the user with the access link below. They must access the link to accept the invitation.", "inviteSentDescription": "The user has been invited. They must access the link below to accept the invitation.", - "inviteExpiresIn": "The invite will expire in {days, plural, =1 {# day} other {# days}}.", + "inviteExpiresIn": "The invite will expire in {days, plural, =1 {# day} other {# days}}.", "idpTitle": "Identity Provider", "idpSelect": "Select the identity provider for the external user", "idpNotConfigured": "No identity providers are configured. Please configure an identity provider before creating external users.", @@ -684,7 +684,7 @@ "accessRoleErrorRemove": "Failed to remove role", "accessRoleErrorRemoveDescription": "An error occurred while removing the role.", "accessRoleName": "Role Name", - "accessRoleQuestionRemove": "You're about to delete the {name} role. You cannot undo this action.", + "accessRoleQuestionRemove": "You're about to delete the {name} role. You cannot undo this action.", "accessRoleRemove": "Remove Role", "accessRoleRemoveDescription": "Remove a role from the organization", "accessRoleRemoveSubmit": "Remove Role", @@ -693,9 +693,7 @@ "accessRoleRequiredRemove": "Before deleting this role, please select a new role to transfer existing members to.", "manage": "Manage", "sitesNotFound": "No sites found.", - "expiresAt": "Expires At", "pangolinServerAdmin": "Server Admin - Pangolin", - "idpNameInternal": "Internal", "licenseTierProfessional": "Professional License", "licenseTierEnterprise": "Enterprise License", "licensed": "Licensed", @@ -717,8 +715,6 @@ "idp": "Identity Providers", "idpSearch": "Search identity providers...", "idpAdd": "Add Identity Provider", - "nameMin": "Name must be at least {len} characters.", - "nameMax": "Name must not be longer than {len} characters.", "idpClientIdRequired": "Client ID is required.", "idpClientSecretRequired": "Client Secret is required.", "idpErrorAuthUrlInvalid": "Auth URL must be a valid URL.", @@ -730,7 +726,6 @@ "idpCreate": "Create Identity Provider", "idpCreateDescription": "Configure a new identity provider for user authentication", "idpSeeAll": "See All Identity Providers", - "idpTitle": "General Information", "idpSettingsDescription": "Configure the basic information for your identity provider", "idpDisplayName": "A display name for this identity provider", "idpAutoProvisionUsers": "Auto Provision Users", @@ -779,8 +774,8 @@ "orgPolicyDeletedDescription": "Policy deleted successfully", "defaultMappingsUpdatedDescription": "Default mappings updated successfully", "orgPoliciesAbout": "About Organization Policies", - "orgPoliciesAboutDescription": "Organization policies are used to control access to organizations based on the user's ID token. You can specify JMESPath expressions to extract role and organization information from the ID token. For more information, see", - "orgPoliciesAboutDescriptionLink": "the documentation", + "orgPoliciesAboutDescription": "Organization policies are used to control access to organizations based on the user's ID token. You can specify JMESPath expressions to extract role and organization information from the ID token.", + "orgPoliciesAboutDescriptionLink": "See documentation, for more information.", "defaultMappingsOptional": "Default Mappings (Optional)", "defaultMappingsOptionalDescription": "The default mappings are used when when there is not an organization policy defined for an organization. You can specify the default role and organization mappings to fall back to here.", "defaultMappingsRole": "Default Role Mapping", @@ -801,11 +796,7 @@ "redirectUrl": "Redirect URL", "redirectUrlAbout": "About Redirect URL", "redirectUrlAboutDescription": "This is the URL to which users will be redirected after authentication. You need to configure this URL in your identity provider settings.", - "key": "Key", - "createdAt": "Created At", - "expiresAt": "Expires At", "pangolinAuth": "Auth - Pangolin", - "emailInvalid": "Invalid email address", "verificationCodeLengthRequirements": "Your verification code must be 8 characters.", "errorOccurred": "An error occurred", "emailErrorVerify": "Failed to verify email:", @@ -887,7 +878,6 @@ "idpConnectingToFinished": "Connected", "idpErrorConnectingTo": "There was a problem connecting to {name}. Please contact your administrator.", "idpErrorNotFound": "IdP not found", - "expiresAt": "Expires At", "inviteInvalid": "Invalid Invite", "inviteInvalidDescription": "The invite link is invalid.", "inviteErrorWrongUser": "Invite is not for this user", @@ -904,15 +894,9 @@ "pageNotFoundDescription": "Oops! The page you're looking for doesn't exist.", "overview": "Overview", "home": "Home", - "sites": "Sites", - "resources": "Resources", "accessControl": "Access Control", - "users": "Users", - "roles": "Roles", - "share": "Shareable Links", "settings": "Settings", "usersAll": "All Users", - "idp": "Identity Providers", "license": "License", "pangolinDashboard": "Dashboard - Pangolin" } diff --git a/messages/fr-FR.json b/messages/fr-FR.json index d1ced0f5..fe5faedc 100644 --- a/messages/fr-FR.json +++ b/messages/fr-FR.json @@ -359,10 +359,10 @@ "inviteRemoveErrorDescription": "Une erreur s'est produite lors de la suppression de l'invitation.", "inviteRemoved": "Invitation supprimée", "inviteRemovedDescription": "L'invitation pour {email} a été supprimée.", - "inviteQuestionRemove": "Êtes-vous sûr de vouloir supprimer l'invitation{email, plural, ='' {}, other { pour #}} ?", + "inviteQuestionRemove": "Êtes-vous sûr de vouloir supprimer l'invitation {email}?", "inviteMessageRemove": "Une fois supprimée, cette invitation ne sera plus valide. Vous pourrez toujours réinviter l'utilisateur plus tard.", "inviteMessageConfirm": "Pour confirmer, veuillez saisir l'adresse e-mail de l'invitation ci-dessous.", - "inviteQuestionRegenerate": "Êtes-vous sûr de vouloir régénérer l'invitation{email, plural, ='' {}, other { pour #}} ? Cela révoquera l'invitation précédente.", + "inviteQuestionRegenerate": "Êtes-vous sûr de vouloir régénérer l'invitation {email}? Cela révoquera l'invitation précédente.", "inviteRemoveConfirm": "Confirmer la suppression de l'invitation", "inviteRegenerated": "Invitation régénérée", "inviteSent": "Une nouvelle invitation a été envoyée à {email}.", @@ -431,7 +431,7 @@ "accessRoleSelect": "Sélectionner un rôle", "inviteEmailSentDescription": "Un e-mail a été envoyé à l'utilisateur avec le lien d'accès ci-dessous. Ils doivent accéder au lien pour accepter l'invitation.", "inviteSentDescription": "L'utilisateur a été invité. Ils doivent accéder au lien ci-dessous pour accepter l'invitation.", - "inviteExpiresIn": "L'invitation expirera dans {days, plural, =1 {# jour} other {# jours}}.", + "inviteExpiresIn": "L'invitation expirera dans {days, plural, =1 {# jour} other {# jours}}.", "idpTitle": "Fournisseur d'identité", "idpSelect": "Sélectionnez le fournisseur d'identité pour l'utilisateur externe", "idpNotConfigured": "Aucun fournisseur d'identité n'est configuré. Veuillez configurer un fournisseur d'identité avant de créer des utilisateurs externes.", diff --git a/messages/it-IT.json b/messages/it-IT.json index c33cd9cd..c72f08bc 100644 --- a/messages/it-IT.json +++ b/messages/it-IT.json @@ -359,10 +359,10 @@ "inviteRemoveErrorDescription": "Si è verificato un errore durante la rimozione dell'invito.", "inviteRemoved": "Invito rimosso", "inviteRemovedDescription": "L'invito per {email} è stato rimosso.", - "inviteQuestionRemove": "Sei sicuro di voler rimuovere l'invito{email, plural, ='' {}, other { per #}}?", + "inviteQuestionRemove": "Sei sicuro di voler rimuovere l'invito {email}?", "inviteMessageRemove": "Una volta rimosso, questo invito non sarà più valido. Puoi sempre reinvitare l'utente in seguito.", "inviteMessageConfirm": "Per confermare, digita l'indirizzo email dell'invito qui sotto.", - "inviteQuestionRegenerate": "Sei sicuro di voler rigenerare l'invito{email, plural, ='' {}, other { per #}}? Questo revocherà l'invito precedente.", + "inviteQuestionRegenerate": "Sei sicuro di voler rigenerare l'invito {email}? Questo revocherà l'invito precedente.", "inviteRemoveConfirm": "Conferma Rimozione Invito", "inviteRegenerated": "Invito Rigenerato", "inviteSent": "Un nuovo invito è stato inviato a {email}.", @@ -431,7 +431,7 @@ "accessRoleSelect": "Seleziona ruolo", "inviteEmailSentDescription": "È stata inviata un'email all'utente con il link di accesso qui sotto. Devono accedere al link per accettare l'invito.", "inviteSentDescription": "L'utente è stato invitato. Deve accedere al link qui sotto per accettare l'invito.", - "inviteExpiresIn": "L'invito scadrà tra {days, plural, =1 {# giorno} other {# giorni}}.", + "inviteExpiresIn": "L'invito scadrà tra {days, plural, =1 {# giorno} other {# giorni}}.", "idpTitle": "Provider di Identità", "idpSelect": "Seleziona il provider di identità per l'utente esterno", "idpNotConfigured": "Nessun provider di identità configurato. Configura un provider di identità prima di creare utenti esterni.", diff --git a/messages/pl-PL.json b/messages/pl-PL.json index 0336f120..d11a743b 100644 --- a/messages/pl-PL.json +++ b/messages/pl-PL.json @@ -359,10 +359,10 @@ "inviteRemoveErrorDescription": "Wystąpił błąd podczas usuwania zaproszenia.", "inviteRemoved": "Zaproszenie usunięte", "inviteRemovedDescription": "Zaproszenie dla {email} zostało usunięte.", - "inviteQuestionRemove": "Czy na pewno chcesz usunąć zaproszenie{email, plural, ='' {}, other { dla #}}?", + "inviteQuestionRemove": "Czy na pewno chcesz usunąć zaproszenie {email}?", "inviteMessageRemove": "Po usunięciu to zaproszenie nie będzie już ważne. Zawsze możesz ponownie zaprosić użytkownika później.", "inviteMessageConfirm": "Aby potwierdzić, wpisz poniżej adres email zaproszenia.", - "inviteQuestionRegenerate": "Czy na pewno chcesz ponownie wygenerować zaproszenie{email, plural, ='' {}, other { dla #}}? Spowoduje to unieważnienie poprzedniego zaproszenia.", + "inviteQuestionRegenerate": "Czy na pewno chcesz ponownie wygenerować zaproszenie {email}? Spowoduje to unieważnienie poprzedniego zaproszenia.", "inviteRemoveConfirm": "Potwierdź usunięcie zaproszenia", "inviteRegenerated": "Zaproszenie wygenerowane ponownie", "inviteSent": "Nowe zaproszenie zostało wysłane do {email}.", @@ -431,7 +431,7 @@ "accessRoleSelect": "Wybierz rolę", "inviteEmailSentDescription": "Email został wysłany do użytkownika z linkiem dostępu poniżej. Musi on uzyskać dostęp do linku, aby zaakceptować zaproszenie.", "inviteSentDescription": "Użytkownik został zaproszony. Musi uzyskać dostęp do poniższego linku, aby zaakceptować zaproszenie.", - "inviteExpiresIn": "Zaproszenie wygaśnie za {days, plural, =1 {# dzień} other {# dni}}.", + "inviteExpiresIn": "Zaproszenie wygaśnie za {days, plural, =1 {# dzień} other {# dni}}.", "idpTitle": "Dostawca tożsamości", "idpSelect": "Wybierz dostawcę tożsamości dla użytkownika zewnętrznego", "idpNotConfigured": "Nie skonfigurowano żadnych dostawców tożsamości. Skonfiguruj dostawcę tożsamości przed utworzeniem użytkowników zewnętrznych.", diff --git a/messages/pt-PT.json b/messages/pt-PT.json index c35487e1..75b0d8ef 100644 --- a/messages/pt-PT.json +++ b/messages/pt-PT.json @@ -431,7 +431,7 @@ "accessRoleSelect": "Selecionar função", "inviteEmailSentDescription": "Um e-mail foi enviado ao usuário com o link de acesso abaixo. Eles devem acessar o link para aceitar o convite.", "inviteSentDescription": "O usuário foi convidado. Eles devem acessar o link abaixo para aceitar o convite.", - "inviteExpiresIn": "O convite expirará em {days, plural, =1 {# dia} other {# dias}}.", + "inviteExpiresIn": "O convite expirará em {days, plural, =1 {# dia} other {# dias}}.", "idpTitle": "Provedor de Identidade", "idpSelect": "Selecione o provedor de identidade para o usuário externo", "idpNotConfigured": "Nenhum provedor de identidade está configurado. Configure um provedor de identidade antes de criar usuários externos.", diff --git a/messages/tr-TR.json b/messages/tr-TR.json index bd279447..3209478c 100644 --- a/messages/tr-TR.json +++ b/messages/tr-TR.json @@ -431,7 +431,7 @@ "accessRoleSelect": "Select role", "inviteEmailSentDescription": "An email has been sent to the user with the access link below. They must access the link to accept the invitation.", "inviteSentDescription": "The user has been invited. They must access the link below to accept the invitation.", - "inviteExpiresIn": "The invite will expire in {days, plural, =1 {# day} other {# days}}.", + "inviteExpiresIn": "The invite will expire in {days, plural, =1 {# day} other {# days}}.", "idpTitle": "Identity Provider", "idpSelect": "Select the identity provider for the external user", "idpNotConfigured": "No identity providers are configured. Please configure an identity provider before creating external users.", @@ -684,7 +684,7 @@ "accessRoleErrorRemove": "Failed to remove role", "accessRoleErrorRemoveDescription": "An error occurred while removing the role.", "accessRoleName": "Role Name", - "accessRoleQuestionRemove": "You're about to delete the {name} role. You cannot undo this action.", + "accessRoleQuestionRemove": "You're about to delete the {name} role. You cannot undo this action.", "accessRoleRemove": "Remove Role", "accessRoleRemoveDescription": "Remove a role from the organization", "accessRoleRemoveSubmit": "Remove Role", diff --git a/src/app/[orgId]/settings/access/roles/CreateRoleForm.tsx b/src/app/[orgId]/settings/access/roles/CreateRoleForm.tsx index 3bf2c59d..eb44eb40 100644 --- a/src/app/[orgId]/settings/access/roles/CreateRoleForm.tsx +++ b/src/app/[orgId]/settings/access/roles/CreateRoleForm.tsx @@ -39,10 +39,8 @@ type CreateRoleFormProps = { afterCreate?: (res: CreateRoleResponse) => Promise; }; -const t = useTranslations(); - const formSchema = z.object({ - name: z.string({ message: t('accessRoleNameRequired') }).max(32), + name: z.string({ message: "Name is required" }).max(32), description: z.string().max(255).optional() }); @@ -52,6 +50,7 @@ export default function CreateRoleForm({ afterCreate }: CreateRoleFormProps) { const { org } = useOrgContext(); + const t = useTranslations(); const [loading, setLoading] = useState(false); diff --git a/src/app/[orgId]/settings/access/roles/DeleteRoleForm.tsx b/src/app/[orgId]/settings/access/roles/DeleteRoleForm.tsx index b6da44ea..0501f0d1 100644 --- a/src/app/[orgId]/settings/access/roles/DeleteRoleForm.tsx +++ b/src/app/[orgId]/settings/access/roles/DeleteRoleForm.tsx @@ -47,10 +47,8 @@ type CreateRoleFormProps = { afterDelete?: () => void; }; -const t = useTranslations(); - const formSchema = z.object({ - newRoleId: z.string({ message: t('accessRoleErrorNewRequired') }) + newRoleId: z.string({ message: "New role is required" }) }); export default function DeleteRoleForm({ @@ -60,6 +58,7 @@ export default function DeleteRoleForm({ afterDelete }: CreateRoleFormProps) { const { org } = useOrgContext(); + const t = useTranslations(); const [loading, setLoading] = useState(false); const [roles, setRoles] = useState([]); diff --git a/src/app/[orgId]/settings/access/users/create/page.tsx b/src/app/[orgId]/settings/access/users/create/page.tsx index 0d9d2438..4c96a241 100644 --- a/src/app/[orgId]/settings/access/users/create/page.tsx +++ b/src/app/[orgId]/settings/access/users/create/page.tsx @@ -60,30 +60,28 @@ interface IdpOption { type: string; } -const t = useTranslations(); - const internalFormSchema = z.object({ - email: z.string().email({ message: t('emailInvalid') }), - validForHours: z.string().min(1, { message: t('inviteValidityDuration') }), - roleId: z.string().min(1, { message: t('accessRoleSelectPlease') }) + email: z.string().email({ message: "Invalid email address" }), + validForHours: z.string().min(1, { message: "Please select a duration" }), + roleId: z.string().min(1, { message: "Please select a role" }) }); const externalFormSchema = z.object({ - username: z.string().min(1, { message: t('usernameRequired') }), + username: z.string().min(1, { message: "Username is required" }), email: z .string() - .email({ message: t('emailInvalid') }) + .email({ message: "Invalid email address" }) .optional() .or(z.literal("")), name: z.string().optional(), - roleId: z.string().min(1, { message: t('accessRoleSelectPlease') }), - idpId: z.string().min(1, { message: t('idpSelectPlease') }) + roleId: z.string().min(1, { message: "Please select a role" }), + idpId: z.string().min(1, { message: "Please select an identity provider" }) }); const formatIdpType = (type: string) => { switch (type.toLowerCase()) { case "oidc": - return t('idpGenericOidc'); + return "Generic OAuth2/OIDC provider."; default: return type; } @@ -94,6 +92,7 @@ export default function Page() { const router = useRouter(); const { env } = useEnvContext(); const api = createApiClient({ env }); + const t = useTranslations(); const [userType, setUserType] = useState("internal"); const [inviteLink, setInviteLink] = useState(null); @@ -351,7 +350,7 @@ export default function Page() { - {t('userInfo')} + {t('userSettings')} {t('userSettingsDescription')} diff --git a/src/app/[orgId]/settings/access/users/page.tsx b/src/app/[orgId]/settings/access/users/page.tsx index 789d4583..27b227fa 100644 --- a/src/app/[orgId]/settings/access/users/page.tsx +++ b/src/app/[orgId]/settings/access/users/page.tsx @@ -11,7 +11,6 @@ import { verifySession } from "@app/lib/auth/verifySession"; import AccessPageHeaderAndNav from "../AccessPageHeaderAndNav"; import SettingsSectionTitle from "@app/components/SettingsSectionTitle"; import { getTranslations } from 'next-intl/server'; -import { useTranslations } from "next-intl"; type UsersPageProps = { params: Promise<{ orgId: string }>; @@ -24,8 +23,7 @@ export default async function UsersPage(props: UsersPageProps) { const getUser = cache(verifySession); const user = await getUser(); - - const t = useTranslations(); + const t = await getTranslations(); let users: ListUsersResponse["users"] = []; let hasInvitations = false; diff --git a/src/app/[orgId]/settings/api-keys/[apiKeyId]/layout.tsx b/src/app/[orgId]/settings/api-keys/[apiKeyId]/layout.tsx index 618bc76e..8343249c 100644 --- a/src/app/[orgId]/settings/api-keys/[apiKeyId]/layout.tsx +++ b/src/app/[orgId]/settings/api-keys/[apiKeyId]/layout.tsx @@ -15,7 +15,7 @@ import { import { GetApiKeyResponse } from "@server/routers/apiKeys"; import ApiKeyProvider from "@app/providers/ApiKeyProvider"; import { HorizontalTabs } from "@app/components/HorizontalTabs"; -import { useTranslations } from "next-intl"; +import { getTranslations } from 'next-intl/server'; interface SettingsLayoutProps { children: React.ReactNode; @@ -24,8 +24,7 @@ interface SettingsLayoutProps { export default async function SettingsLayout(props: SettingsLayoutProps) { const params = await props.params; - - const t = useTranslations(); + const t = await getTranslations(); const { children } = props; diff --git a/src/app/[orgId]/settings/api-keys/[apiKeyId]/permissions/page.tsx b/src/app/[orgId]/settings/api-keys/[apiKeyId]/permissions/page.tsx index 0cc76d2a..121d9523 100644 --- a/src/app/[orgId]/settings/api-keys/[apiKeyId]/permissions/page.tsx +++ b/src/app/[orgId]/settings/api-keys/[apiKeyId]/permissions/page.tsx @@ -45,10 +45,10 @@ export default function Page() { .catch((e) => { toast({ variant: "destructive", - title: "Error loading API key actions", + title: t('apiKeysPermissionsErrorLoadingActions'), description: formatAxiosError( e, - "Error loading API key actions" + t('apiKeysPermissionsErrorLoadingActions') ) }); }); @@ -79,18 +79,18 @@ export default function Page() { ) }) .catch((e) => { - console.error("Error setting permissions", e); + console.error(t('apiKeysErrorSetPermission'), e); toast({ variant: "destructive", - title: "Error setting permissions", + title: t('apiKeysErrorSetPermission'), description: formatAxiosError(e) }); }); if (actionsRes && actionsRes.status === 200) { toast({ - title: "Permissions updated", - description: "The permissions have been updated." + title: t('apiKeysPermissionsUpdated'), + description: t('apiKeysPermissionsUpdatedDescription') }); } diff --git a/src/app/[orgId]/settings/api-keys/page.tsx b/src/app/[orgId]/settings/api-keys/page.tsx index dee061a9..188921e5 100644 --- a/src/app/[orgId]/settings/api-keys/page.tsx +++ b/src/app/[orgId]/settings/api-keys/page.tsx @@ -4,7 +4,7 @@ import { AxiosResponse } from "axios"; import SettingsSectionTitle from "@app/components/SettingsSectionTitle"; import OrgApiKeysTable, { OrgApiKeyRow } from "./OrgApiKeysTable"; import { ListOrgApiKeysResponse } from "@server/routers/apiKeys"; -import { useTranslations } from "next-intl"; +import { getTranslations } from 'next-intl/server'; type ApiKeyPageProps = { params: Promise<{ orgId: string }>; @@ -14,7 +14,8 @@ export const dynamic = "force-dynamic"; export default async function ApiKeysPage(props: ApiKeyPageProps) { const params = await props.params; - const t = useTranslations(); + const t = await getTranslations(); + let apiKeys: ListOrgApiKeysResponse["apiKeys"] = []; try { const res = await internal.get>( diff --git a/src/app/[orgId]/settings/layout.tsx b/src/app/[orgId]/settings/layout.tsx index 14053ab6..215f554f 100644 --- a/src/app/[orgId]/settings/layout.tsx +++ b/src/app/[orgId]/settings/layout.tsx @@ -19,7 +19,7 @@ import UserProvider from "@app/providers/UserProvider"; import { Layout } from "@app/components/Layout"; import { SidebarNavItem, SidebarNavProps } from "@app/components/SidebarNav"; import { orgNavItems } from "@app/app/navigation"; -import { useTranslations } from "next-intl"; +import { getTranslations } from 'next-intl/server'; export const dynamic = "force-dynamic"; @@ -47,7 +47,7 @@ export default async function SettingsLayout(props: SettingsLayoutProps) { const cookie = await authCookieHeader(); - const t = useTranslations(); + const t = await getTranslations(); try { const getOrgUser = cache(() => diff --git a/src/app/[orgId]/settings/resources/ResourcesTable.tsx b/src/app/[orgId]/settings/resources/ResourcesTable.tsx index 1b96cd28..7c6f4340 100644 --- a/src/app/[orgId]/settings/resources/ResourcesTable.tsx +++ b/src/app/[orgId]/settings/resources/ResourcesTable.tsx @@ -89,11 +89,8 @@ export default function SitesTable({ resources, orgId }: ResourcesTableProps) { .catch((e) => { toast({ variant: "destructive", - title: "Failed to toggle resource", - description: formatAxiosError( - e, - "An error occurred while updating the resource" - ) + title: t('resourcesErrorUpdate'), + description: formatAxiosError(e, t('resourcesErrorUpdateDescription')) }); }); } diff --git a/src/app/[orgId]/settings/resources/[resourceId]/general/page.tsx b/src/app/[orgId]/settings/resources/[resourceId]/general/page.tsx index 677646de..9facce58 100644 --- a/src/app/[orgId]/settings/resources/[resourceId]/general/page.tsx +++ b/src/app/[orgId]/settings/resources/[resourceId]/general/page.tsx @@ -67,8 +67,6 @@ import { import { SwitchInput } from "@app/components/SwitchInput"; import { useTranslations } from "next-intl"; -const t = useTranslations(); - const GeneralFormSchema = z .object({ subdomain: z.string().optional(), @@ -91,7 +89,7 @@ const GeneralFormSchema = z return true; }, { - message: t('proxyErrorInvalidPort'), + message: "Invalid port number", path: ["proxyPort"] } ) @@ -103,7 +101,7 @@ const GeneralFormSchema = z return true; }, { - message: t('subdomainErrorInvalid'), + message: "Invalid subdomain", path: ["subdomain"] } ); @@ -121,6 +119,7 @@ export default function GeneralForm() { const { resource, updateResource } = useResourceContext(); const { org } = useOrgContext(); const router = useRouter(); + const t = useTranslations(); const { env } = useEnvContext(); @@ -178,10 +177,7 @@ export default function GeneralForm() { toast({ variant: "destructive", title: t('domainErrorFetch'), - description: formatAxiosError( - e, - t('domainErrorFetchDescription') - ) + description: formatAxiosError(e, t('domainErrorFetchDescription')) }); }); @@ -220,10 +216,7 @@ export default function GeneralForm() { toast({ variant: "destructive", title: t('resourceErrorUpdate'), - description: formatAxiosError( - e, - t('resourceErrorUpdateDescription') - ) + description: formatAxiosError(e, t('resourceErrorUpdateDescription')) }); }); @@ -259,9 +252,7 @@ export default function GeneralForm() { toast({ variant: "destructive", title: t('resourceErrorTransfer'), - description: formatAxiosError( - e, - t('resourceErrorTransferDescription') + description: formatAxiosError(e, t('resourceErrorTransferDescription') ) }); }); diff --git a/src/app/[orgId]/settings/resources/[resourceId]/proxy/page.tsx b/src/app/[orgId]/settings/resources/[resourceId]/proxy/page.tsx index bf452f99..dbbb3805 100644 --- a/src/app/[orgId]/settings/resources/[resourceId]/proxy/page.tsx +++ b/src/app/[orgId]/settings/resources/[resourceId]/proxy/page.tsx @@ -93,8 +93,6 @@ type LocalTarget = Omit< "protocol" >; -const t = useTranslations(); - const proxySettingsSchema = z.object({ setHostHeader: z .string() @@ -107,7 +105,7 @@ const proxySettingsSchema = z.object({ return true; }, { - message: t('proxyErrorInvalidHeader') + message: "Invalid custom Host Header value. Use domain name format, or save empty to unset custom Host Header." } ) }); @@ -125,7 +123,7 @@ const tlsSettingsSchema = z.object({ return true; }, { - message: t('proxyErrorTls') + message: "Invalid TLS Server Name. Use domain name format, or save empty to remove the TLS Server Name." } ) }); @@ -138,6 +136,7 @@ export default function ReverseProxyTargets(props: { params: Promise<{ resourceId: number }>; }) { const params = use(props.params); + const t = useTranslations(); const { resource, updateResource } = useResourceContext(); diff --git a/src/app/[orgId]/settings/resources/page.tsx b/src/app/[orgId]/settings/resources/page.tsx index 74eda80e..908a8691 100644 --- a/src/app/[orgId]/settings/resources/page.tsx +++ b/src/app/[orgId]/settings/resources/page.tsx @@ -10,7 +10,6 @@ import { GetOrgResponse } from "@server/routers/org"; import OrgProvider from "@app/providers/OrgProvider"; import ResourcesSplashCard from "./ResourcesSplashCard"; import { getTranslations } from 'next-intl/server'; -import { useTranslations } from "next-intl"; type ResourcesPageProps = { params: Promise<{ orgId: string }>; @@ -20,6 +19,8 @@ export const dynamic = "force-dynamic"; export default async function ResourcesPage(props: ResourcesPageProps) { const params = await props.params; + const t = await getTranslations(); + let resources: ListResourcesResponse["resources"] = []; try { const res = await internal.get>( @@ -47,8 +48,6 @@ export default async function ResourcesPage(props: ResourcesPageProps) { redirect(`/${params.orgId}/settings/resources`); } - const t = useTranslations(); - const resourceRows: ResourceRow[] = resources.map((resource) => { return { id: resource.resourceId, diff --git a/src/app/admin/api-keys/[apiKeyId]/layout.tsx b/src/app/admin/api-keys/[apiKeyId]/layout.tsx index d9ce4e8a..818fcccc 100644 --- a/src/app/admin/api-keys/[apiKeyId]/layout.tsx +++ b/src/app/admin/api-keys/[apiKeyId]/layout.tsx @@ -15,7 +15,7 @@ import { import { GetApiKeyResponse } from "@server/routers/apiKeys"; import ApiKeyProvider from "@app/providers/ApiKeyProvider"; import { HorizontalTabs } from "@app/components/HorizontalTabs"; -import { useTranslations } from "next-intl"; +import { getTranslations } from 'next-intl/server'; interface SettingsLayoutProps { children: React.ReactNode; @@ -25,7 +25,7 @@ interface SettingsLayoutProps { export default async function SettingsLayout(props: SettingsLayoutProps) { const params = await props.params; - const t = useTranslations(); + const t = await getTranslations(); const { children } = props; diff --git a/src/app/admin/idp/[idpId]/layout.tsx b/src/app/admin/idp/[idpId]/layout.tsx index 06082a80..aab5e26d 100644 --- a/src/app/admin/idp/[idpId]/layout.tsx +++ b/src/app/admin/idp/[idpId]/layout.tsx @@ -15,7 +15,7 @@ import { BreadcrumbPage, BreadcrumbSeparator } from "@app/components/ui/breadcrumb"; -import { useTranslations } from "next-intl"; +import { getTranslations } from 'next-intl/server'; interface SettingsLayoutProps { children: React.ReactNode; @@ -37,7 +37,7 @@ export default async function SettingsLayout(props: SettingsLayoutProps) { redirect("/admin/idp"); } - const t = useTranslations(); + const t = await getTranslations(); const navItems: HorizontalTabs = [ { diff --git a/src/app/admin/idp/create/page.tsx b/src/app/admin/idp/create/page.tsx index f7f6350e..fd19fb41 100644 --- a/src/app/admin/idp/create/page.tsx +++ b/src/app/admin/idp/create/page.tsx @@ -371,7 +371,7 @@ export default function Page() { {/*TODO(vlalx): Validate replacing */} - {t('idpJmespathAboutDescription')} + {t('idpJmespathAboutDescription')}{" "} ( - "idpOidcConfigureScopes": "Scopes" - {t('')} + {t('idpOidcConfigureScopes')} diff --git a/src/app/admin/idp/page.tsx b/src/app/admin/idp/page.tsx index 80bb6146..3f40e960 100644 --- a/src/app/admin/idp/page.tsx +++ b/src/app/admin/idp/page.tsx @@ -3,7 +3,7 @@ import { authCookieHeader } from "@app/lib/api/cookies"; import { AxiosResponse } from "axios"; import SettingsSectionTitle from "@app/components/SettingsSectionTitle"; import IdpTable, { IdpRow } from "./AdminIdpTable"; -import { useTranslations } from "next-intl"; +import { getTranslations } from 'next-intl/server'; export default async function IdpPage() { let idps: IdpRow[] = []; @@ -16,7 +16,8 @@ export default async function IdpPage() { } catch (e) { console.error(e); } - const t = useTranslations(); + + const t = await getTranslations(); return ( <> diff --git a/src/app/admin/users/page.tsx b/src/app/admin/users/page.tsx index 41e58dc7..793c5f31 100644 --- a/src/app/admin/users/page.tsx +++ b/src/app/admin/users/page.tsx @@ -7,7 +7,6 @@ import UsersTable, { GlobalUserRow } from "./AdminUsersTable"; import { Alert, AlertDescription, AlertTitle } from "@app/components/ui/alert"; import { InfoIcon } from "lucide-react"; import { getTranslations } from 'next-intl/server'; -import { useTranslations } from "next-intl"; type PageProps = { params: Promise<{ orgId: string }>; @@ -26,7 +25,8 @@ export default async function UsersPage(props: PageProps) { } catch (e) { console.error(e); } - const t = useTranslations(); + + const t = await getTranslations(); const userRows: GlobalUserRow[] = rows.map((row) => { return { diff --git a/src/app/auth/layout.tsx b/src/app/auth/layout.tsx index edce345b..0079ebe5 100644 --- a/src/app/auth/layout.tsx +++ b/src/app/auth/layout.tsx @@ -8,7 +8,7 @@ import { AxiosResponse } from "axios"; import { ExternalLink } from "lucide-react"; import { Metadata } from "next"; import { cache } from "react"; -import { useTranslations } from "next-intl"; +import { getTranslations } from 'next-intl/server'; export const metadata: Metadata = { title: `Auth - Pangolin`, @@ -22,7 +22,7 @@ type AuthLayoutProps = { export default async function AuthLayout({ children }: AuthLayoutProps) { const getUser = cache(verifySession); const user = await getUser(); - const t = useTranslations(); + const t = await getTranslations(); const licenseStatusRes = await cache( async () => diff --git a/src/app/auth/login/page.tsx b/src/app/auth/login/page.tsx index 179180a7..73935870 100644 --- a/src/app/auth/login/page.tsx +++ b/src/app/auth/login/page.tsx @@ -9,7 +9,7 @@ import { cleanRedirect } from "@app/lib/cleanRedirect"; import db from "@server/db"; import { idp } from "@server/db/schemas"; import { LoginFormIDP } from "@app/components/LoginForm"; -import { useTranslations } from "next-intl"; +import { getTranslations } from 'next-intl/server'; export const dynamic = "force-dynamic"; @@ -41,7 +41,7 @@ export default async function Page(props: { name: idp.name })) as LoginFormIDP[]; - const t = useTranslations(); + const t = await getTranslations(); return ( <> diff --git a/src/app/not-found.tsx b/src/app/not-found.tsx index a1cd6103..058ccc2b 100644 --- a/src/app/not-found.tsx +++ b/src/app/not-found.tsx @@ -1,8 +1,9 @@ -import Link from "next/link"; -import { useTranslations } from "next-intl"; +import { getTranslations } from 'next-intl/server'; export default async function NotFound() { - const t = useTranslations(); + + const t = await getTranslations(); + return (

404