Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Developer Wilayah Ekonomi Eropa (EEA)
Nilai respons yang dilokalkan adalah kolom respons tambahan yang menyediakan
teks yang dilokalkan untuk nilai parameter yang ditampilkan. Teks yang dilokalkan disediakan untuk
durasi perjalanan, jarak, dan sistem unit (metrik atau imperial). Anda meminta
nilai yang dilokalkan menggunakan mask kolom, dan dapat menentukan bahasa dan
sistem unit atau menggunakan nilai yang disimpulkan oleh API. Untuk mengetahui detailnya, lihat
LocalizedValues.
Misalnya, jika Anda menentukan kode bahasa untuk Jerman (de) dan unit imperial, Anda akan mendapatkan nilai distanceMeters sebesar 49889,7, tetapi juga teks yang dilokalkan yang memberikan pengukuran jarak tersebut dalam bahasa Jerman dan unit imperial, sehingga "31 Meile".
Berikut adalah contoh yang akan Anda lihat untuk nilai yang dilokalkan:
Jika Anda tidak menentukan bahasa atau sistem satuan, API akan menyimpulkan bahasa
dan satuan sebagai berikut:
Metode ComputeRoutes menyimpulkan unit lokasi dan jarak
dari titik jalan asal. Jadi, untuk permintaan pemilihan rute di Amerika Serikat, API
akan menyimpulkan bahasa en-US dan unit IMPERIAL.
Metode ComputeRouteMatrix ditetapkan secara default ke bahasa 'en-US' dan unit METRIC.
Untuk meminta nilai yang dilokalkan
Untuk menyertakan nilai yang dilokalkan dalam respons, Anda perlu melakukan hal berikut:
Minta nilai yang dilokalkan di mask kolom Anda. Contoh:
REST
-H X-Goog-FieldMask: localizedValues
RPC
const(fieldMask="localizedValues")
Jika Anda menginginkan nilai yang dilokalkan dalam bahasa atau sistem unit tertentu, tentukan kode bahasa dan sistem unit:
[null,null,["Terakhir diperbarui pada 2025-06-20 UTC."],[],[],null,["# Request localized values\n\n**European Economic Area (EEA) developers** If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](/maps/comms/eea/faq).\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nLocalized response values are an additional response field that provides\nlocalized text for returned parameter values. Localized text is provided for\ntrip duration, distance, and unit system (metric or imperial). You request\nlocalized values using a field mask, and can either specify the language and\nunit system or use the values inferred by the API. For details, see\n[LocalizedValues](/maps/documentation/routes/reference/rest/v2/TopLevel/computeRoutes#routelegsteplocalizedvalues).\n\nFor example, if you specify a language code for German (de) and imperial\nunits, you get a value for `distanceMeters` of 49889.7,\nbut also localized text providing that distance measurement in German and\nimperial units, so \"31 Meile.\"\n\nHere is an example of what you would see for localized values: \n\n```restructuredtext\n{ \"localized_values\":\n {\n \"distance\": { \"text\": \"31,0 Meile/n\" },\n \"duration\": { \"text\": 38 Minuten}.\n \"static_duration\": { \"text\": 36 Minuten}.\n }\n}\n```\n| Note: You get two values for the expected duration: `duration` uses the traffic model you specify, and `static_duration` does not take traffic into account. So, if your requested traffic model is `TRAFFIC_UNAWARE` these times are identical.\n\nIf you don't specify the language or unit system, the API infers the language\nand units as follows:\n\n- The `ComputeRoutes` method infers the location and distance units from the origin waypoint. So for a routing request in the US, the API infers `en-US` language and `IMPERIAL` units.\n- The `ComputeRouteMatrix` method defaults to 'en-US' language and METRIC units.\n\nTo request localized values\n---------------------------\n\nTo include localized values in the response, you need to do the following:\n\n1. Request localized values in your field mask. For example:\n\n **REST** \n\n ```restructuredtext\n -H X-Goog-FieldMask: localizedValues\n ```\n\n **RPC** \n\n ```gdscript\n const (fieldMask = \"localizedValues\")\n ```\n2. If you want the localized values in a specific language or unit system,\n specify the language code and unit system:\n\n ```console\n \"languageCode\": \"language_code\",\n \"units\": \"METRIC | IMPERIAL\",\n ```\n\n For example, this code snippet specifies the language as German (de), and\n METRIC units: \n\n ```console\n \"languageCode\": \"de\",\n \"units\": \"METRIC\",\n ```\n\n For more information, see\n [Language Support](/maps/faq#languagesupport)."]]