You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
A problem I encountered was changing the locale in SvelteKit and only the component the change happnes in updating its translation,
Describe the solution you'd like
In the SvelteKit docs for this library an extra section showing how to update all translations when changing the locale inside a component.
Additional context
I already found a solution for it and have an Idea for implementing it,
Inside the root layout file you just have to wrap your <slot/> inside a svelte key with the $locale as its value.
Everything inside the key-block will re-render once the locale changed.
It would look like so:
<scrip>
import {locale} from "svelte-i18n";
</script>
{#key $locale}
<slot/>
{/key}
The text was updated successfully, but these errors were encountered:
LuMiSxh
changed the title
Sveltekit: Update transaltion outside of component
Sveltekit: Update translation outside of component
Aug 7, 2023
Fix problem with some translations unchanged on $locale change.
Related: kaisermann/svelte-i18n#224
Author-Change-Id: IB#1141363
Signed-off-by: Pawel Boguslawski <[email protected]>
Is your feature request related to a problem? Please describe.
A problem I encountered was changing the locale in SvelteKit and only the component the change happnes in updating its translation,
Describe the solution you'd like
In the SvelteKit docs for this library an extra section showing how to update all translations when changing the locale inside a component.
Additional context
I already found a solution for it and have an Idea for implementing it,
Inside the root layout file you just have to wrap your
<slot/>
inside a sveltekey
with the$locale
as its value.Everything inside the
key
-block will re-render once the locale changed.It would look like so:
The text was updated successfully, but these errors were encountered: