Skip to content

Commit a8e8676

Browse files
authored
Merge pull request #16 from vlalx/i18n_admin_api_keys
i18n in admin/api-keys
2 parents c6ff868 + 8242a66 commit a8e8676

File tree

15 files changed

+76
-58
lines changed

15 files changed

+76
-58
lines changed

messages/de-DE.json

+1
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@
286286
"apiKeysDelete": "API-Schlüssel löschen",
287287
"apiKeysManage": "API-Schlüssel verwalten",
288288
"apiKeysDescription": "API-Schlüssel werden zur Authentifizierung mit der Integrations-API verwendet",
289+
"apiKeysSettings": "{apiKeyName} Einstellungen",
289290
"userTitle": "Alle Benutzer verwalten",
290291
"userDescription": "Alle Benutzer im System anzeigen und verwalten",
291292
"userAbount": "Über Benutzerverwaltung",

messages/en-US.json

+1
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@
286286
"apiKeysDelete": "Delete API Key",
287287
"apiKeysManage": "Manage API Keys",
288288
"apiKeysDescription": "API keys are used to authenticate with the integration API",
289+
"apiKeysSettings": "{apiKeyName} Settings",
289290
"userTitle": "Manage All Users",
290291
"userDescription": "View and manage all users in the system",
291292
"userAbount": "About User Management",

messages/fr-FR.json

+1
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@
286286
"apiKeysDelete": "Supprimer la clé API",
287287
"apiKeysManage": "Gérer les clés API",
288288
"apiKeysDescription": "Les clés API sont utilisées pour s'authentifier avec l'API d'intégration",
289+
"apiKeysSettings": "Paramètres de {apiKeyName}",
289290
"userTitle": "Gérer tous les utilisateurs",
290291
"userDescription": "Voir et gérer tous les utilisateurs du système",
291292
"userAbount": "À propos de la gestion des utilisateurs",

messages/it-IT.json

+1
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@
286286
"apiKeysDelete": "Elimina Chiave API",
287287
"apiKeysManage": "Gestisci Chiavi API",
288288
"apiKeysDescription": "Le chiavi API sono utilizzate per autenticarsi con l'API di integrazione",
289+
"apiKeysSettings": "Impostazioni {apiKeyName}",
289290
"userTitle": "Gestisci Tutti Gli Utenti",
290291
"userDescription": "Visualizza e gestisci tutti gli utenti del sistema",
291292
"userAbount": "Informazioni Sulla Gestione Utente",

messages/pl-PL.json

+1
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@
286286
"apiKeysDelete": "Usuń klucz API",
287287
"apiKeysManage": "Zarządzaj kluczami API",
288288
"apiKeysDescription": "Klucze API służą do uwierzytelniania z API integracji",
289+
"apiKeysSettings": "Ustawienia {apiKeyName}",
289290
"userTitle": "Zarządzaj wszystkimi użytkownikami",
290291
"userDescription": "Zobacz i zarządzaj wszystkimi użytkownikami w systemie",
291292
"userAbount": "O zarządzaniu użytkownikami",

messages/pt-PT.json

+1
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@
286286
"apiKeysDelete": "Excluir Chave API",
287287
"apiKeysManage": "Gerenciar Chaves API",
288288
"apiKeysDescription": "As chaves API são usadas para autenticar com a API de integração",
289+
"apiKeysSettings": "Configurações de {apiKeyName}",
289290
"userTitle": "Gerenciar Todos os Usuários",
290291
"userDescription": "Visualizar e gerenciar todos os usuários no sistema",
291292
"userAbount": "Sobre a Gestão de Usuário",

messages/tr-TR.json

+1
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@
286286
"apiKeysDelete": "Delete API Key",
287287
"apiKeysManage": "Manage API Keys",
288288
"apiKeysDescription": "API keys are used to authenticate with the integration API",
289+
"apiKeysSettings": "{apiKeyName} Settings",
289290
"userTitle": "Manage All Users",
290291
"userDescription": "View and manage all users in the system",
291292
"userAbount": "About User Management",

src/app/[orgId]/settings/api-keys/OrgApiKeysTable.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export default function OrgApiKeysTable({
101101
setIsDeleteModalOpen(true);
102102
}}
103103
>
104-
<span className="text-red-500">Delete</span>
104+
<span className="text-red-500">{t('delete')}</span>
105105
</DropdownMenuItem>
106106
</DropdownMenuContent>
107107
</DropdownMenu>

src/app/[orgId]/settings/api-keys/[apiKeyId]/layout.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default async function SettingsLayout(props: SettingsLayoutProps) {
5555

5656
return (
5757
<>
58-
<SettingsSectionTitle title={`${apiKey?.name} Settings`} />
58+
<SettingsSectionTitle title={t('apiKeysSettings', {apiKeyName: apiKey?.name})} />
5959

6060
<ApiKeyProvider apiKey={apiKey}>
6161
<HorizontalTabs items={navItems}>{children}</HorizontalTabs>

src/app/admin/api-keys/ApiKeysDataTable.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import { Input } from "@app/components/ui/input";
3232
import { DataTablePagination } from "@app/components/DataTablePagination";
3333
import { Plus, Search } from "lucide-react";
3434
import { DataTable } from "@app/components/ui/data-table";
35+
import { useTranslations } from "next-intl";
3536

3637
interface DataTableProps<TData, TValue> {
3738
columns: ColumnDef<TData, TValue>[];
@@ -44,15 +45,17 @@ export function ApiKeysDataTable<TData, TValue>({
4445
columns,
4546
data
4647
}: DataTableProps<TData, TValue>) {
48+
49+
const t = useTranslations();
4750
return (
4851
<DataTable
4952
columns={columns}
5053
data={data}
51-
title="API Keys"
52-
searchPlaceholder="Search API keys..."
54+
title={t('apiKeys')}
55+
searchPlaceholder={t('searchApiKeys')}
5356
searchColumn="name"
5457
onAdd={addApiKey}
55-
addButtonText="Generate API Key"
58+
addButtonText={t('apiKeysAdd')}
5659
/>
5760
);
5861
}

src/app/admin/api-keys/ApiKeysTable.tsx

+15-15
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { createApiClient } from "@app/lib/api";
2424
import { useEnvContext } from "@app/hooks/useEnvContext";
2525
import moment from "moment";
2626
import { ApiKeysDataTable } from "./ApiKeysDataTable";
27+
import { useTranslations } from "next-intl";
2728

2829
export type ApiKeyRow = {
2930
id: string;
@@ -45,14 +46,16 @@ export default function ApiKeysTable({ apiKeys }: ApiKeyTableProps) {
4546

4647
const api = createApiClient(useEnvContext());
4748

49+
const t = useTranslations();
50+
4851
const deleteSite = (apiKeyId: string) => {
4952
api.delete(`/api-key/${apiKeyId}`)
5053
.catch((e) => {
51-
console.error("Error deleting API key", e);
54+
console.error(t('apiKeysErrorDelete'), e);
5255
toast({
5356
variant: "destructive",
54-
title: "Error deleting API key",
55-
description: formatAxiosError(e, "Error deleting API key")
57+
title: t('apiKeysErrorDelete'),
58+
description: formatAxiosError(e, t('apiKeysErrorDeleteMessage'))
5659
});
5760
})
5861
.then(() => {
@@ -86,15 +89,15 @@ export default function ApiKeysTable({ apiKeys }: ApiKeyTableProps) {
8689
setSelected(apiKeyROw);
8790
}}
8891
>
89-
<span>View settings</span>
92+
<span>{t('viewSettings')}</span>
9093
</DropdownMenuItem>
9194
<DropdownMenuItem
9295
onClick={() => {
9396
setSelected(apiKeyROw);
9497
setIsDeleteModalOpen(true);
9598
}}
9699
>
97-
<span className="text-red-500">Delete</span>
100+
<span className="text-red-500">{t('delete')}</span>
98101
</DropdownMenuItem>
99102
</DropdownMenuContent>
100103
</DropdownMenu>
@@ -111,7 +114,7 @@ export default function ApiKeysTable({ apiKeys }: ApiKeyTableProps) {
111114
column.toggleSorting(column.getIsSorted() === "asc")
112115
}
113116
>
114-
Name
117+
{t('name')}
115118
<ArrowUpDown className="ml-2 h-4 w-4" />
116119
</Button>
117120
);
@@ -141,7 +144,7 @@ export default function ApiKeysTable({ apiKeys }: ApiKeyTableProps) {
141144
<div className="flex items-center justify-end">
142145
<Link href={`/admin/api-keys/${r.id}`}>
143146
<Button variant={"outlinePrimary"} className="ml-2">
144-
Edit
147+
{t('edit')}
145148
<ArrowRight className="ml-2 w-4 h-4" />
146149
</Button>
147150
</Link>
@@ -163,27 +166,24 @@ export default function ApiKeysTable({ apiKeys }: ApiKeyTableProps) {
163166
dialog={
164167
<div className="space-y-4">
165168
<p>
166-
Are you sure you want to remove the API key{" "}
167-
<b>{selected?.name || selected?.id}</b>?
169+
{t('apiKeysQuestionRemove', {selectedApiKey: selected?.name || selected?.id})}
168170
</p>
169171

170172
<p>
171173
<b>
172-
Once removed, the API key will no longer be
173-
able to be used.
174+
{t('apiKeysMessageRemove')}
174175
</b>
175176
</p>
176177

177178
<p>
178-
To confirm, please type the name of the API key
179-
below.
179+
{t('apiKeysMessageConfirm')}
180180
</p>
181181
</div>
182182
}
183-
buttonText="Confirm Delete API Key"
183+
buttonText={t('apiKeysDeleteConfirm')}
184184
onConfirm={async () => deleteSite(selected!.id)}
185185
string={selected.name}
186-
title="Delete API Key"
186+
title={t('apiKeysDelete')}
187187
/>
188188
)}
189189

src/app/admin/api-keys/[apiKeyId]/layout.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
import { GetApiKeyResponse } from "@server/routers/apiKeys";
2121
import ApiKeyProvider from "@app/providers/ApiKeyProvider";
2222
import { HorizontalTabs } from "@app/components/HorizontalTabs";
23+
import { useTranslations } from "next-intl";
2324

2425
interface SettingsLayoutProps {
2526
children: React.ReactNode;
@@ -29,6 +30,8 @@ interface SettingsLayoutProps {
2930
export default async function SettingsLayout(props: SettingsLayoutProps) {
3031
const params = await props.params;
3132

33+
const t = useTranslations();
34+
3235
const { children } = props;
3336

3437
let apiKey = null;
@@ -45,14 +48,14 @@ export default async function SettingsLayout(props: SettingsLayoutProps) {
4548

4649
const navItems = [
4750
{
48-
title: "Permissions",
51+
title: t('apiKeysPermissionsTitle'),
4952
href: "/admin/api-keys/{apiKeyId}/permissions"
5053
}
5154
];
5255

5356
return (
5457
<>
55-
<SettingsSectionTitle title={`${apiKey?.name} Settings`} />
58+
<SettingsSectionTitle title={t('apiKeysSettings', {apiKeyName: apiKey?.name})} />
5659

5760
<ApiKeyProvider apiKey={apiKey}>
5861
<HorizontalTabs items={navItems}>{children}</HorizontalTabs>

src/app/admin/api-keys/[apiKeyId]/permissions/page.tsx

+12-9
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@ import { ListApiKeyActionsResponse } from "@server/routers/apiKeys";
2323
import { AxiosResponse } from "axios";
2424
import { useParams } from "next/navigation";
2525
import { useEffect, useState } from "react";
26+
import { useTranslations } from "next-intl";
2627

2728
export default function Page() {
2829
const { env } = useEnvContext();
2930
const api = createApiClient({ env });
3031
const { apiKeyId } = useParams();
3132

33+
const t = useTranslations();
34+
3235
const [loadingPage, setLoadingPage] = useState<boolean>(true);
3336
const [selectedPermissions, setSelectedPermissions] = useState<
3437
Record<string, boolean>
@@ -47,10 +50,10 @@ export default function Page() {
4750
.catch((e) => {
4851
toast({
4952
variant: "destructive",
50-
title: "Error loading API key actions",
53+
title: t('apiKeysPermissionsErrorLoadingActions'),
5154
description: formatAxiosError(
5255
e,
53-
"Error loading API key actions"
56+
t('apiKeysPermissionsErrorLoadingActions')
5457
)
5558
});
5659
});
@@ -81,18 +84,18 @@ export default function Page() {
8184
)
8285
})
8386
.catch((e) => {
84-
console.error("Error setting permissions", e);
87+
console.error(t('apiKeysPermissionsErrorUpdate'), e);
8588
toast({
8689
variant: "destructive",
87-
title: "Error setting permissions",
90+
title: t('apiKeysPermissionsErrorUpdate'),
8891
description: formatAxiosError(e)
8992
});
9093
});
9194

9295
if (actionsRes && actionsRes.status === 200) {
9396
toast({
94-
title: "Permissions updated",
95-
description: "The permissions have been updated."
97+
title: t('apiKeysPermissionsUpdated'),
98+
description: t('apiKeysPermissionsUpdatedDescription')
9699
});
97100
}
98101

@@ -106,10 +109,10 @@ export default function Page() {
106109
<SettingsSection>
107110
<SettingsSectionHeader>
108111
<SettingsSectionTitle>
109-
Permissions
112+
{t('apiKeysPermissionsTitle')}
110113
</SettingsSectionTitle>
111114
<SettingsSectionDescription>
112-
Determine what this API key can do
115+
{t('apiKeysPermissionsGeneralSettingsDescription')}
113116
</SettingsSectionDescription>
114117
</SettingsSectionHeader>
115118
<SettingsSectionBody>
@@ -127,7 +130,7 @@ export default function Page() {
127130
loading={loadingSavePermissions}
128131
disabled={loadingSavePermissions}
129132
>
130-
Save Permissions
133+
{t('apiKeysPermissionsSave')}
131134
</Button>
132135
</SettingsSectionFooter>
133136
</SettingsSectionBody>

0 commit comments

Comments
 (0)