Closed alexauvray closed 1 year ago
@alexauvray just create folder [lang]
and put your routes inside there. Then initialize the library from the URL parameter.
export async function load({ params, fetch, url }: any) {
const initialLocale= params.lang.substring(0, 2)}
init({
fallbackLocale: "en",
initialLocale,
})
await waitLocale(initialLocale)
}
@cibernox I've another question related to the topic. How can I achieve the following structure:
So all 3 routes would open the main page but in different languages. And wouldn't break internal pages.
Thank you
@thousandsofraccoons You can check how I did it in the documentation page: https://github.com/cibernox/svelte-intl-precompile-docs
tl;dr; Define the route as [...lang]
, so you have a nesting level that can take zero or more arguments.
@thousandsofraccoons thanks for answering the question! I'm closing this now
How to get localised urls like you set on https://svelte-intl-precompile.com/en/docs/introduction ?
In order to have /en/docs and /es/docs.