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:
@@ -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 t = useTranslations("ProductDetail");
|
||||||
const tProduct = useTranslations("Product");
|
const tProduct = useTranslations("Product");
|
||||||
const [selectedImage, setSelectedImage] = useState(0);
|
const [selectedImage, setSelectedImage] = useState(0);
|
||||||
@@ -134,12 +134,12 @@ export default function ProductDetail({ product, relatedProducts, locale = "SR"
|
|||||||
|
|
||||||
const shortDescription = localized.description
|
const shortDescription = localized.description
|
||||||
? localized.description.split('.')[0] + '.'
|
? 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(',') || [
|
const benefits = product.metadata?.find(m => m.key === "benefits")?.value?.split(',') || [
|
||||||
locale === "EN" ? "Natural" : "Prirodno",
|
locale === "en" ? "Natural" : "Prirodno",
|
||||||
locale === "EN" ? "Organic" : "Organsko",
|
locale === "en" ? "Organic" : "Organsko",
|
||||||
locale === "EN" ? "Cruelty-free" : "Bez okrutnosti",
|
locale === "en" ? "Cruelty-free" : "Bez okrutnosti",
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -469,7 +469,7 @@ export default function ProductDetail({ product, relatedProducts, locale = "SR"
|
|||||||
</section>
|
</section>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<ProductBenefits locale={locale} />
|
<ProductBenefits key={locale} locale={locale} />
|
||||||
|
|
||||||
<TrustBadges />
|
<TrustBadges />
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user