You can customize your map for a specific country or region in the following ways:
- Change the default language settings.
- Specify a region code, which alters the map's behavior based on a given country or territory.
Language localization
By default, the Google Maps JavaScript API uses the user's preferred
language setting as specified in the browser, when displaying textual
information such as the names for controls, copyright notices, driving
directions and labels on maps. In most cases, it's preferable to respect the
browser setting. However, if you want the
Maps JavaScript API to ignore the browser's
language setting, you can force it to display information in a particular
language by adding a language parameter to the
<script> tag when loading the
Maps JavaScript API code.
The following example displays a map in Japanese and sets the region to Japan:
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&language=ja®ion=JP"> </script>
If you set the language of the map, it's important to consider setting the region too. This helps ensure that your application complies with local laws.
Note: When you load the API in the manner shown above, the map uses the Japanese language for all users regardless of user preferences. Be sure you want this behavior before setting this option.
The Maps JavaScript API also supports bi-directional
(Bidi) text containing characters in both left-to-right (LTR) and
right-to-left (RTL) languages natively. Examples of RTL languages include
Arabic, Hebrew, and Farsi. Generally, you should specify RTL language pages to
render properly by adding dir='rtl' to the page's
<html> element. The following example renders a map of
Cairo, Egypt using Arabic controls:
<!DOCTYPE html>
<html dir="rtl">
<body>
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&language=ar®ion=EG">
</script>
</body>
</html>
See the list of supported languages. Note that new languages are added often, so this list may not be exhaustive.
Region localization
When you load the Google Maps JavaScript API from
maps.googleapis.com it applies a default bias for application
behavior towards the United States. If you want to alter your application to
serve different map tiles or bias the application (such as biasing geocoding
results towards the region), you can override this default behavior by adding
a region parameter to the <script> tag when
loading the Maps JavaScript API code.
As the developer of a Maps JavaScript API application it is your responsibility to ensure that your application complies with local laws by ensuring that the correct region localization is applied for the country in which the application is hosted.
The region parameter accepts
Unicode region subtag identifiers which (generally) have a
one-to-one mapping to country code Top-Level Domains (ccTLDs). Most Unicode
region identifiers are identical to ISO 3166-1 codes, with some notable
exceptions. For example, Great Britain's ccTLD is "uk" (corresponding to the
domain .co.uk) while its region identifier is "GB."
For example, the following script tag localizes the map to the United Kingdom:
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY®ion=GB"> </script>
The following examples show two maps, one which geocodes "Toledo" based on
the default region (US) to "Toledo, Ohio" and one which biases results based
on a region set to ES (Spain) to "Toledo,
Spain."
View the US example and the ES example.
Loading the API in China
The Google Maps JavaScript API is served within China from
http://maps.google.cn. When serving content to China, replace
https://maps.googleapis.com with
http://maps.google.cn. For example:
<script src="http://maps.google.cn/maps/api/js?key=YOUR_API_KEY"> </script>
If you are specifically targeting users in China, you should add the
region and language parameters as well. The API supports both
zh-CN and zh-TW as values for the
language parameter.
<script src="http://maps.google.cn/maps/api/js?region=cn&language=zh-CN&key=YOUR_API_KEY"> </script>
