Skip to content

Commit

Permalink
Add setting to override the Google API language
Browse files Browse the repository at this point in the history
  • Loading branch information
carlcs committed Mar 12, 2021
1 parent 94cfa34 commit 35999dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/helpers/ApiHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ public static function getApiUrl(array $params = []): string
// Use browser key
$params['key'] = static::getBrowserKey();

$language = GoogleMapsPlugin::$plugin->getSettings()->language;
if ($language) {
$params['language'] = $language;
}

return UrlHelper::urlWithParams('https://maps.googleapis.com/maps/api/js', $params);
Expand Down
5 changes: 5 additions & 0 deletions src/models/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,9 @@ class Settings extends Model
*/
public $enableJsLogging = true;

/**
* @var string|null Google API Language.
* @see https://developers.google.com/maps/documentation/javascript/localization
*/
public $language;
}

0 comments on commit 35999dd

Please sign in to comment.