Implementiere i18n für Frontend, Admin und Datenbank

This commit is contained in:
Hördle Bot
2025-11-28 15:36:06 +01:00
parent 9df9a808bf
commit 771d0d06f3
37 changed files with 3717 additions and 560 deletions

View File

@@ -2,6 +2,7 @@
import { PrismaClient } from '@prisma/client';
import { requireAdminAuth } from '@/lib/auth';
import { getLocalizedValue } from '@/lib/i18n';
const prisma = new PrismaClient();
@@ -83,7 +84,8 @@ export async function POST(request: Request) {
// Process each song in this batch
for (const song of uncategorizedSongs) {
try {
const genreNames = allGenres.map(g => g.name);
// Use German names for AI categorization (primary language)
const genreNames = allGenres.map(g => getLocalizedValue(g.name, 'de'));
const prompt = `You are a music genre categorization assistant. Given a song title and artist, categorize it into 0-3 of the available genres.
@@ -140,7 +142,7 @@ Your response:`;
// Filter to only valid genres and get their IDs
const genreIds = allGenres
.filter(g => suggestedGenreNames.includes(g.name))
.filter(g => suggestedGenreNames.includes(getLocalizedValue(g.name, 'de')))
.map(g => g.id)
.slice(0, 3); // Max 3 genres
@@ -160,7 +162,7 @@ Your response:`;
title: song.title,
artist: song.artist,
assignedGenres: suggestedGenreNames.filter(name =>
allGenres.some(g => g.name === name)
allGenres.some(g => getLocalizedValue(g.name, 'de') === name)
)
});
}