refactor(person): one author-name fallback, localized

joinNameOrUnknown()/unknownPersonName() in personFormat.ts replace the
three hand-rolled '[Unbekannt]' literals (geschichte/utils,
GeschichtenCard, personOption) — the fallback is now the i18n key
person_unknown (de/en/es), and formatAuthorDisplayName localizes the
server-side literal on the pass-through path.

Review round 3: Felix, Markus, Leonie (7).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-06-11 08:30:23 +02:00
parent 07725cfa39
commit 836c9594d4
7 changed files with 30 additions and 9 deletions

View File

@@ -3,6 +3,7 @@ import { m } from '$lib/paraglide/messages.js';
import type { components } from '$lib/generated/api';
import { plainExcerpt } from '$lib/shared/utils/extractText';
import { formatDate } from '$lib/shared/utils/date';
import { formatAuthorName } from './utils';
type GeschichteSummary = components['schemas']['GeschichteSummary'];
@@ -24,10 +25,7 @@ function formatPublishedDate(g: GeschichteSummary): string | null {
}
function authorName(g: GeschichteSummary): string {
const a = g.author;
if (!a) return '';
const full = [a.firstName, a.lastName].filter(Boolean).join(' ').trim();
return full || '[Unbekannt]';
return formatAuthorName(g.author);
}
</script>