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

@@ -1,5 +1,6 @@
'use client';
import { useTranslations } from 'next-intl';
import { Statistics as StatsType } from '../lib/gameState';
interface StatisticsProps {
@@ -18,6 +19,7 @@ const BADGES = {
};
export default function Statistics({ statistics }: StatisticsProps) {
const t = useTranslations('Statistics');
const total =
statistics.solvedIn1 +
statistics.solvedIn2 +
@@ -36,19 +38,19 @@ export default function Statistics({ statistics }: StatisticsProps) {
{ attempts: 5, count: statistics.solvedIn5, badge: BADGES[5] },
{ attempts: 6, count: statistics.solvedIn6, badge: BADGES[6] },
{ attempts: 7, count: statistics.solvedIn7, badge: BADGES[7] },
{ attempts: 'Failed', count: statistics.failed, badge: BADGES.failed },
{ attempts: t('failed'), count: statistics.failed, badge: BADGES.failed },
];
return (
<div className="statistics-container">
<h3 className="statistics-title">Your Statistics</h3>
<p className="statistics-total">Total puzzles: {total}</p>
<h3 className="statistics-title">{t('yourStatistics')}</h3>
<p className="statistics-total">{t('totalPuzzles')}: {total}</p>
<div className="statistics-grid">
{stats.map((stat, index) => (
<div key={index} className="stat-item">
<div className="stat-badge">{stat.badge}</div>
<div className="stat-label">
{typeof stat.attempts === 'number' ? `${stat.attempts} try` : stat.attempts}
{typeof stat.attempts === 'number' ? `${stat.attempts} ${t('try')}` : stat.attempts}
</div>
<div className="stat-count">{stat.count}</div>
</div>