diff --git a/superset-frontend/src/features/home/Menu.tsx b/superset-frontend/src/features/home/Menu.tsx index 06d606cc6a40..9e05b7cfd2dd 100644 --- a/superset-frontend/src/features/home/Menu.tsx +++ b/superset-frontend/src/features/home/Menu.tsx @@ -218,10 +218,10 @@ export function Menu({ const path = location.pathname; switch (true) { case path.startsWith(Paths.Dashboard): - setActiveTabs(['Dashboards']); + setActiveTabs([t('Dashboards')]); break; case path.startsWith(Paths.Chart) || path.startsWith(Paths.Explore): - setActiveTabs(['Charts']); + setActiveTabs([t('Charts')]); break; case path.startsWith(Paths.Datasets): setActiveTabs([datasetsLabel()]); @@ -263,9 +263,10 @@ export function Menu({ const childItems: MenuItem[] = []; childs?.forEach((child: MenuObjectChildProps | string, index1: number) => { - if (typeof child === 'string' && child === '-' && label !== 'Data') { + if (typeof child === 'string' && child === '-' && label !== t('Data')) { childItems.push({ type: 'divider', key: `divider-${index1}` }); } else if (typeof child !== 'string') { + Object.assign(child, { label: t(child.label) }); childItems.push({ key: `${child.label}`, label: child.isFrontendRoute ? ( @@ -366,6 +367,7 @@ export function Menu({ items={menu.map(item => { const props = { ...item, + label: t(item.label), isFrontendRoute: isFrontendRoute(item.url), childs: item.childs?.map(c => { if (typeof c === 'string') { @@ -429,15 +431,16 @@ export default function MenuWrapper({ data, ...rest }: MenuProps) { // Apply any label override for this item (keyed by FAB internal name). ...(item.name && labelOverrides[item.name] ? { label: labelOverrides[item.name]() } - : {}), + : { label: t(item.label) }), }; // Filter childs if (item.childs) { item.childs.forEach((child: MenuObjectChildProps | string) => { if (typeof child === 'string') { - children.push(child); + children.push(t(child)); } else if ((child as MenuObjectChildProps).label) { + Object.assign(child, { label: t(child.label) }); children.push(child); } });