npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

youdao-cli-translator

v1.0.6

Published

一个Node.js命令行工具,用于实现中英互译

Downloads

5

Readme

youdao-cli-translator

CircleCI

一个Node.js命令行工具,用于实现中英互译!

使用须知

该工具的翻译API是基于有道智云的文本翻译服务,所以使用前,你自己需要先在有道智云上新建一个应用(参考该文档的最后部分),获取到应用的ID和KEY,之后,只要将YOUDAO_APP_IDYOUDAO_APP_KEY两个环境变量添加到操作系统中即可。

对于macOS或Linux

可以在.bashrc或者.zshrc中追加以下两条export语句。

export YOUDAO_APP_ID=应用的ID
export YOUDAO_APP_KEY=应用的KEY

对于Window

可以按windows键,在弹出的搜索框中,输入env,点击搜索结果中的Edit the system environment variables,再点击弹出框底部的Environment variables,这时会进入环境变量的编辑对话框,上半部份是当前用户的环境变量,下半部分是所有用户共享的环境变量,这里选择添加到当前用户的环境变量即可,所以点击上半部份的New按钮,创建一个新的环境变量。YOUDAO_APP_ID和YOUDAO_APP_KEY这两个环境变量都创建好后,确保点击Ok按钮,以便将所有修改都被保留。最后新打开一个Cmd的窗口输入t hello查看测试结果。

PS.有道智云会为每位新用户提供100元的免费额度,如果是用于个人日常翻译的话,100元我想可以用一辈子了,我自己用了1年多,目前为止只被扣掉了5毛钱。

安装

npm i -g youdao-cli-translator

使用方法

使用前,请先确保已经配置好YOUDAO_APP_ID和YOUDAO_APP_KEY这两个环境变量!

安装之后,会产生一个全局的命令t,只需要在t后面加上想要翻译的单词即可:

t hello
t 你好

如果是一个句子,需要用引号括起来:

t 'how are you'

在有道智云上新建一个应用

  1. 打开:https://ai.youdao.com/login.s ,用手机或微信号完成登录。
  2. 进入控制台后,在左侧应用管理中点击菜单项:我的应用
  3. 点击“创建应用”。
  4. 填写"应用名称"和"接入方式", "接入方式"一定要选择“API”。
  5. 接着会跳到“应用信息预览”页面,点击“绑定服务”,勾选“自然语言翻译服务-文本翻译”。
  6. 创建成功后,即可在应用详情中获取到应用的ID和KEY了。