
Description
Describe the problem
I'll just describe my situation: My SvelteKit site is supposed to be localised into multiple (predefined) languages. To archive that I created this SvelteKit route layout: /src/pages/[...locale=locale]/[about=about].svelte
. Implementing the locale
slug was pretty easy thanks to the recent addition of matchers (In this case my matcher only returns true if [ "", "de", "lv" ] includes locale
), but now comes the tricky part: I obviously also want to localise the urls of individual pages, but this isn't possible without knowing the locale
slug.
Describe the proposed solution
match()
could receive a second argument, called params
. params
would be an object with the same layout as event.params
in handle()
.
export function match(param, params) {
return {
"": "about",
"de": "uber",
"lv": "par"
}[params.locale] === param
}
Alternatives considered
Currently it should be possible to create a store to make inheriting possible. While this works it definitely is a workaround.
Importance
nice to have
Additional Information
No response