diff --git a/website/src/lib/components/Menu.svelte b/website/src/lib/components/Menu.svelte index 3fbf809c..48a50455 100644 --- a/website/src/lib/components/Menu.svelte +++ b/website/src/lib/components/Menu.svelte @@ -40,7 +40,7 @@ updateSelectionFromKey } from '$lib/stores'; import { selectAll, selection } from '$lib/components/file-list/Selection'; - import { derived, get } from 'svelte/store'; + import { derived } from 'svelte/store'; import { canUndo, canRedo, dbUtils, fileObservers, settings } from '$lib/db'; import { anySelectedLayer } from '$lib/components/layer-control/utils'; import { defaultOverlays } from '$lib/assets/layers'; diff --git a/website/src/lib/components/toolbar/tools/routing/Routing.ts b/website/src/lib/components/toolbar/tools/routing/Routing.ts index 19a79bd0..268cc492 100644 --- a/website/src/lib/components/toolbar/tools/routing/Routing.ts +++ b/website/src/lib/components/toolbar/tools/routing/Routing.ts @@ -1,8 +1,8 @@ import type { Coordinates } from "gpx"; import { TrackPoint, distance } from "gpx"; -import { get, writable } from "svelte/store"; +import { derived, get, writable } from "svelte/store"; import { settings } from "$lib/db"; -import { _ } from "svelte-i18n"; +import { _, locale } from "svelte-i18n"; import { map } from "$lib/stores"; const { routing, routingProfile, privateRoads } = settings; @@ -20,11 +20,13 @@ export const routingProfileSelectItem = writable({ value: '', label: '' }); -routingProfile.subscribe((value) => { - if (value !== get(routingProfileSelectItem).value) { + +derived([routingProfile, locale], ([profile, l]) => [profile, l]).subscribe(([profile, l]) => { + console.log(profile, l); + if (profile !== get(routingProfileSelectItem).value && l !== null) { routingProfileSelectItem.update((item) => { - item.value = value; - item.label = get(_)(`toolbar.routing.activities.${value}`); + item.value = profile; + item.label = get(_)(`toolbar.routing.activities.${profile}`); return item; }); }