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

+16 -6
View File
@@ -12,7 +12,15 @@ export default function Footer({ categories = [] }: FooterProps) {
const [supportMenu, setSupportMenu] = useState<MenuItem[]>([])
const [settings, setSettings] = useState<StoreSettings | null>(null)
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',
@@ -25,7 +33,7 @@ export default function Footer({ categories = [] }: FooterProps) {
'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
}
useEffect(() => {
@@ -89,7 +97,7 @@ export default function Footer({ categories = [] }: FooterProps) {
<div className="flex flex-col space-y-2 text-sm text-slate-400">
{exploreMenu.length > 0 ? (
exploreMenu.map(item => (
<Link key={item.id} to={item.url} className="hover:text-white transition-colors">{translateMenuLabel(item.label)}</Link>
<Link key={item.id} to={item.url} className="hover:text-white transition-colors">{translateMenuLabel(item)}</Link>
))
) : (
<>
@@ -116,16 +124,18 @@ export default function Footer({ categories = [] }: FooterProps) {
</div>
<div className="space-y-4">
<h4 className="font-bold uppercase tracking-widest text-xs text-white">{t('footer.support', 'Support & Legal')}</h4>
<h4 className="font-bold uppercase tracking-widest text-xs text-white">
{settings?.footerSupportHeading || t('footer.support', 'Support & Legal')}
</h4>
<div className="flex flex-col space-y-2 text-sm text-slate-400">
{supportMenu.map(item => (
<Link key={item.id} to={item.url} className="hover:text-white transition-colors">{translateMenuLabel(item.label)}</Link>
<Link key={item.id} to={item.url} className="hover:text-white transition-colors">{translateMenuLabel(item)}</Link>
))}
</div>
<div className="pt-4">
<p className="text-[10px] text-slate-600 uppercase tracking-widest">
© {new Date().getFullYear()} HomAroma. {t('footer.rights')}
{settings?.footerCopyrightText || `© ${new Date().getFullYear()} HomAroma. ${t('footer.rights')}`}
</p>
</div>
</div>
+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 },