@eloqnt/cli

中文文档
0.7.1发布于 2026/11/12MITTypeScriptES Module近 30 天下载 27.8万

A linter for your translation files, with AI translation built in.

原始使用文档
文档目录5 节
  1. Setup
  2. 1. Install the CLI
  3. 2. Add a config file
  4. 3. Lint your source code and messages
  5. Start translating

@eloqnt/cli

eloqnt/cli is a linter for your translation files. It catches errors before they ship, and optionally fills in missing translations.

Documentation · Configuration


Start by linting your project for common problems:

$ eloqnt lint

messages/es.json
│
│  "kFvGpR": "Tienes mensajes nuevos"
│            ─┬──────────────────────
│             ╰─ Missing ICU argument: {count} (inconsistent-args)
│
│  "X0ha1a": "Save changes"
│            ─┬────────────
│             ╰─ Missing translation in es.json (missing-translation)

✗ 1 error
! 1 warning

→ Run `eloqnt translate` to fill in 1 missing translation

Linting runs static analysis on your source code and matches it against your messages, catching issues like unused messages, missing translations, broken ICU arguments, and more.

Setup

1. Install the CLI

Add the CLI as a local project dependency:

npm install @eloqnt/cli --save-dev

If you're in a monorepo, install it within local packages as needed.

2. Add a config file

Create a config file at .eloqnt/config.ts:

import {defineConfig} from '@eloqnt/cli';

export default defineConfig({
  // The folder containing your source code
  // (optional, only if you use next-intl)
  srcPath: './src',

  // Where and how you store your messages
  messages: {
    path: './messages',
    locales: 'infer',
    sourceLocale: 'en',
    format: 'json'
  }
});

All paths are relative to your project root. For more sophisticated setups like monorepos or when not using next-intl, see the configuration docs.

3. Lint your source code and messages

npx eloqnt lint

See eloqnt lint for details.

Start translating

Once linting works, you can optionally use eloqnt translate to fill in any missing translations:

$ eloqnt translate

✔  Context enrichment complete
✔  Styleguides loaded (global, es)
✔  Translated de, es via eloqnt/engine (hosted)
✔  Post-translation checks done

messages/
  de.json  2 translated
  es.json  2 translated

✔ Project fully translated

Source strings are enriched with context from their call sites, styleguides steer tone and terminology, and post-translation checks retry anything that comes back wrong.

To get started with translating, log into eloqnt/engine first.

版本与发布记录

@eloqnt/cli 共发布 60 个版本,首次发布于 2026/06/17;过去 12 个月发布了 60 个版本。

版本发布日期距今
0.7.1latest2026/11/121 天前
0.7.02026/11/103 天前
0.6.332026/09/281 个月前
0.6.322026/09/241 个月前
0.6.312026/09/221 个月前
0.6.302026/09/171 个月前

关于 @eloqnt/cli 的常见问题

@eloqnt/cli 是什么?

A linter for your translation files, with AI translation built in.

如何安装 @eloqnt/cli?

在项目目录运行 npm install @eloqnt/cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 eloqnt,可以用 npx eloqnt 直接运行。

@eloqnt/cli 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@eloqnt/cli 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@eloqnt/cli 可以商用吗?

@eloqnt/cli 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@eloqnt/cli 的下载量有多少?

根据 npm 官方下载统计,@eloqnt/cli 在 2026/10/14 – 2026/11/12 这 30 天内被下载 277,578 次,日均约 9,253 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@eloqnt/cli 还在维护吗?

最新版本 0.7.1 发布于 2026/11/12(1 天前);至今共发布 60 个版本,其中过去 12 个月发布了 60 个;首次发布于 2026/06/17。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。