sveltekit-i18n / lib

Internationalization library built for SvelteKit.
MIT License
491 stars 32 forks source link

how to load translation for all routes? #110

Closed Trackhe closed 1 year ago

Trackhe commented 1 year ago

Hey, i don't want to create for every route a new file and loader

this should be possible to be enough

export const config = {
    translations: {
        en: { lang }
    },
    loaders: [
        {
            locale: "en",
            loader: async () => (
                await import("../translations/en.json")
            ).default,
        }
    ]
}

but i need this to load the translation

export const config = {
    translations: {
        en: { lang }
    },
    loaders: [
        {
            locale: "en",
            key: 'common',
            routes: ['/register'],
            loader: async () => (
                await import("../translations/en.json")
            ).default,
        }
    ]
}

which i don't want.

Is there any reason why the first example is not working for me and why is this then in the examples present? In the best case i don't need a key and ignore the route.