Files
klz-cables.com/.pnpm-store/v10/files/47/23845eabe7ef853a40cf59108d3c059396b2b153ee02e1646e997f2979d26417933240c41095537962a623a05e9fcb3029cd150a1c2af3f0620e952e232c00
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

66 lines
1.2 KiB
Plaintext

# po-parser
Parses and serializes `.po` file content.
Zero-dependency. ~2kb minified & gzipped.
## Usage
### Parse
```typescript
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
```typescript
import POParser from 'po-parser';
const catalog = {
meta: {
'POT-Creation-Date': '2025-10-27 16:00+0000'
},
messages: [
{
msgid: '+YJVTi',
msgstr: 'Hey',
extractedComments: ['Greets the user'],
references: [{path: 'src/Greeting.tsx', line: 10}]
}
]
};
const result = POParser.serialize(catalog);
```
## Supported features
- `msgid` and `msgstr` (message entries)
- `msgctxt` (message context for namespacing)
- References (`#:` comments, with optional line numbers)
- Extracted comments (`#.` comments)
- Flag comments (`#,` comments, e.g. `#, fuzzy`)
- Metadata (from empty `msgid`/`msgstr` entry at the beginning)
- Single-line quoted strings
## Unsupported features
- Translator comments (`#` comments)
- Previous string key comments (`#|` comments)
- Plural forms (`msgid_plural`)
- Multi-line strings