@floatwork/grunt-po2mo

中文文档
0.4.1发布于 2023/06/01MITCommonJS零依赖近 30 天下载 5827

Compiles .po files into binary .mo files with msgfmt

原始使用文档
文档目录9 节
  1. Prerequisites
  2. macOS
  3. Linux
  4. Windows
  5. Installation
  6. Usage
  7. Options
  8. Authors
  9. License

grunt-po2mo

Compiles .po files into binary .mo files with msgfmt

npm npm CI

This plugin is largely based on Michele Bertoli's grunt-po2mo, with some minor differences:

  • uses no third-party dependencies
  • supports additional options
  • code base is linted with eslint

Prerequisites

You will need msgfmt installed in order for this task to work

macOS

# Homebrew
$ brew install gettext
$ brew link --force gettext

# MacPorts
$ sudo port install gettext

Linux

# Debian
$ sudo apt-get install gettext

# Fedora
$ dnf install gettext-devel

Windows

$ scoop bucket add main
$ scoop install main/gettext

Installation

$ npm install @floatwork/grunt-po2mo --save-dev

Usage

grunt.loadNpmTasks('@floatwork/grunt-po2mo');

grunt.initConfig({
    po2mo: {
        files: {
            src: 'languages/de_AT.po',
            dest: 'languages/de_AT.mo',
        }
    }
});

grunt.registerTask('default', ['po2mo']);

Options

options.alignment

Type: int
Default: 1

Align strings to NUMBER bytes

options.checkAccelerators

Type: string|null
Default: null

Check presence of keyboard accelerators for menu items

options.checkCompatibility

Type: bool
Default: false

Check that GNU msgfmt behaves like X/Open msgfmt

options.checkDomain

Type: bool
Default: false

Check for conflicts between domain directives and the --output-file option

options.checkFormat

Type: bool
Default: false

Check language dependent format strings

options.checkHeader

Type: bool
Default: false

Verify presence and contents of the header entry

options.endianness

Type: string|null
Default: null

Write out 32-bit numbers in the given byte order (big or little, default depends on platform)

options.noHash

Type: bool
Default: false

Binary file will not include the hash table

options.useFuzzy

Type: bool
Default: false.

Use fuzzy entries in output

options.deleteSrc

Type: bool
Default: false

Will delete the source .po file after conversion

Authors

License

This work is licensed under The MIT License

版本与发布记录

@floatwork/grunt-po2mo 共发布 4 个版本,首次发布于 2019/07/16;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.4.1latest2023/06/013 年前
0.4.02022/08/044 年前
0.3.12022/08/044 年前
0.3.02019/07/167 年前

关于 @floatwork/grunt-po2mo 的常见问题

@floatwork/grunt-po2mo 是什么?

Compiles .po files into binary .mo files with msgfmt

如何安装 @floatwork/grunt-po2mo?

在项目目录运行 npm install @floatwork/grunt-po2mo,或使用 pnpm add / yarn add / bun add。

@floatwork/grunt-po2mo 支持 TypeScript 吗?

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

@floatwork/grunt-po2mo 支持 ESM 还是 CommonJS?

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

@floatwork/grunt-po2mo 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=14.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@floatwork/grunt-po2mo 可以商用吗?

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

@floatwork/grunt-po2mo 的下载量有多少?

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

@floatwork/grunt-po2mo 还在维护吗?

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