From 392f31e76936b21c0d6800d1d90462195e56a371 Mon Sep 17 00:00:00 2001 From: Nolann Biron Date: Sat, 28 Mar 2026 16:02:32 +0100 Subject: [PATCH] Localize header link titles --- .../gitbook/src/components/Header/HeaderLink.tsx | 14 ++++++++------ .../src/components/Header/HeaderLinkMore.tsx | 8 +++++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/gitbook/src/components/Header/HeaderLink.tsx b/packages/gitbook/src/components/Header/HeaderLink.tsx index 584533f685..903f7537e6 100644 --- a/packages/gitbook/src/components/Header/HeaderLink.tsx +++ b/packages/gitbook/src/components/Header/HeaderLink.tsx @@ -11,8 +11,8 @@ import assertNever from 'assert-never'; import type React from 'react'; import { resolveContentRef } from '@/lib/references'; +import { getLocalizedTitle } from '@/lib/sites'; import { tcls } from '@/lib/tailwind'; - import { SiteAuthLoginButton, SiteAuthLoginDropdownMenuItem, @@ -35,6 +35,7 @@ export async function HeaderLink(props: { const target = link.to ? await resolveContentRef(link.to, context) : null; const headerPreset = customization.header.preset; const linkStyle = link.style ?? 'link'; + const title = getLocalizedTitle(link, context.locale); if (link.links && link.links.length > 0) { return ( @@ -42,13 +43,13 @@ export async function HeaderLink(props: { className={`shrink ${customization.styling.search === 'prominent' ? 'right-0 left-auto' : null}`} button={ !target || !link.to ? ( - + ) : ( {link.title} + {title} ) : ( - {link.title} + {title} ); } diff --git a/packages/gitbook/src/components/Header/HeaderLinkMore.tsx b/packages/gitbook/src/components/Header/HeaderLinkMore.tsx index 94fea4d512..9c5a4be1c0 100644 --- a/packages/gitbook/src/components/Header/HeaderLinkMore.tsx +++ b/packages/gitbook/src/components/Header/HeaderLinkMore.tsx @@ -10,6 +10,7 @@ import { Icon } from '@gitbook/icons'; import type React from 'react'; import { resolveContentRef } from '@/lib/references'; +import { getLocalizedTitle } from '@/lib/sites'; import { tcls } from '@/lib/tailwind'; import { SocialAccountLink } from '../Footer/SocialAccounts'; @@ -85,6 +86,7 @@ async function MoreMenuLink(props: { }) { const { context, link } = props; + const title = getLocalizedTitle(link, context.locale); const target = link.to ? await resolveContentRef(link.to, context) : null; const sharedProps = { href: target?.href, @@ -100,16 +102,16 @@ async function MoreMenuLink(props: { }; return 'links' in link && link.links.length > 0 ? ( - + {link.links.map((subLink, index) => { return ; })} ) : isSiteAuthLoginHref(context.linker, target?.href) && sharedProps.href ? ( - {link.title} + {title} ) : ( - {link.title} + {title} ); }