Translate the leaflet control texts

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-08-12 10:54:55 +02:00
parent 53a3dc6fab
commit 275126d199
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
4 changed files with 34 additions and 6 deletions

View File

@ -7,12 +7,18 @@
:center="[lat, lon]" :center="[lat, lon]"
@click="clickMap" @click="clickMap"
@update:zoom="updateZoom" @update:zoom="updateZoom"
:options="{ zoomControl: false }"
> >
<l-tile-layer <l-tile-layer
:url="config.maps.tiles.endpoint" :url="config.maps.tiles.endpoint"
:attribution="attribution" :attribution="attribution"
> >
</l-tile-layer> </l-tile-layer>
<l-control-zoom
position="topleft"
:zoomInTitle="$t('Zoom in')"
:zoomOutTitle="$t('Zoom out')"
></l-control-zoom>
<v-locatecontrol :options="{ icon: 'mdi mdi-map-marker' }" /> <v-locatecontrol :options="{ icon: 'mdi mdi-map-marker' }" />
<l-marker <l-marker
:lat-lng="[lat, lon]" :lat-lng="[lat, lon]"
@ -34,7 +40,14 @@
import { Icon, LatLng, LeafletMouseEvent, LeafletEvent } from "leaflet"; import { Icon, LatLng, LeafletMouseEvent, LeafletEvent } from "leaflet";
import "leaflet/dist/leaflet.css"; import "leaflet/dist/leaflet.css";
import { Component, Prop, Vue } from "vue-property-decorator"; import { Component, Prop, Vue } from "vue-property-decorator";
import { LMap, LTileLayer, LMarker, LPopup, LIcon } from "vue2-leaflet"; import {
LMap,
LTileLayer,
LMarker,
LPopup,
LIcon,
LControlZoom,
} from "vue2-leaflet";
import Vue2LeafletLocateControl from "@/components/Map/Vue2LeafletLocateControl.vue"; import Vue2LeafletLocateControl from "@/components/Map/Vue2LeafletLocateControl.vue";
import { CONFIG } from "../graphql/config"; import { CONFIG } from "../graphql/config";
import { IConfig } from "../types/config.model"; import { IConfig } from "../types/config.model";
@ -46,6 +59,7 @@ import { IConfig } from "../types/config.model";
LMarker, LMarker,
LPopup, LPopup,
LIcon, LIcon,
LControlZoom,
"v-locatecontrol": Vue2LeafletLocateControl, "v-locatecontrol": Vue2LeafletLocateControl,
}, },
apollo: { apollo: {

View File

@ -10,9 +10,9 @@
* to try to trigger location manually (not done ATM) * to try to trigger location manually (not done ATM)
*/ */
import L, { DomEvent } from "leaflet"; import { DomEvent } from "leaflet";
import { findRealParent, propsBinder } from "vue2-leaflet"; import { findRealParent, propsBinder } from "vue2-leaflet";
import "leaflet.locatecontrol"; import Locatecontrol from "leaflet.locatecontrol";
import { Component, Prop, Vue } from "vue-property-decorator"; import { Component, Prop, Vue } from "vue-property-decorator";
@Component({ @Component({
@ -37,12 +37,20 @@ export default class Vue2LeafletLocateControl extends Vue {
parentContainer: any; parentContainer: any;
mounted(): void { mounted(): void {
this.mapObject = L.control.locate(this.options); // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
this.mapObject = new Locatecontrol({
...this.options,
strings: { title: this.$t("Show me where I am") as string },
});
DomEvent.on(this.mapObject, this.$listeners as any); DomEvent.on(this.mapObject, this.$listeners as any);
propsBinder(this, this.mapObject, this.$props); propsBinder(this, this.mapObject, this.$props);
this.ready = true; this.ready = true;
this.parentContainer = findRealParent(this.$parent); this.parentContainer = findRealParent(this.$parent);
this.mapObject.addTo(this.parentContainer.mapObject, !this.visible); this.mapObject.addTo(this.parentContainer.mapObject, !this.visible);
this.$nextTick(() => {
this.$emit("ready", this.mapObject);
});
} }
public locate(): void { public locate(): void {

View File

@ -1125,5 +1125,8 @@
"Booking": "Booking", "Booking": "Booking",
"Filter by profile or group name": "Filter by profile or group name", "Filter by profile or group name": "Filter by profile or group name",
"Filter by name": "Filter by name", "Filter by name": "Filter by name",
"Redirecting in progress…": "Redirecting in progress…" "Redirecting in progress…": "Redirecting in progress…",
"Zoom in": "Zoom in",
"Zoom out": "Zoom out",
"Show me where I am": "Show me where I am"
} }

View File

@ -1216,5 +1216,8 @@
"Booking": "Réservations", "Booking": "Réservations",
"Filter by profile or group name": "Filter par nom du profil ou du groupe", "Filter by profile or group name": "Filter par nom du profil ou du groupe",
"Filter by name": "Filtrer par nom", "Filter by name": "Filtrer par nom",
"Redirecting in progress…": "Redirection en cours…" "Redirecting in progress…": "Redirection en cours…",
"Zoom in": "Zoomer",
"Zoom out": "Dézoomer",
"Show me where I am": "Afficher ma position"
} }