pofile-ts logo

pofile-ts

Parse, compile & transform PO files — 20× faster

Modern i18n toolkit with ICU compiler, native CLDR plurals, and format conversion.Zero dependencies. TypeScript-first. Built for Node 20+, Bun, and modern browsers.

Installation
$ npm install pofile-ts
Coveragenpm downloadsBundle SizeZero DependenciesESM & CJSNode 20+Bun compatible

Why pofile-ts?

Not just a parser — a complete i18n toolkit that's faster, smaller, and more modern than the alternatives

20× Faster Parsing

Hand-optimized with first-char dispatch and fast-paths. No regex soup — just raw performance for build tools and CI.

ICU Compiler

Compile ICU messages to JavaScript functions. 4× faster runtime than Lingui and FormatJS — no AST interpretation.

Native CLDR Plurals

Uses Intl.PluralRules for all 100+ locales. Zero CLDR data in bundle — the runtime provides it.

CSP-Safe

No eval(), no new Function(). Works in strict CSP environments, edge runtimes, and security-conscious apps.

Modern-First

Built for Node 20+, ESM-native, tree-shakeable. No legacy polyfills — clean, modern JavaScript.

Zero Dependencies

~11KB full, ~5KB tree-shaken. No transitive deps, no supply chain bloat. Just pofile-ts.

Extended Intl Formatters

Lists, relative times, display names, and durations. Native Intl APIs — zero bundle cost.

50+ Format Styles

Built-in styles like compact, percent, bytes, iso. Register custom Intl options. Dynamic currency at runtime.

Benchmarks

Measured on Apple M1 Ultra, Node.js 22. Relative performance is consistent across hardware.

PO Parsing

10K entries

pofile-ts209/s
gettext-parser28/s
pofile8/s

20× faster

PO Stringify

10K entries

pofile-ts256/s
pofile100/s
gettext-parser54/s

5× faster

ICU Parsing

Plurals, selects, tags

pofile-ts170k/s
@formatjs38k/s

5× faster

ICU Runtime

Compiled functions

pofile-ts815k/s
intl-messageformat247k/s
@lingui204k/s

4× faster

ICU Runtime compiles to native JavaScript with template literals — no AST walking at runtime.

Built For

Whether you're building tools or integrating with frameworks

Vite/Webpack Plugins

Parse and compile PO files at build time for zero runtime cost

TMS Pipelines

Crowdin, Lokalise, Phrase — sync and transform translations

CI/CD Validation

Validate plural forms, variables, and syntax in PRs

Custom Tooling

Low-level APIs for message extraction and code generation

Clean, Functional API

No classes, no side effects — just pure functions that do one thing well

parse-po.ts
import { parsePo } from "pofile-ts"

// Parse PO files
const po = parsePo(content)

// Full support:
// plurals, context,
// flags, comments
compile-icu.ts
import { compileIcu } from "pofile-ts"

// Compile ICU
const msg = compileIcu(
  '"{n, plural, ...}"'
)

msg({ n: 5 }) // "5 items"
intl-formats.ts
// Extended Intl
"{authors, list}"
→ Alice, Bob, and Charlie

"{days, ago, day}"
→ vor 2 Tagen

"{lang, name, language}"
→ Englisch

Drop-in replacement for pofile

Same API patterns as the popular pofile package, but 20× faster with modern TypeScript.
Check out the migration guide if you're coming from pofile or gettext-parser.

Maintained by Sebastian Software • MIT Licensed