update lang

This commit is contained in:
Your Name committed 2026-06-14 18:58:45 -04:00
1 parent 46f00c76a4
commit f5b60ff63e
30 files changed
+546 -652

No files matched your search

+12 -4
View File
@@ -45,7 +45,15 @@ export default function Navbar({ categories = [], topOffsetClassName = 'top-0' }
setLangSheetOpen(false)
}
const translateMenuLabel = (label: string) => {
const translateMenuLabel = (item: MenuItem) => {
const lang = localStorage.getItem('homaroma_lang') || 'en'
if (lang !== 'en' && item.translations && item.translations.length > 0) {
const trans = item.translations.find((t: any) => t.langCode === lang)
if (trans && trans.label) {
return trans.label
}
}
const map: Record<string, string> = {
'Home': 'nav.home',
'Shop': 'nav.shop',
@@ -57,7 +65,7 @@ export default function Navbar({ categories = [], topOffsetClassName = 'top-0' }
'Track Order': 'nav.trackOrder',
'Delivery & Returns': 'nav.delivery'
}
return map[label] ? t(map[label]) : label
return map[item.label] ? t(map[item.label]) : item.label
}
// Detect scroll and announcement bar presence
useEffect(() => {
@@ -145,7 +153,7 @@ export default function Navbar({ categories = [], topOffsetClassName = 'top-0' }
{menuItems.length > 0 ? (
menuItems.map(item => (
<NavLink key={item.id} to={item.url} end={item.url === '/'} className={navLinkClass}>
{translateMenuLabel(item.label)}
{translateMenuLabel(item)}
</NavLink>
))
) : (
@@ -433,7 +441,7 @@ export default function Navbar({ categories = [], topOffsetClassName = 'top-0' }
{/* Drawer Nav Links */}
<div className="flex-1 overflow-y-auto px-4 py-6 space-y-1">
{(menuItems.length > 0 ? [
...menuItems.map(item => ({ to: item.url, label: translateMenuLabel(item.label), end: item.url === '/' })),
...menuItems.map(item => ({ to: item.url, label: translateMenuLabel(item), end: item.url === '/' })),
...(customer ? [{ to: '/profile', label: `👤 ${t('nav.profile') || 'My Profile'}` }] : []),
] : [
{ to: '/', label: t('nav.home'), end: true },