We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4b5192b commit 8b3c6a7Copy full SHA for 8b3c6a7
1 file changed
src/lib/components/Flag.svelte
@@ -3,6 +3,7 @@
3
import usFlag from '$lib/assets/us.svg';
4
import { englishLocale, frenchLocale } from '$lib/i18n';
5
import { locale, t } from 'svelte-i18n';
6
+ import { derived } from 'svelte/store';
7
8
function otherLocaleIconUrl(): string {
9
if ($locale === frenchLocale) {
@@ -19,11 +20,13 @@
19
20
$locale = frenchLocale;
21
}
22
23
+
24
+ const localeIcon = derived(locale, otherLocaleIconUrl);
25
</script>
26
27
<button on:click={switchLocale}>
28
<img
29
alt={$t('changer-de-langue')}
- src={otherLocaleIconUrl()}
30
+ src={$localeIcon}
31
class="w-8" />
32
</button>
0 commit comments