Parse and serialize GNU gettext PO files
A modern, focused library for reading and writing GNU gettext PO files. Hand-optimized for speed, runs everywhere.
- 📖 Parse PO files from strings
- ✏️ Serialize PO files back to strings
- 🎯 Full PO support — headers, comments, flags, plurals, context
- 📦 Zero dependencies — browser-compatible
- 💎 TypeScript-first — full type definitions
- ⚡ 23× faster than alternatives
npm install pofile-tsimport { parsePo, stringifyPo } from "pofile-ts"
const po = parsePo(`
msgid "Hello"
msgstr "Hallo"
`)
console.log(po.items[0].msgid) // "Hello"
console.log(po.items[0].msgstr) // ["Hallo"]
console.log(stringifyPo(po))For full documentation including API reference, i18n helpers, and migration guide:
Benchmarked with 10,000 entries (~10% plurals):
| Library | Parsing | Serialization |
|---|---|---|
| pofile-ts | 211 ops/s | 255 ops/s |
| gettext-parser | 27 ops/s | 55 ops/s |
| pofile | 7 ops/s | 103 ops/s |
packages/pofile-ts/ # The library (published to npm)
apps/docs/ # Documentation site (Fumadocs)
benchmark/ # Performance benchmarks
pnpm install
pnpm test # Run tests
pnpm build # Build library
pnpm docs:dev # Start docs dev serverModernized fork of pofile by Ruben Vermeersch. Maintained by Sebastian Software.