diff --git a/messages/de-DE.json b/messages/de-DE.json index aeba3d65..50173903 100644 --- a/messages/de-DE.json +++ b/messages/de-DE.json @@ -245,5 +245,43 @@ "days": "Tage", "weeks": "Wochen", "months": "Monate", - "years": "Jahre" -} \ No newline at end of file + "years": "Jahre", + "apiKeysTitle": "API-Schlüssel Information", + "apiKeysNameMin": "Name muss mindestens 2 Zeichen lang sein.", + "apiKeysNameMax": "Name darf nicht länger als 255 Zeichen sein.", + "apiKeysConfirmCopy2": "Sie müssen bestätigen, dass Sie den API-Schlüssel kopiert haben.", + "apiKeysErrorCreate": "Fehler beim Erstellen des API-Schlüssels", + "apiKeysErrorSetPermission": "Fehler beim Setzen der Berechtigungen", + "apiKeysCreate": "API-Schlüssel generieren", + "apiKeysCreateDescription": "Generieren Sie einen neuen API-Schlüssel für Ihre Organisation", + "apiKeysGeneralSettings": "Berechtigungen", + "apiKeysGeneralSettingsDescription": "Legen Sie fest, was dieser API-Schlüssel tun kann", + "apiKeysList": "Ihr API-Schlüssel", + "apiKeysSave": "Speichern Sie Ihren API-Schlüssel", + "apiKeysSaveDescription": "Sie können dies nur einmal sehen. Kopieren Sie es an einen sicheren Ort.", + "apiKeysInfo": "Ihr API-Schlüssel ist:", + "apiKeysConfirmCopy": "Ich habe den API-Schlüssel kopiert", + "generate": "Generieren", + "done": "Fertig", + "apiKeysSeeAll": "Alle API-Schlüssel anzeigen", + "apiKeysPermissionsErrorLoadingActions": "Fehler beim Laden der API-Schlüsselaktionen", + "apiKeysPermissionsErrorUpdate": "Fehler beim Setzen der Berechtigungen", + "apiKeysPermissionsUpdated": "Berechtigungen aktualisiert", + "apiKeysPermissionsUpdatedDescription": "Die Berechtigungen wurden aktualisiert.", + "apiKeysPermissionsGeneralSettings": "Berechtigungen", + "apiKeysPermissionsGeneralSettingsDescription": "Legen Sie fest, was dieser API-Schlüssel tun kann", + "apiKeysPermissionsSave": "Berechtigungen speichern", + "apiKeysPermissionsTitle": "Berechtigungen", + "apiKeys": "API-Schlüssel", + "searchApiKeys": "API-Schlüssel suchen...", + "apiKeysAdd": "API-Schlüssel generieren", + "apiKeysErrorDelete": "Fehler beim Löschen des API-Schlüssels", + "apiKeysErrorDeleteMessage": "Fehler beim Löschen des API-Schlüssels", + "apiKeysQuestionRemove": "Sind Sie sicher, dass Sie den API-Schlüssel {selectedApiKey} aus der Organisation entfernen möchten?", + "apiKeysMessageRemove": "Einmal entfernt, kann der API-Schlüssel nicht mehr verwendet werden.", + "apiKeysMessageConfirm": "Zur Bestätigung geben Sie bitte den Namen des API-Schlüssels unten ein.", + "apiKeysDeleteConfirm": "Löschen des API-Schlüssels bestätigen", + "apiKeysDelete": "API-Schlüssel löschen", + "apiKeysManage": "API-Schlüssel verwalten", + "apiKeysDescription": "API-Schlüssel werden zur Authentifizierung mit der Integrations-API verwendet" +} diff --git a/messages/en-US.json b/messages/en-US.json index 68add635..562977b3 100644 --- a/messages/en-US.json +++ b/messages/en-US.json @@ -247,5 +247,43 @@ "days": "Days", "weeks": "Weeks", "months": "Months", - "years": "Years" -} \ No newline at end of file + "years": "Years", + "apiKeysTitle": "API Key Information", + "apiKeysNameMin": "Name must be at least 2 characters.", + "apiKeysNameMax": "Name must not be longer than 255 characters.", + "apiKeysConfirmCopy2": "You must confirm that you have copied the API key.", + "apiKeysErrorCreate": "Error creating API key", + "apiKeysErrorSetPermission": "Error setting permissions", + "apiKeysCreate": "Generate API Key", + "apiKeysCreateDescription": "Generate a new API key for your organization", + "apiKeysGeneralSettings": "Permissions", + "apiKeysGeneralSettingsDescription": "Determine what this API key can do", + "apiKeysList": "Your API Key", + "apiKeysSave": "Save Your API Key", + "apiKeysSaveDescription": "You will only be able to see this once. Make sure to copy it to a secure place.", + "apiKeysInfo": "Your API key is:", + "apiKeysConfirmCopy": "I have copied the API key", + "generate": "Generate", + "done": "Done", + "apiKeysSeeAll": "See All API Keys", + "apiKeysPermissionsErrorLoadingActions": "Error loading API key actions", + "apiKeysPermissionsErrorUpdate": "Error setting permissions", + "apiKeysPermissionsUpdated": "Permissions updated", + "apiKeysPermissionsUpdatedDescription": "The permissions have been updated.", + "apiKeysPermissionsGeneralSettings": "Permissions", + "apiKeysPermissionsGeneralSettingsDescription": "Determine what this API key can do", + "apiKeysPermissionsSave": "Save Permissions", + "apiKeysPermissionsTitle": "Permissions", + "apiKeys": "API Keys", + "searchApiKeys": "Search API keys...", + "apiKeysAdd": "Generate API Key", + "apiKeysErrorDelete": "Error deleting API key", + "apiKeysErrorDeleteMessage": "Error deleting API key", + "apiKeysQuestionRemove": "Are you sure you want to remove the API key {selectedApiKey} from the organization?", + "apiKeysMessageRemove": "Once removed, the API key will no longer be able to be used.", + "apiKeysMessageConfirm": "To confirm, please type the name of the API key below.", + "apiKeysDeleteConfirm": "Confirm Delete API Key", + "apiKeysDelete": "Delete API Key", + "apiKeysManage": "Manage API Keys", + "apiKeysDescription": "API keys are used to authenticate with the integration API" +} diff --git a/messages/fr-FR.json b/messages/fr-FR.json index e11fa66f..9aaf1654 100644 --- a/messages/fr-FR.json +++ b/messages/fr-FR.json @@ -245,5 +245,43 @@ "days": "Jours", "weeks": "Semaines", "months": "Mois", - "years": "Années" -} \ No newline at end of file + "years": "Années", + "apiKeysTitle": "Informations sur la clé API", + "apiKeysNameMin": "Le nom doit comporter au moins 2 caractères.", + "apiKeysNameMax": "Le nom ne doit pas dépasser 255 caractères.", + "apiKeysConfirmCopy2": "Vous devez confirmer que vous avez copié la clé API.", + "apiKeysErrorCreate": "Erreur lors de la création de la clé API", + "apiKeysErrorSetPermission": "Erreur lors de la définition des permissions", + "apiKeysCreate": "Générer une clé API", + "apiKeysCreateDescription": "Générer une nouvelle clé API pour votre organisation", + "apiKeysGeneralSettings": "Permissions", + "apiKeysGeneralSettingsDescription": "Déterminez ce que cette clé API peut faire", + "apiKeysList": "Votre clé API", + "apiKeysSave": "Enregistrer votre clé API", + "apiKeysSaveDescription": "Vous ne pourrez voir cela qu'une seule fois. Assurez-vous de la copier dans un endroit sécurisé.", + "apiKeysInfo": "Votre clé API est :", + "apiKeysConfirmCopy": "J'ai copié la clé API", + "generate": "Générer", + "done": "Terminé", + "apiKeysSeeAll": "Voir toutes les clés API", + "apiKeysPermissionsErrorLoadingActions": "Erreur lors du chargement des actions de la clé API", + "apiKeysPermissionsErrorUpdate": "Erreur lors de la définition des permissions", + "apiKeysPermissionsUpdated": "Permissions mises à jour", + "apiKeysPermissionsUpdatedDescription": "Les permissions ont été mises à jour.", + "apiKeysPermissionsGeneralSettings": "Permissions", + "apiKeysPermissionsGeneralSettingsDescription": "Déterminez ce que cette clé API peut faire", + "apiKeysPermissionsSave": "Enregistrer les permissions", + "apiKeysPermissionsTitle": "Permissions", + "apiKeys": "Clés API", + "searchApiKeys": "Rechercher des clés API...", + "apiKeysAdd": "Générer une clé API", + "apiKeysErrorDelete": "Erreur lors de la suppression de la clé API", + "apiKeysErrorDeleteMessage": "Erreur lors de la suppression de la clé API", + "apiKeysQuestionRemove": "Êtes-vous sûr de vouloir supprimer la clé API {selectedApiKey} de l'organisation ?", + "apiKeysMessageRemove": "Une fois supprimée, la clé API ne pourra plus être utilisée.", + "apiKeysMessageConfirm": "Pour confirmer, veuillez saisir le nom de la clé API ci-dessous.", + "apiKeysDeleteConfirm": "Confirmer la suppression de la clé API", + "apiKeysDelete": "Supprimer la clé API", + "apiKeysManage": "Gérer les clés API", + "apiKeysDescription": "Les clés API sont utilisées pour s'authentifier avec l'API d'intégration" +} diff --git a/messages/it-IT.json b/messages/it-IT.json index 39483529..3909a646 100644 --- a/messages/it-IT.json +++ b/messages/it-IT.json @@ -245,5 +245,43 @@ "days": "Giorni", "weeks": "Settimane", "months": "Mesi", - "years": "Anni" -} \ No newline at end of file + "years": "Anni", + "apiKeysTitle": "Informazioni Chiave API", + "apiKeysNameMin": "Il nome deve contenere almeno 2 caratteri.", + "apiKeysNameMax": "Il nome non deve essere più lungo di 255 caratteri.", + "apiKeysConfirmCopy2": "Devi confermare di aver copiato la chiave API.", + "apiKeysErrorCreate": "Errore nella creazione della chiave API", + "apiKeysErrorSetPermission": "Errore nell'impostazione dei permessi", + "apiKeysCreate": "Genera Chiave API", + "apiKeysCreateDescription": "Genera una nuova chiave API per la tua organizzazione", + "apiKeysGeneralSettings": "Permessi", + "apiKeysGeneralSettingsDescription": "Determina cosa può fare questa chiave API", + "apiKeysList": "La Tua Chiave API", + "apiKeysSave": "Salva La Tua Chiave API", + "apiKeysSaveDescription": "Potrai vederla solo una volta. Assicurati di copiarla in un luogo sicuro.", + "apiKeysInfo": "La tua chiave API è:", + "apiKeysConfirmCopy": "Ho copiato la chiave API", + "generate": "Genera", + "done": "Fatto", + "apiKeysSeeAll": "Vedi Tutte Le Chiavi API", + "apiKeysPermissionsErrorLoadingActions": "Errore nel caricamento delle azioni della chiave API", + "apiKeysPermissionsErrorUpdate": "Errore nell'impostazione dei permessi", + "apiKeysPermissionsUpdated": "Permessi aggiornati", + "apiKeysPermissionsUpdatedDescription": "I permessi sono stati aggiornati.", + "apiKeysPermissionsGeneralSettings": "Permessi", + "apiKeysPermissionsGeneralSettingsDescription": "Determina cosa può fare questa chiave API", + "apiKeysPermissionsSave": "Salva Permessi", + "apiKeysPermissionsTitle": "Permessi", + "apiKeys": "Chiavi API", + "searchApiKeys": "Cerca chiavi API...", + "apiKeysAdd": "Genera Chiave API", + "apiKeysErrorDelete": "Errore nell'eliminazione della chiave API", + "apiKeysErrorDeleteMessage": "Errore nell'eliminazione della chiave API", + "apiKeysQuestionRemove": "Sei sicuro di voler rimuovere la chiave API {selectedApiKey} dall'organizzazione?", + "apiKeysMessageRemove": "Una volta rimossa, la chiave API non potrà più essere utilizzata.", + "apiKeysMessageConfirm": "Per confermare, digita il nome della chiave API qui sotto.", + "apiKeysDeleteConfirm": "Conferma Eliminazione Chiave API", + "apiKeysDelete": "Elimina Chiave API", + "apiKeysManage": "Gestisci Chiavi API", + "apiKeysDescription": "Le chiavi API sono utilizzate per autenticarsi con l'API di integrazione" +} diff --git a/messages/pl-PL.json b/messages/pl-PL.json index 8ca316e0..313ca200 100644 --- a/messages/pl-PL.json +++ b/messages/pl-PL.json @@ -245,5 +245,43 @@ "days": "Dni", "weeks": "Tygodnie", "months": "Miesiące", - "years": "Lata" -} \ No newline at end of file + "years": "Lata", + "apiKeysTitle": "Informacje o kluczu API", + "apiKeysNameMin": "Nazwa musi mieć co najmniej 2 znaki.", + "apiKeysNameMax": "Nazwa nie może być dłuższa niż 255 znaków.", + "apiKeysConfirmCopy2": "Musisz potwierdzić, że skopiowałeś klucz API.", + "apiKeysErrorCreate": "Błąd podczas tworzenia klucza API", + "apiKeysErrorSetPermission": "Błąd podczas ustawiania uprawnień", + "apiKeysCreate": "Generuj klucz API", + "apiKeysCreateDescription": "Wygeneruj nowy klucz API dla swojej organizacji", + "apiKeysGeneralSettings": "Uprawnienia", + "apiKeysGeneralSettingsDescription": "Określ, co ten klucz API może zrobić", + "apiKeysList": "Twój klucz API", + "apiKeysSave": "Zapisz swój klucz API", + "apiKeysSaveDescription": "Będziesz mógł zobaczyć to tylko raz. Upewnij się, że skopiujesz go w bezpieczne miejsce.", + "apiKeysInfo": "Twój klucz API to:", + "apiKeysConfirmCopy": "Skopiowałem klucz API", + "generate": "Generuj", + "done": "Gotowe", + "apiKeysSeeAll": "Zobacz wszystkie klucze API", + "apiKeysPermissionsErrorLoadingActions": "Błąd podczas ładowania akcji klucza API", + "apiKeysPermissionsErrorUpdate": "Błąd podczas ustawiania uprawnień", + "apiKeysPermissionsUpdated": "Uprawnienia zaktualizowane", + "apiKeysPermissionsUpdatedDescription": "Uprawnienia zostały zaktualizowane.", + "apiKeysPermissionsGeneralSettings": "Uprawnienia", + "apiKeysPermissionsGeneralSettingsDescription": "Określ, co ten klucz API może zrobić", + "apiKeysPermissionsSave": "Zapisz uprawnienia", + "apiKeysPermissionsTitle": "Uprawnienia", + "apiKeys": "Klucze API", + "searchApiKeys": "Szukaj kluczy API...", + "apiKeysAdd": "Generuj klucz API", + "apiKeysErrorDelete": "Błąd podczas usuwania klucza API", + "apiKeysErrorDeleteMessage": "Błąd podczas usuwania klucza API", + "apiKeysQuestionRemove": "Czy na pewno chcesz usunąć klucz API {selectedApiKey} z organizacji?", + "apiKeysMessageRemove": "Po usunięciu klucz API nie będzie już mógł być używany.", + "apiKeysMessageConfirm": "Aby potwierdzić, wpisz nazwę klucza API poniżej.", + "apiKeysDeleteConfirm": "Potwierdź usunięcie klucza API", + "apiKeysDelete": "Usuń klucz API", + "apiKeysManage": "Zarządzaj kluczami API", + "apiKeysDescription": "Klucze API służą do uwierzytelniania z API integracji" +} diff --git a/messages/pt-PT.json b/messages/pt-PT.json index 6abfa1c2..f45b0b05 100644 --- a/messages/pt-PT.json +++ b/messages/pt-PT.json @@ -245,5 +245,43 @@ "days": "dias", "weeks": "semanas", "months": "Meses", - "years": "anos" -} \ No newline at end of file + "years": "anos", + "apiKeysTitle": "Informações da Chave API", + "apiKeysNameMin": "O nome deve ter pelo menos 2 caracteres.", + "apiKeysNameMax": "O nome não deve ter mais de 255 caracteres.", + "apiKeysConfirmCopy2": "Você deve confirmar que copiou a chave API.", + "apiKeysErrorCreate": "Erro ao criar chave API", + "apiKeysErrorSetPermission": "Erro ao definir permissões", + "apiKeysCreate": "Gerar Chave API", + "apiKeysCreateDescription": "Gerar uma nova chave API para sua organização", + "apiKeysGeneralSettings": "Permissões", + "apiKeysGeneralSettingsDescription": "Determine o que esta chave API pode fazer", + "apiKeysList": "Sua Chave API", + "apiKeysSave": "Salvar Sua Chave API", + "apiKeysSaveDescription": "Você só poderá ver isto uma vez. Certifique-se de copiá-la para um local seguro.", + "apiKeysInfo": "Sua chave API é:", + "apiKeysConfirmCopy": "Eu copiei a chave API", + "generate": "Gerar", + "done": "Concluído", + "apiKeysSeeAll": "Ver Todas as Chaves API", + "apiKeysPermissionsErrorLoadingActions": "Erro ao carregar ações da chave API", + "apiKeysPermissionsErrorUpdate": "Erro ao definir permissões", + "apiKeysPermissionsUpdated": "Permissões atualizadas", + "apiKeysPermissionsUpdatedDescription": "As permissões foram atualizadas.", + "apiKeysPermissionsGeneralSettings": "Permissões", + "apiKeysPermissionsGeneralSettingsDescription": "Determine o que esta chave API pode fazer", + "apiKeysPermissionsSave": "Salvar Permissões", + "apiKeysPermissionsTitle": "Permissões", + "apiKeys": "Chaves API", + "searchApiKeys": "Pesquisar chaves API...", + "apiKeysAdd": "Gerar Chave API", + "apiKeysErrorDelete": "Erro ao excluir chave API", + "apiKeysErrorDeleteMessage": "Erro ao excluir chave API", + "apiKeysQuestionRemove": "Tem certeza que deseja remover a chave API {selectedApiKey} da organização?", + "apiKeysMessageRemove": "Uma vez removida, a chave API não poderá mais ser utilizada.", + "apiKeysMessageConfirm": "Para confirmar, por favor digite o nome da chave API abaixo.", + "apiKeysDeleteConfirm": "Confirmar Exclusão da Chave API", + "apiKeysDelete": "Excluir Chave API", + "apiKeysManage": "Gerenciar Chaves API", + "apiKeysDescription": "As chaves API são usadas para autenticar com a API de integração" +} diff --git a/messages/tr-TR.json b/messages/tr-TR.json index 3d500de1..6f2c0735 100644 --- a/messages/tr-TR.json +++ b/messages/tr-TR.json @@ -245,5 +245,43 @@ "days": "Days", "weeks": "Weeks", "months": "Months", - "years": "Years" -} \ No newline at end of file + "years": "Years", + "apiKeysTitle": "API Key Information", + "apiKeysNameMin": "Name must be at least 2 characters.", + "apiKeysNameMax": "Name must not be longer than 255 characters.", + "apiKeysConfirmCopy2": "You must confirm that you have copied the API key.", + "apiKeysErrorCreate": "Error creating API key", + "apiKeysErrorSetPermission": "Error setting permissions", + "apiKeysCreate": "Generate API Key", + "apiKeysCreateDescription": "Generate a new API key for your organization", + "apiKeysGeneralSettings": "Permissions", + "apiKeysGeneralSettingsDescription": "Determine what this API key can do", + "apiKeysList": "Your API Key", + "apiKeysSave": "Save Your API Key", + "apiKeysSaveDescription": "You will only be able to see this once. Make sure to copy it to a secure place.", + "apiKeysInfo": "Your API key is:", + "apiKeysConfirmCopy": "I have copied the API key", + "generate": "Generate", + "done": "Done", + "apiKeysSeeAll": "See All API Keys", + "apiKeysPermissionsErrorLoadingActions": "Error loading API key actions", + "apiKeysPermissionsErrorUpdate": "Error setting permissions", + "apiKeysPermissionsUpdated": "Permissions updated", + "apiKeysPermissionsUpdatedDescription": "The permissions have been updated.", + "apiKeysPermissionsGeneralSettings": "Permissions", + "apiKeysPermissionsGeneralSettingsDescription": "Determine what this API key can do", + "apiKeysPermissionsSave": "Save Permissions", + "apiKeysPermissionsTitle": "Permissions", + "apiKeys": "API Keys", + "searchApiKeys": "Search API keys...", + "apiKeysAdd": "Generate API Key", + "apiKeysErrorDelete": "Error deleting API key", + "apiKeysErrorDeleteMessage": "Error deleting API key", + "apiKeysQuestionRemove": "Are you sure you want to remove the API key {selectedApiKey} from the organization?", + "apiKeysMessageRemove": "Once removed, the API key will no longer be able to be used.", + "apiKeysMessageConfirm": "To confirm, please type the name of the API key below.", + "apiKeysDeleteConfirm": "Confirm Delete API Key", + "apiKeysDelete": "Delete API Key", + "apiKeysManage": "Manage API Keys", + "apiKeysDescription": "API keys are used to authenticate with the integration API" +} diff --git a/src/app/[orgId]/settings/api-keys/OrgApiKeysDataTable.tsx b/src/app/[orgId]/settings/api-keys/OrgApiKeysDataTable.tsx index 69fe7176..a68f0e32 100644 --- a/src/app/[orgId]/settings/api-keys/OrgApiKeysDataTable.tsx +++ b/src/app/[orgId]/settings/api-keys/OrgApiKeysDataTable.tsx @@ -7,6 +7,7 @@ import { DataTable } from "@app/components/ui/data-table"; import { ColumnDef } from "@tanstack/react-table"; +import { useTranslations } from "next-intl"; interface DataTableProps { columns: ColumnDef[]; @@ -19,15 +20,18 @@ export function OrgApiKeysDataTable({ columns, data }: DataTableProps) { + + const t = useTranslations(); + return ( ); } diff --git a/src/app/[orgId]/settings/api-keys/OrgApiKeysTable.tsx b/src/app/[orgId]/settings/api-keys/OrgApiKeysTable.tsx index 89e47842..b26bc622 100644 --- a/src/app/[orgId]/settings/api-keys/OrgApiKeysTable.tsx +++ b/src/app/[orgId]/settings/api-keys/OrgApiKeysTable.tsx @@ -24,6 +24,7 @@ import { formatAxiosError } from "@app/lib/api"; import { createApiClient } from "@app/lib/api"; import { useEnvContext } from "@app/hooks/useEnvContext"; import moment from "moment"; +import { useTranslations } from "next-intl"; export type OrgApiKeyRow = { id: string; @@ -49,14 +50,16 @@ export default function OrgApiKeysTable({ const api = createApiClient(useEnvContext()); + const t = useTranslations(); + const deleteSite = (apiKeyId: string) => { api.delete(`/org/${orgId}/api-key/${apiKeyId}`) .catch((e) => { - console.error("Error deleting API key", e); + console.error(t('apiKeysErrorDelete'), e); toast({ variant: "destructive", - title: "Error deleting API key", - description: formatAxiosError(e, "Error deleting API key") + title: t('apiKeysErrorDelete'), + description: formatAxiosError(e, t('apiKeysErrorDeleteMessage')) }); }) .then(() => { @@ -90,7 +93,7 @@ export default function OrgApiKeysTable({ setSelected(apiKeyROw); }} > - View settings + {t('viewSettings')} { @@ -115,7 +118,7 @@ export default function OrgApiKeysTable({ column.toggleSorting(column.getIsSorted() === "asc") } > - Name + {t('name')} ); @@ -145,7 +148,7 @@ export default function OrgApiKeysTable({
@@ -167,28 +170,24 @@ export default function OrgApiKeysTable({ dialog={

- Are you sure you want to remove the API key{" "} - {selected?.name || selected?.id} from the - organization? + {t('apiKeysQuestionRemove', {selectedApiKey: selected?.name || selected?.id})}

- Once removed, the API key will no longer be - able to be used. + {t('apiKeysMessageRemove')}

- To confirm, please type the name of the API key - below. + {t('apiKeysMessageConfirm')}

} - buttonText="Confirm Delete API Key" + buttonText={t('apiKeysDeleteConfirm')} onConfirm={async () => deleteSite(selected!.id)} string={selected.name} - title="Delete API Key" + title={t('apiKeysDelete')} /> )} diff --git a/src/app/[orgId]/settings/api-keys/[apiKeyId]/layout.tsx b/src/app/[orgId]/settings/api-keys/[apiKeyId]/layout.tsx index a4c13c9a..79b28dfd 100644 --- a/src/app/[orgId]/settings/api-keys/[apiKeyId]/layout.tsx +++ b/src/app/[orgId]/settings/api-keys/[apiKeyId]/layout.tsx @@ -20,6 +20,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"; interface SettingsLayoutProps { children: React.ReactNode; @@ -29,6 +30,8 @@ interface SettingsLayoutProps { export default async function SettingsLayout(props: SettingsLayoutProps) { const params = await props.params; + const t = useTranslations(); + const { children } = props; let apiKey = null; @@ -45,7 +48,7 @@ export default async function SettingsLayout(props: SettingsLayoutProps) { const navItems = [ { - title: "Permissions", + title: t('apiKeysPermissionsTitle'), href: "/{orgId}/settings/api-keys/{apiKeyId}/permissions" } ]; 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 d1e6f518..ee0d4ba2 100644 --- a/src/app/[orgId]/settings/api-keys/[apiKeyId]/permissions/page.tsx +++ b/src/app/[orgId]/settings/api-keys/[apiKeyId]/permissions/page.tsx @@ -23,12 +23,15 @@ import { ListApiKeyActionsResponse } from "@server/routers/apiKeys"; import { AxiosResponse } from "axios"; import { useParams } from "next/navigation"; import { useEffect, useState } from "react"; +import { useTranslations } from "next-intl"; export default function Page() { const { env } = useEnvContext(); const api = createApiClient({ env }); const { orgId, apiKeyId } = useParams(); + const t = useTranslations(); + const [loadingPage, setLoadingPage] = useState(true); const [selectedPermissions, setSelectedPermissions] = useState< Record @@ -47,10 +50,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') ) }); }); @@ -81,18 +84,18 @@ export default function Page() { ) }) .catch((e) => { - console.error("Error setting permissions", e); + console.error(t('apiKeysPermissionsErrorUpdate'), e); toast({ variant: "destructive", - title: "Error setting permissions", + title: t('apiKeysPermissionsErrorUpdate'), description: formatAxiosError(e) }); }); if (actionsRes && actionsRes.status === 200) { toast({ - title: "Permissions updated", - description: "The permissions have been updated." + title: t('apiKeysPermissionsUpdated'), + description: t('apiKeysPermissionsUpdatedDescription') }); } @@ -106,10 +109,10 @@ export default function Page() { - Permissions + {t('apiKeysPermissionsGeneralSettings')} - Determine what this API key can do + {t('apiKeysPermissionsGeneralSettingsDescription')} @@ -126,7 +129,7 @@ export default function Page() { loading={loadingSavePermissions} disabled={loadingSavePermissions} > - Save Permissions + {t('apiKeysPermissionsSave')} diff --git a/src/app/[orgId]/settings/api-keys/create/page.tsx b/src/app/[orgId]/settings/api-keys/create/page.tsx index 3ede2ac0..3d1ddacf 100644 --- a/src/app/[orgId]/settings/api-keys/create/page.tsx +++ b/src/app/[orgId]/settings/api-keys/create/page.tsx @@ -61,15 +61,18 @@ import moment from "moment"; import CopyCodeBox from "@server/emails/templates/components/CopyCodeBox"; import CopyTextBox from "@app/components/CopyTextBox"; import PermissionsSelectBox from "@app/components/PermissionsSelectBox"; +import { useTranslations } from "next-intl"; + +const t = useTranslations(); const createFormSchema = z.object({ name: z .string() .min(2, { - message: "Name must be at least 2 characters." + message: t('apiKeysNameMin') }) .max(255, { - message: "Name must not be longer than 255 characters." + message: t('apiKeysNameMax') }) }); @@ -84,7 +87,7 @@ const copiedFormSchema = z return data.copied; }, { - message: "You must confirm that you have copied the API key.", + message: t('apiKeysConfirmCopy2'), path: ["copied"] } ); @@ -132,7 +135,7 @@ export default function Page() { .catch((e) => { toast({ variant: "destructive", - title: "Error creating API key", + title: t('apiKeysErrorCreate'), description: formatAxiosError(e) }); }); @@ -153,10 +156,10 @@ 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) }); }); @@ -195,8 +198,8 @@ export default function Page() { <>
@@ -216,7 +219,7 @@ export default function Page() { - API Key Information + {t('apiKeysTitle')} @@ -232,7 +235,7 @@ export default function Page() { render={({ field }) => ( - Name + {t('name')} - Permissions + {t('apiKeysGeneralSettings')} - Determine what this API key can do + {t('apiKeysGeneralSettingsDescription')} @@ -275,14 +278,14 @@ export default function Page() { - Your API Key + {t('apiKeysList')} - Name + {t('name')} - Created + {t('created')} {moment( @@ -305,17 +308,15 @@ export default function Page() { - Save Your API Key + {t('apiKeysSave')} - You will only be able to see this - once. Make sure to copy it to a - secure place. + {t('apiKeysSaveDescription')}

- Your API key is: + {t('apiKeysInfo')}

- I have copied - the API key + {t('apiKeysConfirmCopy')}
@@ -378,7 +378,7 @@ export default function Page() { router.push(`/${orgId}/settings/api-keys`); }} > - Cancel + {t('cancel')} )} {!apiKey && ( @@ -390,7 +390,7 @@ export default function Page() { form.handleSubmit(onSubmit)(); }} > - Generate + {t('generate')} )} @@ -401,7 +401,7 @@ export default function Page() { copiedForm.handleSubmit(onCopiedSubmit)(); }} > - Done + {t('done')} )} diff --git a/src/app/[orgId]/settings/api-keys/page.tsx b/src/app/[orgId]/settings/api-keys/page.tsx index ef1e3dd1..4e62617e 100644 --- a/src/app/[orgId]/settings/api-keys/page.tsx +++ b/src/app/[orgId]/settings/api-keys/page.tsx @@ -9,6 +9,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"; type ApiKeyPageProps = { params: Promise<{ orgId: string }>; @@ -18,6 +19,7 @@ export const dynamic = "force-dynamic"; export default async function ApiKeysPage(props: ApiKeyPageProps) { const params = await props.params; + const t = useTranslations(); let apiKeys: ListOrgApiKeysResponse["apiKeys"] = []; try { const res = await internal.get>( @@ -39,8 +41,8 @@ export default async function ApiKeysPage(props: ApiKeyPageProps) { return ( <>