Add missing auth translations and update components to use i18n keys

- Added new translation keys to de/auth.js:
  - resetPassword section (title, button, success, invalidToken, error, emailSent, emailError)
  - errors section (fillAllFields, invalidEmail, passwordsNotMatch, passwordsNotMatchShort, enterEmail, loginFailed, registerFailed, googleLoginFailed, emailExists)
  - success section (registerComplete)
  - newPassword, backToHome keys

- Updated ResetPassword.js to use translation keys instead of hardcoded German strings
- Updated LoginComponent.js to use translation keys instead of hardcoded German strings
- translate-i18n.js generated translations for other languages
This commit is contained in:
sebseb7
2025-12-01 13:02:03 +01:00
parent 013a38ca98
commit 3347ba2754
24 changed files with 607 additions and 57 deletions

View File

@@ -30,28 +30,28 @@ const ResetPassword = () => {
const tokenFromUrl = urlParams.get('token');
if (!tokenFromUrl) {
setError('Kein gültiger Token gefunden. Bitte verwenden Sie den Link aus Ihrer E-Mail.');
setError(t('auth.resetPassword.invalidToken'));
} else {
setToken(tokenFromUrl);
}
}, [location]);
}, [location, t]);
const handleSubmit = (e) => {
e.preventDefault();
// Validation
if (!newPassword || !confirmPassword) {
setError('Bitte füllen Sie alle Felder aus');
setError(t('auth.errors.fillAllFields'));
return;
}
if (newPassword.length < 8) {
setError('Das Passwort muss mindestens 8 Zeichen lang sein');
setError(t('auth.passwordMinLength'));
return;
}
if (newPassword !== confirmPassword) {
setError('Die Passwörter stimmen nicht überein');
setError(t('auth.errors.passwordsNotMatch'));
return;
}
@@ -76,7 +76,7 @@ const ResetPassword = () => {
}
}, 3000);
} else {
setError(response.message || 'Fehler beim Zurücksetzen des Passworts');
setError(response.message || t('auth.resetPassword.error'));
}
});
};
@@ -87,7 +87,7 @@ const ResetPassword = () => {
<Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
<LockResetIcon sx={{ fontSize: 48, color: 'primary.main', mb: 2 }} />
<Typography component="h1" variant="h5" gutterBottom>
Passwort zurücksetzen
{t('auth.resetPassword.title')}
</Typography>
{!token ? (
@@ -97,7 +97,7 @@ const ResetPassword = () => {
) : success ? (
<Box sx={{ width: '100%', mt: 2 }}>
<Alert severity="success" sx={{ mb: 2 }}>
Ihr Passwort wurde erfolgreich zurückgesetzt! Sie werden in Kürze zur Anmeldung weitergeleitet...
{t('auth.resetPassword.success')}
</Alert>
<Box sx={{ display: 'flex', justifyContent: 'center' }}>
<CircularProgress size={24} />
@@ -116,7 +116,7 @@ const ResetPassword = () => {
required
fullWidth
name="newPassword"
label="Neues Passwort"
label={t('auth.newPassword')}
type="password"
id="newPassword"
autoComplete="new-password"
@@ -130,7 +130,7 @@ const ResetPassword = () => {
required
fullWidth
name="confirmPassword"
label={t ? t('auth.confirmPassword') : 'Passwort bestätigen'}
label={t('auth.confirmPassword')}
type="password"
id="confirmPassword"
autoComplete="new-password"
@@ -154,7 +154,7 @@ const ResetPassword = () => {
{loading ? (
<CircularProgress size={24} color="inherit" />
) : (
'Passwort zurücksetzen'
t('auth.resetPassword.button')
)}
</Button>
@@ -164,7 +164,7 @@ const ResetPassword = () => {
onClick={() => navigate('/')}
sx={{ color: '#2e7d32' }}
>
Zurück zur Startseite
{t('auth.backToHome')}
</Button>
</Box>
</Box>