fix: ProductDetail using wrong locale comparisons

- Default locale was "SR" instead of "sr"
- Comparisons used "EN" instead of "en" for shortDescription and benefits
- These hardcoded English strings were being skipped due to wrong comparison
This commit is contained in:
Unchained
2026-03-24 11:46:05 +02:00
parent 74ab98ad2f
commit 0a7c555549

View File

@@ -86,7 +86,7 @@ function StarRating({ rating = 5, count = 0 }: { rating?: number; count?: number
);
}
export default function ProductDetail({ product, relatedProducts, locale = "SR" }: ProductDetailProps) {
export default function ProductDetail({ product, relatedProducts, locale = "sr" }: ProductDetailProps) {
const t = useTranslations("ProductDetail");
const tProduct = useTranslations("Product");
const [selectedImage, setSelectedImage] = useState(0);
@@ -134,12 +134,12 @@ export default function ProductDetail({ product, relatedProducts, locale = "SR"
const shortDescription = localized.description
? localized.description.split('.')[0] + '.'
: locale === "EN" ? "Premium natural oil for your beauty routine." : "Premium prirodno ulje za vašu rutinu lepote.";
: locale === "en" ? "Premium natural oil for your beauty routine." : "Premium prirodno ulje za vašu rutinu lepote.";
const benefits = product.metadata?.find(m => m.key === "benefits")?.value?.split(',') || [
locale === "EN" ? "Natural" : "Prirodno",
locale === "EN" ? "Organic" : "Organsko",
locale === "EN" ? "Cruelty-free" : "Bez okrutnosti",
locale === "en" ? "Natural" : "Prirodno",
locale === "en" ? "Organic" : "Organsko",
locale === "en" ? "Cruelty-free" : "Bez okrutnosti",
];
return (
@@ -469,7 +469,7 @@ export default function ProductDetail({ product, relatedProducts, locale = "SR"
</section>
)}
<ProductBenefits locale={locale} />
<ProductBenefits key={locale} locale={locale} />
<TrustBadges />