From 5dd048d08d1a72c94e86c843e8f377bb42bb1102 Mon Sep 17 00:00:00 2001 From: Kerry Archibald Date: Fri, 8 Jul 2022 15:53:44 +0200 Subject: [PATCH 1/4] add localised strings to map --- src/i18n/strings/en_EN.json | 17 +++++++++++++++-- src/utils/location/map.ts | 18 ++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index e0b1749c036..75463aee85c 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -726,6 +726,21 @@ "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", + "ft": "ft", + "m": "m", + "km": "km", + "mi": "mi", + "nm": "nm", "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 +2213,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 5c5ab34e18c..d2e142d3c8d 100644 --- a/src/utils/location/map.ts +++ b/src/utils/location/map.ts @@ -22,6 +22,7 @@ import { logger } from "matrix-js-sdk/src/logger"; import { parseGeoUri } from "./parseGeoUri"; import { findMapStyleUrl } from "./findMapStyleUrl"; import { LocationShareError } from "./LocationShareErrors"; +import { _t } from "../../languageHandler"; export const createMap = ( interactive: boolean, @@ -37,6 +38,23 @@ 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'), + 'ScaleControl.Feet': _t('ft'), + 'ScaleControl.Meters': _t('m'), + 'ScaleControl.Kilometers': _t('km'), + 'ScaleControl.Miles': _t('mi'), + 'ScaleControl.NauticalMiles': _t('nm'), + }, }); map.addControl(new maplibregl.AttributionControl(), 'top-right'); From a09bf5a6f8a07cd570721a5a7a6ec34471d87dc3 Mon Sep 17 00:00:00 2001 From: Kerry Archibald Date: Fri, 8 Jul 2022 15:57:33 +0200 Subject: [PATCH 2/4] fussy import ordering --- src/utils/location/map.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/location/map.ts b/src/utils/location/map.ts index d2e142d3c8d..26cb520d379 100644 --- a/src/utils/location/map.ts +++ b/src/utils/location/map.ts @@ -19,10 +19,10 @@ 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"; -import { _t } from "../../languageHandler"; export const createMap = ( interactive: boolean, From f290c680505add095151cdffc1a028dde4e35136 Mon Sep 17 00:00:00 2001 From: Kerry Archibald Date: Fri, 8 Jul 2022 16:35:39 +0200 Subject: [PATCH 3/4] remove unused scale control strings from override --- src/utils/location/map.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/utils/location/map.ts b/src/utils/location/map.ts index 26cb520d379..7dc8522271c 100644 --- a/src/utils/location/map.ts +++ b/src/utils/location/map.ts @@ -49,11 +49,6 @@ export const createMap = ( 'NavigationControl.ResetBearing': _t('Reset bearing to north'), 'NavigationControl.ZoomIn': _t('Zoom in'), 'NavigationControl.ZoomOut': _t('Zoom out'), - 'ScaleControl.Feet': _t('ft'), - 'ScaleControl.Meters': _t('m'), - 'ScaleControl.Kilometers': _t('km'), - 'ScaleControl.Miles': _t('mi'), - 'ScaleControl.NauticalMiles': _t('nm'), }, }); map.addControl(new maplibregl.AttributionControl(), 'top-right'); From 074eecd9096bbc547bb0dece25d23234fb3aee22 Mon Sep 17 00:00:00 2001 From: Kerry Archibald Date: Fri, 8 Jul 2022 16:48:25 +0200 Subject: [PATCH 4/4] i18n duh --- src/i18n/strings/en_EN.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 75463aee85c..d27644cb643 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -736,11 +736,6 @@ "Reset bearing to north": "Reset bearing to north", "Zoom in": "Zoom in", "Zoom out": "Zoom out", - "ft": "ft", - "m": "m", - "km": "km", - "mi": "mi", - "nm": "nm", "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",