Replies: 1 comment
-
This is really just setting a layout property on the map, and that layout property would be specific to how things are set up in the style data. There are also a ton of different layout properties that could potentially be set, each unique to the particular style definition. For these reasons I hesitate to add this to the library itself. But you could implement it with something like this. (Haven't tested this but it should work I think) <script lang="ts">
//LanguagePicker.svelte
import { mapContext } from 'svelte-maplibre';
const { map } = mapContext();
export let lang = 'en';
$: $map?.setLayoutProperty('label_country', 'text-field', [
'get', `name:${lang}`
]);
</script>
<select bind:value={selectedLanguage}>
<option value="en">English</option>
<option value="de">German</option>
</select> <script lang="ts">
import { MapLibre, Control, ControlGroup } from 'svelte-maplibre'
import LanguagePicker from './LanguagePicker.svelte';
</script>
<MapLibre style="...">
<Control>
<ControlGroup>
<LanguagePicker />
</ControlGroup>
</Control>
<!-- other sources and layers here -->
</MapLibre> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Are we able to set the map language somehow, or is that not implemented?
It looks like the option exists:
https://maplibre.org/maplibre-gl-js/docs/examples/language-switch/
Or as an example here there's a language dropdown:
https://www.maptiler.com/maps/#style=positron&lang=native&mode=2d&position=14.61/50.68087/30.41864
Beta Was this translation helpful? Give feedback.
All reactions