Skip to content

Commit c2eb09b

Browse files
Mlaz-codeclaude
andcommitted
feat(i18n): enable es, pt-BR, de in static export
Flips the multi-locale switch now that translated content and tooling are in place: - next.config.mjs: locales = ['en', 'es', 'pt-BR', 'de'] - app/[lang]/layout.tsx: generateStaticParams emits all 4 locales; Layout receives an i18n prop so the LocaleSwitch (Nextra-built into the Footer and mobile sidebar) renders with translated names. - public/sitemap.xml: regenerated to 212 URLs (53 routes × 4 locales) with hreflang alternates and x-default pointing at the en version. After deploy, /es, /pt-BR, /de routes serve directly. Existing /en URLs are unaffected. Vercel redirects from bare paths still target /en/* as the default-locale fallback. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 9d35b71 commit c2eb09b

3 files changed

Lines changed: 2136 additions & 47 deletions

File tree

app/[lang]/layout.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,21 @@ import 'nextra-theme-docs/style.css'
99
import '../globals.css'
1010

1111
export function generateStaticParams() {
12-
return [{ lang: 'en' }]
12+
return [
13+
{ lang: 'en' },
14+
{ lang: 'es' },
15+
{ lang: 'pt-BR' },
16+
{ lang: 'de' },
17+
]
1318
}
1419

20+
const i18nLocales = [
21+
{ locale: 'en', name: 'English' },
22+
{ locale: 'es', name: 'Español' },
23+
{ locale: 'pt-BR', name: 'Português' },
24+
{ locale: 'de', name: 'Deutsch' },
25+
]
26+
1527
const logo = (
1628
<Link href="https://sharpapi.io" className="sa-logo">
1729
<img src="/logo.svg" alt="SharpAPI" />
@@ -54,6 +66,7 @@ export default async function LangLayout({ children, params }) {
5466
<body suppressHydrationWarning>
5567
<PostHogProvider>
5668
<Layout
69+
i18n={i18nLocales}
5770
pageMap={await getPageMap(`/${lang}`)}
5871
search={<Search />}
5972
sidebar={{ defaultMenuCollapseLevel: 1, toggleButton: true }}

next.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default withNextra({
1010
images: { unoptimized: true },
1111
// Nextra reads i18n config, extracts locales, then removes it (App Router compatible)
1212
i18n: {
13-
locales: ['en'],
13+
locales: ['en', 'es', 'pt-BR', 'de'],
1414
defaultLocale: 'en',
1515
},
1616
});

0 commit comments

Comments
 (0)