feat: implement i18n for product and category, add 5 new locales

This commit is contained in:
Your Name committed 2026-06-14 00:06:16 -04:00
1 parent 96d874233d
commit 2977df0a9d
8 files changed
+25 -25

No files matched your search

+4 -4
View File
@@ -49,7 +49,7 @@ export default function ProductCard({ product, enableQuickShop = false }: Produc
{/* Image Area */}
<div className="h-48 md:h-64 overflow-hidden rounded-xl relative bg-spa-sage/20">
<img
src={product.images?.[0]?.url || getCategoryImage(product.category.name)}
src={product.images?.[0]?.url || getCategoryImage(typeof product.category.name === 'string' ? product.category.name : (product.category.name as any)?.en || '')}
className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-700"
alt={product.scent.name}
onError={(e) => {
@@ -58,7 +58,7 @@ export default function ProductCard({ product, enableQuickShop = false }: Produc
/>
{/* Category badge */}
<div className="absolute top-3 left-3 bg-white/90 backdrop-blur-sm px-2.5 py-1 rounded-md text-[10px] font-bold uppercase tracking-widest text-spa-forest shadow-sm">
{product.category.name}
{typeof product.category.name === 'string' ? product.category.name : (product.category.name as any)?.[i18n.language] || (product.category.name as any)?.en || ''}
</div>
{/* Wishlist Button */}
<button
@@ -79,7 +79,7 @@ export default function ProductCard({ product, enableQuickShop = false }: Produc
{displayName}
</h3>
<p className="text-[10px] md:text-xs text-spa-stone/60 mt-1 uppercase tracking-widest line-clamp-1 font-semibold">
{product.category.name}
{typeof product.category.name === 'string' ? product.category.name : (product.category.name as any)?.[i18n.language] || (product.category.name as any)?.en || ''}
</p>
</div>
@@ -136,7 +136,7 @@ export default function ProductCard({ product, enableQuickShop = false }: Produc
price: selectedVariant.price || 0,
productName: displayName,
variantSize: selectedVariant.size,
productImage: product.images?.[0]?.url || getCategoryImage(product.category.name)
productImage: product.images?.[0]?.url || getCategoryImage(typeof product.category.name === 'string' ? product.category.name : (product.category.name as any)?.en || '')
});
}}
className="w-full py-2.5 bg-spa-forest text-white hover:bg-spa-forest/90 rounded-xl font-bold text-xs uppercase tracking-widest transition-all shadow-sm hover:shadow flex items-center justify-center gap-1.5 cursor-pointer"