English instead of local language for Geocoder

前端 未结 3 1700
迷失自我
迷失自我 2021-01-05 14:47

I am using Geocoder to get address from lan/lat coordinates. The problem is that the address is in local language (the street name usually). How can I set it to be only in E

3条回答
  •  逝去的感伤
    2021-01-05 15:15

    API 19
    The answer is not completely correct I think.
    I have just had that case, when I set the GeoCoder locale to English then I get wrong street names.
    It does not translate them but it removed language specific parts, that's a concern for me.

    "Straße" became "St" for example.

    The Google Maps HTTP Geocoder API is different in this regard, when I set an english language the streets are returned correctly just the tested country was translated (Austria instead of Österreich).

    As many people use the HTTP API as fallback in case the Geocoder fails this can be a problem, like in my case.
    My solution is to always use the locale of the country for BOTH APIs, then the results match.
    The HTTP API has a &language parameter which understands Local.toString() as value;
    The Geocoder can be initlized like in the original question shown.

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题