Optional-param i18n
This page lives at /i18n/[[lang]] —
the locale is an optional route parameter, so the same page serves both /i18n and /i18n/sv. The breadcrumb resolver
reads page.params.lang to pick a translated
label — no options needed.
Try both languages
Current language: en (param absent — fell back to the default)
Current trail: Svelte Crumbs / Greetings
The breadcrumb export
When the param is absent the crumb still resolves — a [[lang]] segment consumes zero or one URL segments, and the crumb's URL is the concrete pathname either way,
so the trail keeps pointing at the language you are on.
<script module lang="ts">
const labels: Record<string, string> = {
en: 'Greetings',
sv: 'Hälsningar'
};
export const breadcrumb: BreadcrumbMeta = async (page) => ({
label: labels[page.params.lang ?? 'en'] ?? labels.en
});
</script>For locale-prefix apps (Paraglide & friends) see the Internationalized routes docs.