Skip to content

A modern, focused library for reading and writing GNU gettext PO files. Hand-optimized for speed and seamless integration with translation platforms like Crowdin.

License

Notifications You must be signed in to change notification settings

sebastian-software/pofile-ts

Repository files navigation

pofile-ts

pofile-ts

Parse and serialize GNU gettext PO files

CI Coverage npm version npm downloads

A modern, focused library for reading and writing GNU gettext PO files. Hand-optimized for speed, runs everywhere.

Features

  • 📖 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

Installation

npm install pofile-ts

Quick Start

import { 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))

Documentation

For full documentation including API reference, i18n helpers, and migration guide:

📖 Documentation

Performance

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

Monorepo Structure

packages/pofile-ts/  # The library (published to npm)
apps/docs/           # Documentation site (Fumadocs)
benchmark/           # Performance benchmarks

Development

pnpm install
pnpm test           # Run tests
pnpm build          # Build library
pnpm docs:dev       # Start docs dev server

Credits

Modernized fork of pofile by Ruben Vermeersch. Maintained by Sebastian Software.

License

MIT

About

A modern, focused library for reading and writing GNU gettext PO files. Hand-optimized for speed and seamless integration with translation platforms like Crowdin.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 22

Languages