- Are you sure you want to remove the API key{" "}
- {selected?.name || selected?.id}?
+ {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/admin/api-keys/[apiKeyId]/layout.tsx b/src/app/admin/api-keys/[apiKeyId]/layout.tsx
index be3147ea..3354b435 100644
--- a/src/app/admin/api-keys/[apiKeyId]/layout.tsx
+++ b/src/app/admin/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,14 +48,14 @@ export default async function SettingsLayout(props: SettingsLayoutProps) {
const navItems = [
{
- title: "Permissions",
+ title: t('apiKeysPermissionsTitle'),
href: "/admin/api-keys/{apiKeyId}/permissions"
}
];
return (
<>
-
+ {children}
diff --git a/src/app/admin/api-keys/[apiKeyId]/permissions/page.tsx b/src/app/admin/api-keys/[apiKeyId]/permissions/page.tsx
index c468c139..46d192ec 100644
--- a/src/app/admin/api-keys/[apiKeyId]/permissions/page.tsx
+++ b/src/app/admin/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 { 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('apiKeysPermissionsTitle')}
- Determine what this API key can do
+ {t('apiKeysPermissionsGeneralSettingsDescription')}
@@ -127,7 +130,7 @@ export default function Page() {
loading={loadingSavePermissions}
disabled={loadingSavePermissions}
>
- Save Permissions
+ {t('apiKeysPermissionsSave')}
diff --git a/src/app/admin/api-keys/create/page.tsx b/src/app/admin/api-keys/create/page.tsx
index c76b1859..6bda9d16 100644
--- a/src/app/admin/api-keys/create/page.tsx
+++ b/src/app/admin/api-keys/create/page.tsx
@@ -59,15 +59,18 @@ import CopyToClipboard from "@app/components/CopyToClipboard";
import moment from "moment";
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')
})
});
@@ -82,7 +85,7 @@ const copiedFormSchema = z
return data.copied;
},
{
- message: "You must confirm that you have copied the API key.",
+ message: t('apiKeysConfirmCopy2'),
path: ["copied"]
}
);
@@ -127,7 +130,7 @@ export default function Page() {
.catch((e) => {
toast({
variant: "destructive",
- title: "Error creating API key",
+ title: t('apiKeysErrorCreate'),
description: formatAxiosError(e)
});
});
@@ -148,10 +151,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)
});
});
@@ -184,8 +187,8 @@ export default function Page() {
<>