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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@vzard/qtr

v0.1.3

Published

A tiny, fast translation tool for the terminal.

Readme

qtr(quick translation) - A tiny, fast translation tool for the terminal.

   ____  __      ____
  / __ \/ /_  __/ __ \
 / / / / / / / / /_/ /
/ /_/ / / /_/ / _, _/
\___\_\/_\__,_/_/ |_|

核心特点:输入即翻译、界面美观、引擎可扩展、配置可持久化。

安装(npm)

需要 Node.js >= 20。

已发布到 npm:@vzard/qtr

npm i -g @vzard/qtr
qtr --help
qtr

本地开发方式

git clone https://github.com/vzardlloo/qtr.git
cd qtr
npm i

# 直接跑 TS 源码(开发调试)
npm run dev

# 构建产物并本地全局链接(更接近真实安装效果)
npm run build
npm link
qtr

配置

首次运行会自动创建配置文件:

  • ~/.qtr-config.json(兼容旧文件 ~/.translator-config.json

你也可以手动初始化:

qtr config:init

也可以用交互式向导设置各引擎的 appKey/appSecret 等凭证:

qtr config:setup

# 向导内会展示各引擎申请地址,也可按 o 尝试打开浏览器

配置文件示例:

{
  "currentEngine": "baidu",
  "engines": {
    "baidu": {
      "appId": "YOUR_APP_ID",
      "appSecret": "YOUR_APP_SECRET"
    },
    "youdao": {
      "appKey": "YOUR_APP_KEY",
      "appSecret": "YOUR_APP_SECRET"
    },
    "tencent": {
      "secretId": "YOUR_SECRET_ID",
      "secretKey": "YOUR_SECRET_KEY",
      "region": "ap-guangzhou"
    }
  }
}

API Key 申请方式

使用

交互模式(推荐)

qtr

默认:中文 -> 英文(from=zh, to=en)。

可选参数:

qtr --engine baidu --from zh --to en

交互快捷键:

如果检测到你尚未配置任何引擎,直接运行 qtr 会自动进入 config:setup 向导。

  • Tab:打开/关闭引擎选择面板(↑/↓ 选择,Enter 确认;也可直接输入首字母快速定位;若选择未配置引擎,会自动进入 config:setup
  • Ctrl+S:将当前引擎写入配置文件(下次默认使用)
  • Ctrl+L:清空输入
  • Ctrl+F:选择源语言(打开/关闭语言选择面板)
  • Ctrl+T:选择目标语言(打开/关闭语言选择面板)
  • Esc / Ctrl+C:退出

非交互模式(一次性翻译)

qtr translate "hello" --from en --to zh

配置命令

设置默认引擎:

qtr config:engine youdao

查看支持的引擎:

qtr engines

设计说明

  • src/engines/types.ts:定义引擎抽象接口,便于后续新增更多引擎。
  • src/config/config.ts:统一管理配置文件的读取/写入/初始化。
  • src/ui/*:Ink 交互界面组件。

常见问题

  1. 如果提示“engine not configured”,请检查 ~/.qtr-config.json(或旧文件 ~/.translator-config.json)中对应引擎的 key 是否填写。

  2. 频繁输入会触发多次翻译请求?

已做了 250ms 的 debounce,并使用 AbortController 中断旧请求,避免结果乱序。