-1

我不确定这是一个错误还是一些我不知道的预期行为,但即使使用该language参数,也会返回其他语言的结果。例如。:

https://autocomplete.geocoder.ls.hereapi.com/6.2/suggest.json?resultType=cities&language=en&apiKey=_API_KEY_&query=mess

最高的结果是:

{ 
  "label":"Messico",
  "language":"en",
  "countryCode":"MEX",
  "locationId":"NT_f0csxXUfj7Csl1d3kXH7yA",
  "address": {"country":"Messico"},
  "matchLevel":"country"
}

Messico 在意大利语中是墨西哥,或者:

https://autocomplete.geocoder.ls.hereapi.com/6.2/suggest.json?resultType=cities&language=en&apiKey=_API_KEY_&query=al

{
  "label":"Allemagne",
  "language":"en",
  "countryCode":"DEU",
  "locationId":"NT_sCRfuPPAnURShDKlGtXPTB",
  "address":{"country":"Allemagne"},
  "matchLevel":"country"
}

Allemagne 在法语中是德国。

除了参数中指定的语言或本地语言,当翻译不可用时,我不想显示带有任何其他语言标签的结果。我怎么做?

4

1 回答 1

-1

您应该使用参数值resultType=city 而不是下面的城市,然后您将看到响应的差异。

https://autocomplete.geocoder.ls.hereapi.com/6.2/suggest.json?apiKey={API_KEY}&query=mess&resultType=city&language=en

请参阅文档,那里没有城市。 https://developer.here.com/documentation/geocoder-autocomplete/dev_guide/topics/resource-suggest.html

于 2021-01-04T07:35:02.907 回答