根據預設,Maps JavaScript API 會依照使用者在瀏覽器中指定的偏好語言設定來顯示文字資訊,例如地圖上的控制項名稱、版權聲明、行車路線和標籤。在大部分情況下,最好採用瀏覽器設定。不過,如果您希望 Maps JavaScript API 略過瀏覽器的語言設定,可以在載入 Maps JavaScript API 程式碼時為 <script> 標記加入 language 參數,強制瀏覽器以特定語言顯示資訊。
language 參數會影響控制項名稱、版權聲明、行車路線和控制項標籤,以及對服務要求的回應。服務受到的影響並不明顯。舉例來說,對街道層級地址進行地理編碼時,系統會以您要求的語言傳回國家/地區名稱,地址的其餘部分則取決於進行地理編碼的位置。另一方面,郵政和政治結果會以要求的語言傳回。請使用這裡的示範程式碼,瞭解更新 language 參數時地圖上發生的變化。
如要修改應用程式的地圖圖塊或自訂調整 (例如根據特定區域調整地理編碼結果),您可以在載入 Maps JavaScript API 程式碼時,將 region 參數加到 <script> 標記。
對於 Maps JavaScript API 應用程式的開發人員,我們建議一律設定 region 參數。設定 region 之後,各項服務 (例如 Places Autocomplete) 通常能提供更準確的結果。
此外,針對應用程式的代管主機所在國家/地區,您有責任套用正確的區域本地化設定,確保應用程式符合當地法律規定。
region 參數接受萬國碼 (Unicode) 區域子標記 ID。一般來說,該 ID 可一對一對應至國家/地區代碼頂層網域 (ccTLD)。大多數萬國碼 (Unicode) 區域 ID 與 ISO 3166-1 alpha-2 代碼相同,但有一些需要注意的例外情況。舉例來說,英國的 ccTLD 是「uk」(對應到網域 .co.uk),而區域 ID 卻是「GB」。如需支援區域的相關資訊,請參閱 Google 地圖平台涵蓋範圍詳細資料。請試用這裡的示範,瞭解更新 region 參數時地圖上發生的變化。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-06 (世界標準時間)。"],[[["\u003cp\u003eCustomize your map by adjusting the default language and specifying a region code for tailored behavior.\u003c/p\u003e\n"],["\u003cp\u003eUtilize the \u003ccode\u003elanguage\u003c/code\u003e parameter in the script tag to display map information in a specific language, overriding browser settings if needed.\u003c/p\u003e\n"],["\u003cp\u003eApply the \u003ccode\u003eregion\u003c/code\u003e parameter in the script tag to refine map tiles, bias application results, and ensure compliance with local laws.\u003c/p\u003e\n"],["\u003cp\u003eFor optimal results and legal adherence, consider setting both \u003ccode\u003elanguage\u003c/code\u003e and \u003ccode\u003eregion\u003c/code\u003e parameters when localizing your map.\u003c/p\u003e\n"]]],["To customize a map, specify a `language` and `region` parameter in the `\u003cscript\u003e` tag when loading the Maps JavaScript API. The `language` parameter sets the display language for controls, directions, and service responses, overriding the browser's default. The `region` parameter alters map tiles and biases service results, like geocoding. Setting both is crucial for legal compliance and service accuracy. For example, you can set the language to Japanese and the region to Japan by setting `language=ja` and `region=JP`.\n"],null,["You can customize your map for a specific country or region in the following\nways:\n\n- Change the default language settings.\n- Specify a region code, which alters the map's behavior based on a given country or territory.\n\nLanguage localization\n\nBy default, the Maps JavaScript API uses the user's preferred\nlanguage setting as specified in the browser, when displaying textual\ninformation such as the names for controls, copyright notices, driving\ndirections and labels on maps. In most cases, it's preferable to respect the\nbrowser setting. However, if you want the\nMaps JavaScript API to ignore the browser's\nlanguage setting, you can force it to display information in a particular\nlanguage by adding a `language` parameter to the\n`\u003cscript\u003e` tag when loading the\nMaps JavaScript API code.\n\nThe `language` parameter affects the names of controls, copyright\nnotices, driving directions, and control labels, as well as the responses to\nservice requests. The effect on services is not as apparent. For example, when\ngeocoding street level addresses the country name is returned in the language\nyou requested, but the rest of the address will be specific to the location\nyou are geocoding. On the other hand, postal and political results are\nreturned in the requested language.\nTry [this demo](/maps/documentation/javascript/demos/localization) to experiment with the changes on the map when you update the\n`language` parameter.\n\nThe following example displays a map in Japanese and sets the region to\nJapan: \n\n```html\n\u003cscript async\n src=\"https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&loading=async®ion=JP&language=ja&callback=initMap\"\u003e\n\u003c/script\u003e\n```\n\n[View\nexample](/maps/documentation/javascript/examples/map-language).\n\nIf you set the language of the map, it's important to\nconsider setting the [region](#Region) too. This helps ensure\nthat your application complies with local laws.\n\n**Note:** When you load the API in the manner shown above, the\nmap uses the Japanese language for all users regardless of user preferences.\nBe sure you want this behavior before setting this option.\n\nThe Maps JavaScript API also supports bi-directional\n(Bidi) text containing characters in both left-to-right (LTR) and\nright-to-left (RTL) languages natively. Examples of RTL languages include\nArabic, Hebrew, and Farsi. Generally, you should specify RTL language pages to\nrender properly by adding `dir='rtl'` to the page's\n`\u003chtml\u003e` element. The following example renders a map of\nCairo, Egypt using Arabic controls: \n\n```html\n\u003cscript async\n src=\"https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&loading=async®ion=EG&language=ar&callback=initMap\"\u003e\n\u003c/script\u003e\n```\n\n[View example](/maps/documentation/javascript/examples/map-rtl)\n\nSee the [list of supported\nlanguages](/maps/faq#languagesupport). Note that new languages are added often, so this list may not\nbe exhaustive.\n\nRegion localization\n\nAdd a `region` parameter to the `\u003cscript\u003e` tag\nwhen loading the Maps JavaScript API code, if you\nwant to alter your application to serve different map tiles or bias the\napplication (such as biasing geocoding results towards the region).\n\nAs the developer of a Maps JavaScript API\napplication you are encouraged to always set a `region` parameter as various services\n(such as Places Autocomplete) tend to provide better results when the `region` is set.\nIt is also your responsibility to ensure that your application complies with local laws by\nensuring that the correct region localization is applied for the country in which the application\nis hosted.\n\nThe `region` parameter accepts\n[Unicode region subtag identifiers](http://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers) which (generally) have a\none-to-one mapping to country code Top-Level Domains (ccTLDs). Most Unicode\nregion identifiers are identical to ISO 3166-1 alpha-2 codes, with some\nnotable exceptions. For example, Great Britain's ccTLD is \"uk\" (corresponding\nto the domain `.co.uk`) while its region identifier is \"GB.\" See\n[Google Maps Platform Coverage Details](/maps/coverage) for\nsupported regions.\nTry [this demo](/maps/documentation/javascript/demos/localization) to experiment with the changes on the map when you update the\n`region` parameter.\n\nFor example, the following script tag localizes the map to the United\nKingdom: \n\n```html\n\u003cscript async\n src=\"https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&loading=async®ion=GB&callback=initMap\"\u003e\n\u003c/script\u003e\n```\n\nThe following examples show two maps, one which geocodes \"Toledo\" based on\na `region` set to `US` (US) to \"Toledo, Ohio\" and one\nwhich biases results based on a `region` set to `ES`\n(Spain) to \"Toledo, Spain.\" \n\nView the\n[US\nexample](/maps/documentation/javascript/examples/geocoding-region-us) and the\n[ES\nexample](/maps/documentation/javascript/examples/geocoding-region-es).\n\nLocalization Demo\n\nWhen setting the language of the map, it's important to consider setting the region too.\nHere is a demo that allows you to load the map with your choice of language and region.\n\nView this demo in [fullscreen](/maps/documentation/javascript/demos/localization)."]]