I18n admin (#22)

* New translation keys in en-US locale

* New translation keys in de-DE locale

* New translation keys in fr-FR locale

* New translation keys in it-IT locale

* New translation keys in pl-PL locale

* New translation keys in pt-PT locale

* New translation keys in tr-TR locale

* Add translation keys in app/admin

* Fix build

---------

Co-authored-by: Lokowitz <marvinlokowitz@gmail.com>
This commit is contained in:
vlalx
2025-05-17 19:04:19 +03:00
committed by GitHub
parent 96bfc3cf36
commit d2d84be99a
27 changed files with 1028 additions and 306 deletions

View File

@@ -74,7 +74,7 @@ export default function ApiKeysTable({ apiKeys }: ApiKeyTableProps) {
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="ghost" className="h-8 w-8 p-0">
<span className="sr-only">Open menu</span>
<span className="sr-only">{t('openMenu')}</span>
<MoreHorizontal className="h-4 w-4" />
</Button>
</DropdownMenuTrigger>
@@ -117,7 +117,7 @@ export default function ApiKeysTable({ apiKeys }: ApiKeyTableProps) {
},
{
accessorKey: "key",
header: "Key",
header: t('key'),
cell: ({ row }) => {
const r = row.original;
return <span className="font-mono">{r.key}</span>;
@@ -125,7 +125,7 @@ export default function ApiKeysTable({ apiKeys }: ApiKeyTableProps) {
},
{
accessorKey: "createdAt",
header: "Created At",
header: t('createdAt'),
cell: ({ row }) => {
const r = row.original;
return <span>{moment(r.createdAt).format("lll")} </span>;

View File

@@ -79,18 +79,18 @@ export default function Page() {
)
})
.catch((e) => {
console.error(t('apiKeysPermissionsErrorUpdate'), e);
console.error("Error setting permissions", e);
toast({
variant: "destructive",
title: t('apiKeysPermissionsErrorUpdate'),
title: "Error setting permissions",
description: formatAxiosError(e)
});
});
if (actionsRes && actionsRes.status === 200) {
toast({
title: t('apiKeysPermissionsUpdated'),
description: t('apiKeysPermissionsUpdatedDescription')
title: "Permissions updated",
description: "The permissions have been updated."
});
}

View File

@@ -56,16 +56,14 @@ 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: t('nameMin', {len: 2})
message: "Name must be at least 2 characters."
})
.max(255, {
message: t('nameMax', {len: 255})
message: "Name must not be longer than 255 characters."
})
});
@@ -80,7 +78,7 @@ const copiedFormSchema = z
return data.copied;
},
{
message: t('apiKeysConfirmCopy2'),
message: "You must confirm that you have copied the API key.",
path: ["copied"]
}
);
@@ -113,6 +111,8 @@ export default function Page() {
}
});
const t = useTranslations();
async function onSubmit(data: CreateFormValues) {
setCreateLoading(true);
@@ -125,7 +125,7 @@ export default function Page() {
.catch((e) => {
toast({
variant: "destructive",
title: t('apiKeysErrorCreate'),
title: "Error creating API key",
description: formatAxiosError(e)
});
});
@@ -146,10 +146,10 @@ export default function Page() {
)
})
.catch((e) => {
console.error(t('apiKeysErrorSetPermission'), e);
console.error("Error setting permissions", e);
toast({
variant: "destructive",
title: t('apiKeysErrorSetPermission'),
title: "Error setting permissions",
description: formatAxiosError(e)
});
});
@@ -191,7 +191,7 @@ export default function Page() {
router.push(`/admin/api-keys`);
}}
>
See All API Keys
{t('apiKeysSeeAll')}
</Button>
</div>