Hi all,

i was trying to create a google map layer for a hebrew website but encountered a problem:

under /admin/structure/openlayers/layers/settings under google's section there's a text field for choosing google maps display language. whatever lang code i inserted always resulted in english maps. after a lot of searching i found that there is a wrong param name in the JS call for google maps API in the HTML Head section:

original code:
http://maps.google.com/maps/api/js?sensor=false&v=3.5&hl=X

Should become:
http://maps.google.com/maps/api/js?sensor=false&v=3.5&language=X

while X = 2 character language code from google documentation (ie "iw" for hebrew).

1. to fix this line go to your OpenLayers directory to:
openlayers/plugins/layer_types/

2. edit the file "openlayers_layer_type_google.inc".

3. around line 141 change this:
$url .= !empty($lang) ? '&hl=' . $lang : '';

to this:
$url .= !empty($lang) ? '&language=' . $lang : '';

I tried it only with API v3.5.

Comments

zzolo’s picture

Version: 7.x-2.0-beta1 » 7.x-2.x-dev

Hey @SHS, thanks for catching this. It would have been helpful if you found the documentation for it (see below). I think we should support both parameters.

v3 uses langauge
https://developers.google.com/maps/documentation/javascript/basics#Local...

v2 uses hl (though its a deprecated API, we should still support)
https://developers.google.com/maps/documentation/javascript/v2/basics#Lo...

zzolo’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.