Registry / devops / po-catalog-loader

po-catalog-loader

JSON →
library2.1.0jsnpmunverified

Webpack loader that converts GNU gettext PO files into JavaScript modules compatible with Jed and similar i18n libraries. Current stable version is 2.1.0, maintained as part of the Sentry ecosystem. The loader reads PO catalog files and exports them as JSON objects that can be consumed by runtime libraries. It has a peer dependency on gettext-parser and integrates seamlessly with webpack's module system. Compared to other i18n loaders, it is minimal and focused solely on PO file transformation.

npm install po-catalog-loader
INSTALL
IMPORT
SIG · PO-CATALOG-LOADER
P
po-catalog-loader
devopsjavascriptv2.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

po-catalog-loader (webpack loader)
import ... from 'po-catalog-loader'
const loader = require('po-catalog-loader')
In webpack config, use 'po-catalog-loader' as a rule loader string, not as a JavaScript module import.
Loader usage in webpack config
{ test: /\.po$/, use: 'po-catalog-loader' }
use: 'po-catalog-loader?param=value' (query params not used, loader uses options in webpack rule)
Configure via `options` object in webpack rule, not query string.
Configuration options
{ test: /\.po$/, use: { loader: 'po-catalog-loader', options: { /* ... */ } } }
require('po-catalog-loader').call(this, source) (not a function to call directly)
Loader options are passed via webpack's rule options, not via query parameters.

Demonstrates how to configure webpack to load .po files using po-catalog-loader and import them as JSON modules.

// webpack.config.js module.exports = { module: { rules: [ { test: /\.po$/, use: 'po-catalog-loader' } ] } }; // Then import your PO file: import catalog from './messages.po'; console.log(catalog); // => JSON object of translations
Debug
Known issues
gotchaThe loader exports a JSON object parsed by gettext-parser, not a function or Jed instance.
fix
Use the exported JSON directly with Jed or other libraries that expect the gettext-parser format.
affects: *
deprecatedThe loader does not support webpack 5's module federation or lazy loading out of the box.
fix
Consider using @formatjs/intl-gettext-loader or other modern alternatives for advanced webpack 5 features.
affects: >=2.0.0
breakingVersion 2.0.0 changed the output format to match gettext-parser's JSON schema, breaking compatibility with older consumers.
fix
Update your runtime code to handle the new JSON format (e.g., Jed expects the old format; you may need to transform the output).
affects: >=2.0.0
Errors
Common errors & fixes
Module not found: Error: Can't resolve 'gettext-parser'
Missing peer dependency gettext-parser
fix
npm install gettext-parser --save-dev
Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.module.rules[0].use should be a string, object, or array of strings/objects.
Incorrect loader configuration; 'use' expects a string or object, not null
fix
Use 'po-catalog-loader' as a string or { loader: 'po-catalog-loader' } in the rule.
Cannot find module 'po-catalog-loader'
Loader not installed
fix
npm install po-catalog-loader --save-dev
Upgrade
Version history
2.1.0latest on npm
Audit
Dependencies
gettext-parserrequiredPO file parsing
Agent activity
8 hits · last 30 days
node
6
Amazon
1
Bingbot
1
Resources
po-catalog-loader — npm install po-catalog-loader · libregistry