@fleetbase/intl-lint

中文文档
0.0.1发布于 2024/01/24ISCCommonJS近 30 天下载 3275

Internationalization translation file linter script for Fleetbase Extensions and Application

原始使用文档
文档目录7 节
  1. Description
  2. Features
  3. Installation
  4. Usage
  5. Authors
  6. Contact
  7. License

@fleetbase/intl-lint

Description

@fleetbase/intl-lint is a Node.js script designed for Ember projects, aimed at validating internationalization (i18n) keys. The script checks that all i18n keys used in JavaScript and Handlebars files of an Ember project are defined in the specified YAML translation file. This validation helps ensure that there are no missing translations in the application, thereby preventing runtime errors and improving the overall quality of internationalization efforts.

Features

  • Recursively processes JavaScript (.js) and Handlebars (.hbs) files in the specified Ember project directory.
  • Extracts translation keys using tailored regular expressions.
  • Checks if each extracted key exists in the specified YAML translation file.
  • Logs missing translation keys and optionally throws an error.
  • Silent mode to suppress error throwing and complete the script execution even if missing keys are found.

Installation

To install @fleetbase/intl-lint, run the following command:

npm install @fleetbase/intl-lint

Or, if you are using pnpm, you can install it using:

pnpm add @fleetbase/intl-lint

Usage

Once installed, @fleetbase/intl-lint can be run directly from the command line or used as a Node.js module.

Command Line Interface

Run the script in your project's root directory:

fleetbase-intl-lint --path "./path-to-ember-project" --translation-path "./path-to-translation.yaml"

Optional flags:

  • --silent or -s: Runs the script in silent mode. The script will not throw an error if missing translation keys are found.
  • --path or -p: Specifies the path to the Ember project. Default is ./app.
  • --translation-path: Specifies the path to the YAML translation file. Default is ./translations/en-us.yaml.

As a Node.js Module

You can also require @fleetbase/intl-lint in your Node.js script and use it programmatically:

const lint = require('@fleetbase/intl-lint');

lint({
    silent: true, // or false
    path: './path-to-ember-project',
    translationPath: './path-to-translation.yaml',
});

Authors

Contact

For issues or questions regarding @fleetbase/intl-lint, feel free to contact the authors or raise an issue on the project repository.

License

@fleetbase/intl-lint is open-source and distributed under the MIT license. See the LICENSE file in the repository for full license text.

版本与发布记录

@fleetbase/intl-lint 共发布 1 个版本,首次发布于 2024/01/24;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.0.1latest2024/01/242 年前

关于 @fleetbase/intl-lint 的常见问题

@fleetbase/intl-lint 是什么?

Internationalization translation file linter script for Fleetbase Extensions and Application

如何安装 @fleetbase/intl-lint?

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

@fleetbase/intl-lint 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/fleetbase__intl-lint 是否存在。

@fleetbase/intl-lint 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@fleetbase/intl-lint 可以商用吗?

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

@fleetbase/intl-lint 的下载量有多少?

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

@fleetbase/intl-lint 还在维护吗?

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