ilib-lint-python-gnu
raw JSON → 2.0.4 verified Fri May 01 auth: no javascript
A plugin for ilib-lint that checks Python resources using the GNU gettext library. It parses PO files and validates printf-style substitution parameters (like %s, %d) in source and target strings, ensuring parameters match and are properly numbered for translation. Current stable version is 2.0.4, with patch releases under the ilib-mono monorepo. Integrates with ilib-loctool-po for heavy lifting. Designed for ESM environments with Node.js >=12.
Common errors
error ERR_REQUIRE_ESM: require() of ES Module .../node_modules/ilib-lint-python-gnu/index.js from ... not supported ↓
cause Using CommonJS require() on an ESM-only package.
fix
Switch to ESM: use import statements or set 'type': 'module' in package.json.
error Error: Cannot find module 'ilib-loctool-po' ↓
cause Missing peer dependency 'ilib-loctool-po'.
fix
Install the missing peer: npm install --save-dev ilib-loctool-po.
error Plugin 'python-gnu' not found in configuration ↓
cause Plugin name mismatch in ilib-lint-config.json.
fix
Ensure the plugin key in config is 'python-gnu' (not 'ilib-lint-python-gnu').
Warnings
gotcha Node.js >=12 required; ESM modules not supported in older Node versions. ↓
fix Upgrade Node.js to version 12 or later.
deprecated The plugin expects ilib-lint >=2.0.0; older ilib-lint versions may not be compatible. ↓
fix Use ilib-lint version 2.x or higher.
gotcha The dependency 'ilib-loctool-po' must be installed separately; it is not automatically included. ↓
fix Run 'npm install --save-dev ilib-loctool-po' alongside this package.
Install
npm install ilib-lint-python-gnu yarn add ilib-lint-python-gnu pnpm add ilib-lint-python-gnu Imports
- default wrong
const plugin = require('ilib-lint-python-gnu')correctimport plugin from 'ilib-lint-python-gnu' - PythonGnuPlugin
import { PythonGnuPlugin } from 'ilib-lint-python-gnu' - pythonGnuRules
import { pythonGnuRules } from 'ilib-lint-python-gnu'
Quickstart
// Install: npm install --save-dev ilib-lint-python-gnu
// ilib-lint-config.json
{
"plugins": ["python-gnu"],
"rulesets": {
"python-gnu": true
}
}
// Programmatic usage
import plugin from 'ilib-lint-python-gnu';
console.log('Plugin loaded:', plugin.name);
// Expected: Plugin loaded: python-gnu