Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

翻译结果获取不到,Promise <pending> #1

Open
liuzongquan opened this issue Jun 9, 2017 · 1 comment
Open

翻译结果获取不到,Promise <pending> #1

liuzongquan opened this issue Jun 9, 2017 · 1 comment

Comments

@liuzongquan
Copy link

你好,我在使用translate-api的时候获取不到结果
image
这是我在安装完translate-api模块后在nodejs中的运行截图
请问这是为什么呢?

@yixianle
Copy link
Owner

translate.getText 返回的是一个promise对象,你要在它的then方法中获取返回的结果,如下:
translate.getText('hello world',{to: 'zh-CN'}).then(function(text){
console.log(text)
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants