[英]Setting Language of API in NodeJS
I am trying to implement the DuckDuckGo Instant Answer Api into my NodeJS application. 我正在尝试在我的NodeJS应用程序中实现DuckDuckGo Instant Answer Api 。 For that I request data from the Api using Node Request.
为此,我使用Node Request从Api请求数据。
var request = require('request');
request('http://api.duckduckgo.com/?q=Hamburg&format=json&pretty=1', function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(JSON.parse(body));
}
})
This gives me the result in English, but I would like to have it in German. 这给了我英语的结果,但是我想用德语。 In my browser it is in German.
在我的浏览器中,它是德语。 How can I change my code so I can get the data in German in NodeJS?
如何更改代码,以便可以在NodeJS中获取德语数据?
Thank you! 谢谢!
You can add the kad
key with a proper locale. 您可以使用适当的语言环境添加
kad
密钥。
As so: 因此:
http://api.duckduckgo.com/?q=Hamburg&format=json&pretty=1&kad=de_DE http://api.duckduckgo.com/?q=Hamburg&format=json&pretty=1&kad=de_DE
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.