cibernox / svelte-intl-precompile

I18n library for Svelte.js that analyzes your keys at build time for max performance and minimal footprint
https://svelte-intl-precompile.com
ISC License
274 stars 13 forks source link

Selecting the language manually #11

Closed yaeszlo closed 3 years ago

yaeszlo commented 3 years ago

Hello, thanks for making this library!

Is it possible to implement this with manual language selection? Simple dropdown menu on the navbar with few possible languages to select, usual stuff

Thanks

cibernox commented 3 years ago

Sure. It would be done just the exact same way one would in svelte-i18n, as the API is nearly 100% compatible.

Check this implementation with buttons: https://github.com/cibernox/sveltekit-bug-with-plugin/blob/main/src/routes/index.svelte#L32-L35 Doing the dropdown is up to you, but you just have to set $locale to the new locale and everything will update.