Skip to content

Commit

Permalink
fix master translation API (#417)
Browse files Browse the repository at this point in the history
Fixes #416
  • Loading branch information
glyh authored Oct 26, 2024
1 parent 9832462 commit f1fa651
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions javsp/web/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ def translate(texts, engine: Union[
else:
return {'trans': texts}

return rtn

def baidu_translate(texts, app_id, api_key, to='zh'):
"""使用百度翻译文本(默认翻译为简体中文)"""
api_url = "https://api.fanyi.baidu.com/api/trans/vip/translate"
Expand Down

3 comments on commit f1fa651

@quzard
Copy link

@quzard quzard commented on f1fa651 Oct 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个代码没写好。
应该是

if rtn == {}:
    rtn['error'] = err_msg
return rtn

@glyh
Copy link
Collaborator Author

@glyh glyh commented on f1fa651 Oct 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我再修一下,感谢

@glyh
Copy link
Collaborator Author

@glyh glyh commented on f1fa651 Oct 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.