// Root layout — wraps every page. Strategy B (URL-prefix i18n): an INNER // reads the locale FROM THE URL, so `voltro build` pre-renders // each page once per locale (en at the bare path, de under /de) with the right // catalog baked into the static HTML. // // The language switcher is a plain per locale — a real browser navigation // to the other locale's crawlable URL. That is exactly right for a static // content site: the index is `interactive: 'none'` (zero JS) and the post // pages hydrate only their island, so there is no client runtime to swap // catalogs in place; a hard nav to the pre-rendered variant is the whole point. // // ``/``/`` belong to the framework's index.html shell; // render only the in-document chrome here. import type { ReactNode } from 'react' import { I18nProvider, T } from '@voltro/i18n' import { useLocation } from '@voltro/web' import { CATALOGS, DEFAULT_LOCALE, SUPPORTED_LOCALES, stripLocalePrefix, useUrlLocale, withLocalePrefix, } from '../lib/locale' import '../globals.css' function SiteHeader(): ReactNode { const locale = useUrlLocale() // The path WITHOUT its locale prefix, so switching language keeps you on the // same page (e.g. /de/blog/x → /blog/x, then re-prefixed per locale). const barePath = stripLocalePrefix(useLocation()) return (
{{capProjectName}} : {SUPPORTED_LOCALES.map((code) => ( {code.toUpperCase()} ))}
) } export default function Layout({ children }: { readonly children: ReactNode }): ReactNode { const locale = useUrlLocale() return ( {children} ) }