问题描述
为了避免发出太多请求(每种语言需要一个),我想知道是否可以使用Google Places API一次检索多个翻译。
目前,我会做类似的事情:
const endpoint = 'https://maps.googleapis.com/maps/api/place/queryautocomplete/json';
const apiKey = 'your_api_key';
const languages = ['en','fr','nl'];
languages.forEach(languageCode => {
fetch(`${endpoint}?key=${apiKey}&language=${languageCode}&input=YourSearch`);
});
但是,这意味着我们最终会发送尽可能多的请求。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)