Hi This module is really useful, easy to use. I really like it.

BTW, I'm a Japanese so I want to use the Japanese version of Google maps. Maybe some others who are not English speaking/using people want the native version of it.
Please add the feature of changing the (default) languages.

THX in advance !

Comments

Shin-gdo_J’s picture

Assigned: Shin-gdo_J » Unassigned
Priority: Major » Normal
jhodgdon’s picture

That sounds like a good idea. The map URLs for Google have an "hl=[language]" URL query parameter, so it would be easy to let an administrator enter a two-letter language code in the settings, and pass that to the map. The admin would need to figure out the right code, but that shouldn't be too hard (they could just look at the URLs that Google Maps provides to them in their language).

If someone wants to provide a patch, this could be added to the module soon. Otherwise, it may not be my highest priority right now for my Drupal volunteer work.

jibus’s picture

Hi,

I ran into the same issue.

A patch isn't really required since there is a template.

Copy simple-gmap-output.tpl.php into your theme folder and replace the content with this:

<?php
/**
 * @file
 * Displays the Simple Google Maps formatter.
 *
 * Available variables:
 * - $include_map: TRUE if an embedded map should be displayed.
 * - $width: Width of embedded map.
 * - $height: Height of embedded map.
 * - $include_link: TRUE if a link to a map should be displayed.
 * - $link_text: Text of link to display.
 * - $url_suffix: Suffix of URLs to send to Google Maps for embedded and linked
 *   maps. Contains the URL-encoded address.
 * - $zoom: Zoom level for embedded and linked maps.
 * - $information_bubble: TRUE if an information bubble should be displayed on
 *   maps. Note that in the Google Maps URLs, you need to send iwloc=A to use
 *   a bubble, and iwloc= (without the A) to omit the bubble.
 * - $address_text: Address text to display (empty if it should not be
 *   displayed).
 *
 * @ingroup themeable
 */
global $language;
if ($include_map) {
?>
<iframe width="<?php print $width; ?>" height="<?php print $height; ?>" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?hl=<?php print $language->language; ?>&amp;q=<?php print $url_suffix; ?>&amp;iwloc=<?php print ($information_bubble ? 'A': ''); ?>&amp;z=<?php print $zoom; ?>&amp;output=embed"></iframe>
<?php
}
if ($include_link) {
?>
<p class="simple-gmap-link"><a href="http://maps.google.com/maps?q=<?php print $url_suffix; ?>&amp;iwloc=<?php print ($information_bubble ? 'A': ''); ?>&amp;z=<?php print $zoom; ?>" target="_blank"><?php print $link_text; ?></a></p>
<?php
}
if (!empty($address_text)) {
?>
<p class="simple-gmap-address"><?php print $address_text; ?></p>
<?php
}

It will take the language of the page where the map is displayed

Don't forget to clear cache

jhodgdon’s picture

That solution will definitely work with many languages, but I am not sure Google Maps supports all languages that could be in place on a Drupal site (the template is taking the language from Drupal's language code). Also, in theory you have the flexibility to define your own code for a language in the admin interface (such as using 'en-uk' for British English), so there is no guarantee that a code you chose would work for Google Maps.

So I think it would still be better to have a setting for the language... someone just needs to add it to the module.

jibus’s picture

Ok, you mean, add an option to the formater wich allows to set the language for the map

jhodgdon’s picture

Exactly! Even better would be if it has two options:
a) Use the page's language (with a note that it would only work if Google Maps recognizes all the language codes in use on your site).
b) Use a particular language that you enter the code for.

jhodgdon’s picture

Assigned: Unassigned » jhodgdon

I'm working on this module today, so I'll add this option.

jhodgdon’s picture

Status: Active » Fixed

Done! I'll be making a new release of this module shortly...

jibus’s picture

OH !

I was going to make a patch, but i see you just made it !

Thanks you very much ! Will test it !

jhodgdon’s picture

Yes, please do test, and let me know if you find any problems. :) I put this feature into the official 7.x-1.0 release of the module, which you can download on the module home page now.

jibus’s picture

Works like a charm, thanks again !

Status: Fixed » Closed (fixed)

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