added translation to account page
This commit is contained in:
@@ -1,23 +1,33 @@
|
||||
{
|
||||
"account": "Account",
|
||||
"account": "Konto",
|
||||
"accountDeleted": "Konto erfolgreich gelöscht!",
|
||||
"address": "Adresse",
|
||||
"addToCart": "In den Warenkorb",
|
||||
"addedToCart": "Produkt wurde erfolgreich dem Warenkorb hinzugefügt",
|
||||
"almostSoldOut": "Fast ausverkauft",
|
||||
"available": "Stück verfügbar",
|
||||
"cancel": "Abbrechen",
|
||||
"categories": "Kategorien",
|
||||
"checkout": "Zur Kasse",
|
||||
"close": "Schließen",
|
||||
"contact": "Kontakt",
|
||||
"currentAccount": "Account des aktuellen Benutzers",
|
||||
"currentAccount": "Konto des aktuellen Benutzers",
|
||||
"deleteAccount": "Konto löschen",
|
||||
"edit": "Bearbeiten",
|
||||
"email": "E-Mail",
|
||||
"freeShipping": "Kostenloser Versand ab 50 € Bestellwert",
|
||||
"inStock": "Verfügbar",
|
||||
"logout": "Ausloggen",
|
||||
"myAccount": "Mein Konto",
|
||||
"name": "Name",
|
||||
"orders": "Bestellungen",
|
||||
"outOfStock": "Ausverkauft",
|
||||
"phone": "Telefon",
|
||||
"quantity": "Anzahl",
|
||||
"rateThisProduct": "Dieses Produkt bewerten",
|
||||
"ratingFrom": "Bewertung vom",
|
||||
"review": "Produktrezension (optional)",
|
||||
"save": "Speichern",
|
||||
"search": "Suchen",
|
||||
"submit": "Senden"
|
||||
}
|
||||
|
||||
@@ -1,23 +1,33 @@
|
||||
{
|
||||
"account": "Account",
|
||||
"accountDeleted": "Account deleted successfully!",
|
||||
"address": "Address",
|
||||
"addToCart": "Add to cart",
|
||||
"addedToCart": "Product added to shopping cart successfully",
|
||||
"almostSoldOut": "Almost sold out",
|
||||
"available": "items available",
|
||||
"cancel": "Cancel",
|
||||
"categories": "Categories",
|
||||
"checkout": "Checkout",
|
||||
"close": "Close",
|
||||
"contact": "Contact",
|
||||
"currentAccount": "Account of current user",
|
||||
"deleteAccount": "Delete Account",
|
||||
"edit": "Edit",
|
||||
"email": "Email",
|
||||
"freeShipping": "Free shipping for orders over 50 €",
|
||||
"inStock": "In stock",
|
||||
"logout": "Logout",
|
||||
"myAccount": "My Account",
|
||||
"name": "Name",
|
||||
"orders": "Orders",
|
||||
"outOfStock": "Out of stock",
|
||||
"phone": "Phone number",
|
||||
"quantity": "Quantity",
|
||||
"rateThisProduct": "Rate this product",
|
||||
"ratingFrom": "Rating from",
|
||||
"review": "Product review (optional)",
|
||||
"save": "Save",
|
||||
"search": "Search",
|
||||
"submit": "Submit"
|
||||
}
|
||||
|
||||
@@ -2,8 +2,11 @@ import { Box, Typography, Button, TextField, Paper, Divider, Stack } from "@mui/
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import "./pages.css";
|
||||
import { useState } from "react";
|
||||
import {useTranslation} from "react-i18next";
|
||||
|
||||
export default function Account() {
|
||||
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
|
||||
// Beispielhafte Userdaten (könnten aus Context/Backend kommen)
|
||||
@@ -31,7 +34,7 @@ export default function Account() {
|
||||
};
|
||||
const handleDelete = () => {
|
||||
// Hier ggf. Dialog oder API-Call zum Löschen
|
||||
alert("Konto gelöscht!");
|
||||
alert(t('accountDeleted'));
|
||||
navigate("/");
|
||||
};
|
||||
|
||||
@@ -39,12 +42,12 @@ export default function Account() {
|
||||
<Box className="page-background" sx={{ minHeight: "100vh", justifyContent: "flex-start", pt: 4 }}>
|
||||
<Paper elevation={3} sx={{ p: 4, maxWidth: 500, width: "100%", mx: "auto" }}>
|
||||
<Typography variant="h4" gutterBottom>
|
||||
Mein Konto
|
||||
{t('myAccount')}
|
||||
</Typography>
|
||||
<Divider sx={{ mb: 3 }} />
|
||||
<Stack spacing={2}>
|
||||
<TextField
|
||||
label="Name"
|
||||
label={t('name')}
|
||||
name="name"
|
||||
value={edit ? form.name : user.name}
|
||||
onChange={handleChange}
|
||||
@@ -52,7 +55,7 @@ export default function Account() {
|
||||
fullWidth
|
||||
/>
|
||||
<TextField
|
||||
label="E-Mail"
|
||||
label={t('email')}
|
||||
name="email"
|
||||
value={edit ? form.email : user.email}
|
||||
onChange={handleChange}
|
||||
@@ -60,7 +63,7 @@ export default function Account() {
|
||||
fullWidth
|
||||
/>
|
||||
<TextField
|
||||
label="Telefon"
|
||||
label={t('phone')}
|
||||
name="phone"
|
||||
value={edit ? form.phone : user.phone}
|
||||
onChange={handleChange}
|
||||
@@ -68,7 +71,7 @@ export default function Account() {
|
||||
fullWidth
|
||||
/>
|
||||
<TextField
|
||||
label="Adresse"
|
||||
label={t('address')}
|
||||
name="address"
|
||||
value={edit ? form.address : user.address}
|
||||
onChange={handleChange}
|
||||
@@ -80,15 +83,15 @@ export default function Account() {
|
||||
{edit ? (
|
||||
<>
|
||||
<Button variant="contained" color="primary" onClick={handleSave}>
|
||||
Speichern
|
||||
{t('save')}
|
||||
</Button>
|
||||
<Button variant="outlined" color="secondary" onClick={handleCancel}>
|
||||
Abbrechen
|
||||
{t('cancel')}
|
||||
</Button>
|
||||
</>
|
||||
) : (
|
||||
<Button variant="contained" color="primary" onClick={handleEdit}>
|
||||
Bearbeiten
|
||||
{t('edit')}
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
@@ -97,7 +100,7 @@ export default function Account() {
|
||||
onClick={handleDelete}
|
||||
sx={{ marginLeft: "auto" }}
|
||||
>
|
||||
Konto löschen
|
||||
{t('deleteAccount')}
|
||||
</Button>
|
||||
</Box>
|
||||
</Paper>
|
||||
|
||||
Reference in New Issue
Block a user