From cc8d78d971668f4ac1bf07ef538cf8664d97fb70 Mon Sep 17 00:00:00 2001 From: Kerry Date: Fri, 8 Jul 2022 17:08:05 +0200 Subject: [PATCH] Location sharing - add localised strings to map (#9025) * add localised strings to map * fussy import ordering * remove unused scale control strings from override --- src/i18n/strings/en_EN.json | 12 ++++++++++-- src/utils/location/map.ts | 13 +++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index e0b1749c03..d27644cb64 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -726,6 +726,16 @@ "Unknown App": "Unknown App", "This homeserver is not configured to display maps.": "This homeserver is not configured to display maps.", "This homeserver is not configured correctly to display maps, or the configured map server may be unreachable.": "This homeserver is not configured correctly to display maps, or the configured map server may be unreachable.", + "Toggle attribution": "Toggle attribution", + "Map feedback": "Map feedback", + "Enter fullscreen": "Enter fullscreen", + "Exit fullscreen": "Exit fullscreen", + "Find my location": "Find my location", + "Location not available": "Location not available", + "Mapbox logo": "Mapbox logo", + "Reset bearing to north": "Reset bearing to north", + "Zoom in": "Zoom in", + "Zoom out": "Zoom out", "Are you sure you want to exit during this export?": "Are you sure you want to exit during this export?", "Generating a ZIP": "Generating a ZIP", "Fetched %(count)s events out of %(total)s|other": "Fetched %(count)s events out of %(total)s", @@ -2198,8 +2208,6 @@ "My live location": "My live location", "Drop a Pin": "Drop a Pin", "What location type do you want to share?": "What location type do you want to share?", - "Zoom in": "Zoom in", - "Zoom out": "Zoom out", "Frequently Used": "Frequently Used", "Smileys & People": "Smileys & People", "Animals & Nature": "Animals & Nature", diff --git a/src/utils/location/map.ts b/src/utils/location/map.ts index 5c5ab34e18..7dc8522271 100644 --- a/src/utils/location/map.ts +++ b/src/utils/location/map.ts @@ -19,6 +19,7 @@ import { MatrixEvent } from "matrix-js-sdk/src/matrix"; import { M_LOCATION } from "matrix-js-sdk/src/@types/location"; import { logger } from "matrix-js-sdk/src/logger"; +import { _t } from "../../languageHandler"; import { parseGeoUri } from "./parseGeoUri"; import { findMapStyleUrl } from "./findMapStyleUrl"; import { LocationShareError } from "./LocationShareErrors"; @@ -37,6 +38,18 @@ export const createMap = ( zoom: 15, interactive, attributionControl: false, + locale: { + 'AttributionControl.ToggleAttribution': _t('Toggle attribution'), + 'AttributionControl.MapFeedback': _t('Map feedback'), + 'FullscreenControl.Enter': _t('Enter fullscreen'), + 'FullscreenControl.Exit': _t('Exit fullscreen'), + 'GeolocateControl.FindMyLocation': _t('Find my location'), + 'GeolocateControl.LocationNotAvailable': _t('Location not available'), + 'LogoControl.Title': _t('Mapbox logo'), + 'NavigationControl.ResetBearing': _t('Reset bearing to north'), + 'NavigationControl.ZoomIn': _t('Zoom in'), + 'NavigationControl.ZoomOut': _t('Zoom out'), + }, }); map.addControl(new maplibregl.AttributionControl(), 'top-right');