NishuGoel / svelte-i18next

Internationalization for svelte framework. Based on i18next ecosystem
https://npmjs.com/package/svelte-i18next
MIT License
51 stars 11 forks source link

lang in url (with sveltekit) #9

Open Jan-Jan opened 1 year ago

Jan-Jan commented 1 year ago

Hi, thanks for this library!

I'm trying to use it with sveltekit. I have a path like /[lang]/about. Because I want to use i18n on all pages, and initialize it only once, I do so in /[lang]/+layout.svelte. How do I then access the i18n store in /[lang]/about/+page.svelte?

Jan-Jan commented 1 year ago

I found that isLoading doesn't get updated (even though I used it as $isLoading).

Also, I tried moving all the functionality to $lib/i18n.ts or even .svelte, but that definitely doesn't work (with error failed to load module for ssr: /src/lib/i18n).

Jan-Jan commented 1 year ago

FYI: It get language auto-detection to work from url using detection: { order: [path] }, but not if I move it to lib/i18n.ts