Package Exports
- po-parser
- po-parser/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (po-parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
po-parser
Parses and serializes .po file content.
Zero-dependency. ~4kb minified.
Usage
Parse
import POParser from 'po-parser';
const content = `
msgid ""
msgstr ""
"POT-Creation-Date: 2025-10-27 16:00+0000\n"
#: src/Greeting.tsx
#. Greets the user
msgid "+YJVTi"
msgstr "Hey"
`;
const result = POParser.parse(content);Serialize
import POParser from 'po-parser';
const catalog = {
meta: {
'POT-Creation-Date': '2025-10-27 16:00+0000'
},
messages: [
{
id: '+YJVTi',
message: 'Hey',
description: 'Greets the user',
references: [{path: 'src/Greeting.tsx'}]
}
]
};
const result = POParser.serialize(catalog);Supported features
msgidandmsgstr(message entries)msgctxt(message context for namespacing)- References (
#:comments) - Extracted comments (
#.comments, used as descriptions) - Flag comments (
#,comments, e.g.#, fuzzy) - Metadata (from empty
msgid/msgstrentry at the beginning) - Single-line quoted strings
Unsupported features
- Translator comments (
#comments) - Previous string key comments (
#|comments) - Plural forms (
msgid_plural) - Multi-line strings