Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting language for DirectionsService in Google Maps API v3

I now switched to the v3 API of google maps and offer some route-planning using google's DirectionsService. It all works as expected, but the language is in english and i can't find a way to set it to german. The map itself is already in german – only the output of DirectionsService is in english.

Anyone an idea how to set it to de-DE?

like image 414
nocksock Avatar asked Dec 09 '25 22:12

nocksock


2 Answers

After a lot of googling i came along a blogpost on google geodevelopers that told me to simply put the language into the api-request request:

<script src="http://maps.google.com/maps/api/js?sensor=true&language=de"></script>

And it works!

like image 94
nocksock Avatar answered Dec 12 '25 11:12

nocksock


Google maps will use the language specified in the user's browser in the Accept-Language header. You change this by doing what you found and adding the language to the url.

like image 42
Galen Avatar answered Dec 12 '25 12:12

Galen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!