impress-org / google-maps-builder

One Google Maps plugin to rule them all. Google Maps Builder is intuitive, sleek, powerful and easy to use. Forget the rest, use the best.
https://wordpress.org/plugins/google-maps-builder/
32 stars 9 forks source link

Point external links to the localized version of Google Maps #255

Open kevinwhoffman opened 7 years ago

kevinwhoffman commented 7 years ago

Issue Overview

In scenarios where the plugin provides external links to Google Maps, sometimes English maps are displayed even if the WordPress locale and Map Languge setting are non-English. This happens because the Google Maps URL is hard-coded in some places.

Correctly Localized Links

The plugin loads the correct version of Google Maps based on the Map Language setting. Therefore any links generated by Google Maps, such as Places links, are correctly localized.

Incorrectly Localized Links

Some links to Google Maps are generated by the plugin, such as View Directions links in info windows. In these cases the URL is hard-coded and therefore not being localized. For example:

https://github.com/WordImpress/maps-builder-core/blob/master/assets/js/frontend/google-maps-builder.js#L492

Recommended Solution

Ensure that all Google Maps links include a locale parameter like so...

https://maps.google.com/maps?ll=32.715329,-117.157255&z=15&t=m&hl=de-DE&gl=US&mapclient=apiv3&cid=14113054270661276702

...where hl=de-DE determines the language of the map.

Related

https://secure.helpscout.net/conversation/397520732/8926/?folderId=672189