🌐 feat(i18n): make all auth pages multilingual

Add dynamic locale support to all login, register, and forgot-password
pages across apps. Pages now use $locale from svelte-i18n instead of
hardcoded language codes.

Apps updated:
- clock: login (also consolidated to standard pattern)
- manacore: register
- manadeck: register
- nutriphi: login, register, forgot-password
- picture: register, forgot-password
- planta: login
- questions: login, register, forgot-password
- skilltree: login, register, forgot-password

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Till-JS 2026-02-01 12:54:52 +01:00
parent fdaf6a9c75
commit ff22a29723
15 changed files with 99 additions and 44 deletions

View file

@ -2,13 +2,13 @@
import { goto } from '$app/navigation';
import { page } from '$app/stores';
import { browser } from '$app/environment';
import { locale } from 'svelte-i18n';
import { LoginPage } from '@manacore/shared-auth-ui';
import { getLoginTranslations } from '@manacore/shared-i18n';
import { ClockLogo } from '@manacore/shared-branding';
import { authStore } from '$lib/stores/auth.svelte';
import '$lib/i18n';
let error = $state('');
let loading = $state(false);
// Read verification status from query params (set after email verification)
const verified = $derived($page.url.searchParams.get('verified') === 'true');
const initialEmail = $derived($page.url.searchParams.get('email') || '');
@ -31,30 +31,37 @@
return '/';
});
async function handleLogin(email: string, password: string) {
loading = true;
error = '';
// Get translations based on current locale
const translations = $derived(getLoginTranslations($locale || 'de'));
const result = await authStore.signIn(email, password);
async function handleSignIn(email: string, password: string) {
return authStore.signIn(email, password);
}
if (result.success) {
goto(redirectTo);
} else {
error = result.error || 'Anmeldung fehlgeschlagen';
}
loading = false;
async function handleResendVerification(email: string) {
return authStore.resendVerificationEmail(email);
}
</script>
<svelte:head>
<title>{translations.title} | Clock</title>
</svelte:head>
<LoginPage
appName="Clock"
appLogo=""
{loading}
{error}
onSubmit={handleLogin}
registerHref="/register"
forgotPasswordHref="/forgot-password"
logo={ClockLogo}
primaryColor="#f59e0b"
onSignIn={handleSignIn}
onResendVerification={handleResendVerification}
{goto}
enableGoogle={false}
enableApple={false}
successRedirect={redirectTo}
registerPath="/register"
forgotPasswordPath="/forgot-password"
lightBackground="#fffbeb"
darkBackground="#1c1917"
{translations}
{verified}
{initialEmail}
/>