@eloqnt/cli
eloqnt/cli是您翻译文件的插件。 它在他们出发前会发现错误, 并随意填写缺失的翻译.
开始为常见问题启动您的项目 :
$ 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在您的源代码上运行静态分析,并将其与您的消息相匹配,捕捉到未使用的消息等问题,缺少翻译,中断的ICU参数等等.
设置
1. 安装国家综合倡议
添加CLI作为本地项目依赖:
npm install @eloqnt/cli --save-dev
如果你在单体, 安装在本地的软件包中 需要.
2. 添加配置文件
创建配置文件 : .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'
}
});
所有路径都相对您的工程根 。 对于更复杂的设置,如单体或当不使用 next-intl,参见 配置文件。 。 。 .
3. 编辑您的源代码和信件
npx eloqnt lint
见 eloqnt lint 详细情况.
开始翻译
一旦起伏,你可以选择使用 eloqnt translate 以填入任何缺失的翻译:
$ 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
源字符串根据调用网站的背景而丰富, 样式引导 引导语气和术语, 和翻译后检查 重试任何回到错误.
为了开始翻译, 登录到eloqnt/引擎 先说.