From e712faf7b7eb3fc4a8cf1265d60939b350596366 Mon Sep 17 00:00:00 2001 From: Till JS Date: Mon, 27 Apr 2026 14:01:58 +0200 Subject: [PATCH] =?UTF-8?q?i18n(api-keys):=20translate=20ListView=20via=20?= =?UTF-8?q?$=5F()=20=E2=80=94=20workbench=20module=20mirrors=20page=20stri?= =?UTF-8?q?ngs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds 2 keys (label_rate_unit_short, action_revoking_short) to the existing api-keys.page namespace and routes the workbench-embedded ListView through them: - Header "+ API Key" button → page.action_create - Active Keys section header + empty state → existing keys - Key card metadata: rate-per-min chip, "Created: {date}", revoke button (with revoking state) - Revoked section header + "Revoked: {date}" line - "How to Use" section + STT/TTS labels - Modal: "API Key Created" success state + warning + Copied! toast + Done button - Modal: Create form (Key Name + placeholder, Scopes, Rate Limit + req/min unit) + Cancel/Create/Creating - Backdrop close-modal aria-label - err_pick_scope error fallback - Date formatter: 'de-DE' → get(locale) ?? 'de' Baselines: hardcoded 1130 → 1119 (11 cleared); missing-keys baseline unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../web/src/lib/i18n/locales/api-keys/de.json | 4 +- .../web/src/lib/i18n/locales/api-keys/en.json | 4 +- .../web/src/lib/i18n/locales/api-keys/es.json | 4 +- .../web/src/lib/i18n/locales/api-keys/fr.json | 4 +- .../web/src/lib/i18n/locales/api-keys/it.json | 4 +- .../src/lib/modules/api-keys/ListView.svelte | 81 ++++++++++++------- scripts/i18n-hardcoded-baseline.json | 3 +- 7 files changed, 70 insertions(+), 34 deletions(-) diff --git a/apps/mana/apps/web/src/lib/i18n/locales/api-keys/de.json b/apps/mana/apps/web/src/lib/i18n/locales/api-keys/de.json index 90980e26c..98116f48e 100644 --- a/apps/mana/apps/web/src/lib/i18n/locales/api-keys/de.json +++ b/apps/mana/apps/web/src/lib/i18n/locales/api-keys/de.json @@ -42,6 +42,8 @@ "action_cancel": "Abbrechen", "action_creating": "Erstelle…", "action_create_key": "Key erstellen", - "action_close_modal": "Modal schließen" + "action_close_modal": "Modal schließen", + "label_rate_unit_short": "Anf./Min.", + "action_revoking_short": "..." } } diff --git a/apps/mana/apps/web/src/lib/i18n/locales/api-keys/en.json b/apps/mana/apps/web/src/lib/i18n/locales/api-keys/en.json index 1faf1f703..d8bb5af05 100644 --- a/apps/mana/apps/web/src/lib/i18n/locales/api-keys/en.json +++ b/apps/mana/apps/web/src/lib/i18n/locales/api-keys/en.json @@ -42,6 +42,8 @@ "action_cancel": "Cancel", "action_creating": "Creating…", "action_create_key": "Create Key", - "action_close_modal": "Close modal" + "action_close_modal": "Close modal", + "label_rate_unit_short": "req/min", + "action_revoking_short": "..." } } diff --git a/apps/mana/apps/web/src/lib/i18n/locales/api-keys/es.json b/apps/mana/apps/web/src/lib/i18n/locales/api-keys/es.json index 6d01f39ba..7bd96fd02 100644 --- a/apps/mana/apps/web/src/lib/i18n/locales/api-keys/es.json +++ b/apps/mana/apps/web/src/lib/i18n/locales/api-keys/es.json @@ -42,6 +42,8 @@ "action_cancel": "Cancelar", "action_creating": "Creando…", "action_create_key": "Crear key", - "action_close_modal": "Cerrar modal" + "action_close_modal": "Cerrar modal", + "label_rate_unit_short": "req/min", + "action_revoking_short": "..." } } diff --git a/apps/mana/apps/web/src/lib/i18n/locales/api-keys/fr.json b/apps/mana/apps/web/src/lib/i18n/locales/api-keys/fr.json index b96b15975..6e0d7d043 100644 --- a/apps/mana/apps/web/src/lib/i18n/locales/api-keys/fr.json +++ b/apps/mana/apps/web/src/lib/i18n/locales/api-keys/fr.json @@ -42,6 +42,8 @@ "action_cancel": "Annuler", "action_creating": "Création…", "action_create_key": "Créer la key", - "action_close_modal": "Fermer la modale" + "action_close_modal": "Fermer la modale", + "label_rate_unit_short": "req/min", + "action_revoking_short": "..." } } diff --git a/apps/mana/apps/web/src/lib/i18n/locales/api-keys/it.json b/apps/mana/apps/web/src/lib/i18n/locales/api-keys/it.json index 24e9d01f7..7f82b24c5 100644 --- a/apps/mana/apps/web/src/lib/i18n/locales/api-keys/it.json +++ b/apps/mana/apps/web/src/lib/i18n/locales/api-keys/it.json @@ -42,6 +42,8 @@ "action_cancel": "Annulla", "action_creating": "Creazione…", "action_create_key": "Crea key", - "action_close_modal": "Chiudi modale" + "action_close_modal": "Chiudi modale", + "label_rate_unit_short": "req/min", + "action_revoking_short": "..." } } diff --git a/apps/mana/apps/web/src/lib/modules/api-keys/ListView.svelte b/apps/mana/apps/web/src/lib/modules/api-keys/ListView.svelte index f9b989730..ab081ddba 100644 --- a/apps/mana/apps/web/src/lib/modules/api-keys/ListView.svelte +++ b/apps/mana/apps/web/src/lib/modules/api-keys/ListView.svelte @@ -7,6 +7,9 @@ import { Button, Input, Card, Badge } from '@mana/shared-ui'; import { Check, Copy, Info, Key, Plus, Prohibit } from '@mana/shared-icons'; import { apiKeysService, type ApiKey, type ApiKeyWithSecret } from '$lib/api/api-keys'; + import { _ } from 'svelte-i18n'; + import { get } from 'svelte/store'; + import { locale } from 'svelte-i18n'; let loading = $state(true); let apiKeys = $state([]); @@ -47,7 +50,7 @@ if (newKeyScopes.stt) scopes.push('stt'); if (newKeyScopes.tts) scopes.push('tts'); if (scopes.length === 0) { - error = 'Please select at least one scope'; + error = $_('api-keys.page.err_pick_scope'); return; } creating = true; @@ -96,8 +99,9 @@ } function formatDate(dateString: string | null): string { - if (!dateString) return 'Never'; - return new Date(dateString).toLocaleDateString('de-DE', { + if (!dateString) return $_('api-keys.page.never'); + const lang = get(locale) ?? 'de'; + return new Date(dateString).toLocaleDateString(lang, { year: 'numeric', month: 'short', day: 'numeric', @@ -110,7 +114,8 @@
@@ -127,14 +132,14 @@
- Active Keys + {$_('api-keys.page.section_active_title')} {activeKeys.length}
{#if activeKeys.length === 0}
-

No API keys yet

+

{$_('api-keys.page.empty_title')}

{:else}
@@ -144,11 +149,19 @@
{key.name} {key.scopes.join(', ')} - {key.rateLimitRequests}/min + {$_('api-keys.page.rate_per_min', { + values: { rate: key.rateLimitRequests }, + })}
{key.keyPrefix} - Created: {formatDate(key.createdAt)} + {$_('api-keys.page.label_created', { + values: { date: formatDate(key.createdAt) }, + })}
{/each} @@ -169,7 +184,7 @@
- Revoked + {$_('api-keys.page.section_revoked_title')} {revokedKeys.length}
@@ -179,7 +194,11 @@ {key.name}
{key.keyPrefix} - Revoked: {formatDate(key.revokedAt)} + {$_('api-keys.page.label_revoked_at', { + values: { date: formatDate(key.revokedAt) }, + })}
@@ -192,10 +211,10 @@
- How to Use + {$_('api-keys.page.section_howto_title')}
-

Speech-to-Text (STT)

+

{$_('api-keys.page.label_stt')}

curl -X POST https://gpu-stt.mana.how/transcribe \
   -H "X-API-Key: sk_live_..." \
@@ -203,7 +222,7 @@
 					>
-

Text-to-Speech (TTS)

+

{$_('api-keys.page.label_tts')}

curl -X POST https://tts-api.mana.how/synthesize/kokoro \
   -H "X-API-Key: sk_live_..." \
@@ -219,33 +238,39 @@
 
 {#if showCreateModal}