mapbox-gl-js icon indicating copy to clipboard operation
mapbox-gl-js copied to clipboard

Add localization for UI strings

Open stepankuzmin opened this issue 2 years ago • 6 comments

This PR adds translations for UI strings we use in GL JS into multiple languages.

Context Screenshot
ID: AttributionControl.ToggleAttribution
English: Toggle attribution
Context: Tooltip text on AttributionControl hover
Screenshot 2022-04-12 at 12 22 53
ID: AttributionControl.MapFeedback
English: Map feedback
Context: Accessibility label for the Improve this map link in the expanded AttributionControl. That label can be read by assistive technology
Screenshot 2022-04-11 at 21 40 33
ID: FullscreenControl.Enter
English: Enter fullscreen
Context: Tooltip text on FullscreenControl hover when not in the fullscreen mode
Screenshot 2022-04-12 at 12 31 49
ID: FullscreenControl.Exit
English: Exit fullscreen
Context: Tooltip text on FullscreenControl hover when in the fullscreen mode
Screenshot 2022-04-12 at 12 31 58
ID: GeolocateControl.FindMyLocation
English: Find my location
Context: Tooltip text on GeolocateControl hover
Screenshot 2022-04-12 at 12 34 57
ID: GeolocateControl.LocationNotAvailable
English: Location not available
Context: Tooltip text on GeolocateControl hover when we can't locate user
Screenshot 2022-04-12 at 12 35 08
ID: LogoControl.Title
English: Mapbox logo
Context: Accessibility label for the Mapbox logo image. That label can be read by assistive technology
Screenshot 2022-04-12 at 12 38 52
ID: Map.Title
English: Map
Context: Accessibility label for the map canvas element on the webpage. That label can be read by assistive technology
Screenshot 2022-04-12 at 12 42 03
ID: NavigationControl.ResetBearing
English: Reset bearing to north
Context: Tooltip text on bearing button in NavigationControl
Screenshot 2022-04-12 at 12 45 06
ID: NavigationControl.ZoomIn
English: Zoom in
Context: Tooltip text on plus button in NavigationControl
Screenshot 2022-04-12 at 12 45 56
ID: NavigationControl.ZoomOut
English: Zoom out
Context: Tooltip text on minus button in NavigationControl
Screenshot 2022-04-12 at 12 46 02
ID: ScrollZoomBlocker.CtrlMessage
English: Use ctrl + scroll to zoom the map
Context: Text on map blocker alert when cooperative gestures are enabled
Screenshot 2022-04-12 at 13 08 03
ID: ScrollZoomBlocker.CmdMessage
English: Use ⌘ + scroll to zoom the map
Context: Text on map blocker alert when cooperative gestures are enabled
Screenshot 2022-04-12 at 13 08 03
ID: TouchPanBlocker.Message
English: Use two fingers to move the map
Context: Text on map blocker alert when cooperative gestures are enabled
IMG_A42AFAB7325C-1

stepankuzmin avatar Apr 12 '22 10:04 stepankuzmin

Personally, I use number-format for units. Not all locales follow the pattern of ${number} ${unit}

varna avatar May 19 '22 10:05 varna

The effect of this PR on the bundle size:

before

948K	dist/mapbox-gl.js
256K	dist/mapbox-gl.js.br
256K	dist/mapbox-gl.js.tar.gz

after

972K	dist/mapbox-gl.js
256K	dist/mapbox-gl.js.br
264K	dist/mapbox-gl.js.tar.gz

Compressed with:

tar -cvzf dist/mapbox-gl.js.tar.gz dist/mapbox-gl.js
brotli -q 11 dist/mapbox-gl.js -o dist/mapbox-gl.js.br

stepankuzmin avatar May 24 '22 12:05 stepankuzmin

The German texts sound a bit strange. There are informal texts like "Finde …" or "Setze …" and formal texts like "Verwenden Sie …". I always try to avoid this decision by using words that don't need it (mostly infinitive). Here are my suggestions:

"GeolocateControl.FindMyLocation": "Meinen Standort finden",   // or: "Aktueller Standort"
"NavigationControl.ResetBearing": "Orientierung auf Norden zurücksetzen",
"ScrollZoomBlocker.CtrlMessage": "Zoomen der Karte mit gedrückter Strg-Taste",   // makes clear it's a key and avoids jargon like "+"
"ScrollZoomBlocker.CmdMessage": "Zoomen der Karte mit gedrückter ⌘-Taste",
"TouchPanBlocker.Message": "Verschieben der Karte mit zwei Fingern"

I'd also suggest changing these English texts:

"ScrollZoomBlocker.CtrlMessage": "Hold the Ctrl key while scrolling to zoom the map",
"ScrollZoomBlocker.CmdMessage": "Hold the ⌘ key while scrolling to zoom the map",

ygoe avatar Jul 26 '22 17:07 ygoe

Thanks for the contribution, @ygoe!

@melanieimfeld, @kkaefer, what do you think of these suggestions? https://github.com/mapbox/mapbox-gl-js/pull/11733#issuecomment-1195773934

The German texts sound a bit strange. There are informal texts like "Finde …" or "Setze …" and formal texts like "Verwenden Sie …". I always try to avoid this decision by using words that don't need it (mostly infinitive). Here are my suggestions:

"GeolocateControl.FindMyLocation": "Meinen Standort finden",   // or: "Aktueller Standort"
"NavigationControl.ResetBearing": "Orientierung auf Norden zurücksetzen",
"ScrollZoomBlocker.CtrlMessage": "Zoomen der Karte mit gedrückter Strg-Taste",   // makes clear it's a key and avoids jargon like "+"
"ScrollZoomBlocker.CmdMessage": "Zoomen der Karte mit gedrückter ⌘-Taste",
"TouchPanBlocker.Message": "Verschieben der Karte mit zwei Fingern"

stepankuzmin avatar Jul 27 '22 10:07 stepankuzmin

Glad to see this is happening.

I support a customer who does Indonesian and Transitional Chinese (HK, TW) which aren't in this PR.

The translations we are using came from Lionbridge and differ a bit from those in this PR, not sure if you're interested in seeing those differences?

andrewharvey avatar Aug 16 '22 03:08 andrewharvey

Hi @andrewharvey,

Yes, we already have PRs for Indonesian and Tranditional Chinese that needs to be verified, any contributions are welcome!

Verifications are still needed for Czech, Greek, Indonesian, Georgian, Malay, Norwegian and Norwegian Bokmål, Slovak, Slovenian, Thai, and Traditional Chinese.

stepankuzmin avatar Aug 16 '22 09:08 stepankuzmin

I wonder if "Improve this map" could also be translated? So far I haven't seen any option to achieve this. Is it possible?

gregholst avatar Jan 29 '23 18:01 gregholst