From 419554748f3f99e29313df0abca149c04048cfb5 Mon Sep 17 00:00:00 2001 From: Laura Dolibois Date: Sun, 25 May 2025 13:55:56 +0200 Subject: [PATCH] added translation for product page --- 01-frontend/public/locales/de/translation.json | 2 ++ 01-frontend/public/locales/en/translation.json | 2 ++ 01-frontend/src/pages/Product.tsx | 9 ++++++--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/01-frontend/public/locales/de/translation.json b/01-frontend/public/locales/de/translation.json index 692c9d2..f338b34 100644 --- a/01-frontend/public/locales/de/translation.json +++ b/01-frontend/public/locales/de/translation.json @@ -25,6 +25,8 @@ "outOfStock": "Ausverkauft", "pageDoesNotExist": "Ups! Diese Seite existiert nicht.", "phone": "Telefon", + "productDoesNotExist": "Dieses Produkt existiert nicht oder wurde bereits gelöscht.", + "productNotFound": "Produkt nicht gefunden!", "quantity": "Anzahl", "rateThisProduct": "Dieses Produkt bewerten", "ratingFrom": "Bewertung vom", diff --git a/01-frontend/public/locales/en/translation.json b/01-frontend/public/locales/en/translation.json index 0d54519..a30203e 100644 --- a/01-frontend/public/locales/en/translation.json +++ b/01-frontend/public/locales/en/translation.json @@ -25,6 +25,8 @@ "outOfStock": "Out of stock", "pageDoesNotExist": "Oops! The page you're looking for doesn't exist.", "phone": "Phone number", + "productDoesNotExist": "It seems you are locking for a product that doesn't exist or has been removed.", + "productNotFound": "Product not found!", "quantity": "Quantity", "rateThisProduct": "Rate this product", "ratingFrom": "Rating from", diff --git a/01-frontend/src/pages/Product.tsx b/01-frontend/src/pages/Product.tsx index 535ba9f..9385df7 100644 --- a/01-frontend/src/pages/Product.tsx +++ b/01-frontend/src/pages/Product.tsx @@ -9,9 +9,12 @@ import { useLocation, useNavigate } from 'react-router-dom'; import Item from '../components/Item'; import ProductInfo from '../helper/productpage/ProductInfo'; import Ratings from '../helper/productpage/Ratings'; +import {useTranslation} from "react-i18next"; export default function Product() { + + const { t } = useTranslation(); const location = useLocation(); const item = location.state?.item as Item; const navigate = useNavigate(); @@ -25,10 +28,10 @@ export default function Product() { return ( - Product not found + {t('productNotFound')} - It seems you are locking for a product that doesn't exist or has been removed. + {t('productDoesNotExist')} );