-
-
Notifications
You must be signed in to change notification settings - Fork 433
Labels
Description
Description
PO file flags (like #, fuzzy or custom flags like #, myTag) are lost when running lingui extract again. The extra.flags field from the existing catalog is not preserved during the merge process.
The bug is in packages/cli/src/api/catalog/mergeCatalog.ts. When merging catalogs, the code takes rest from nextCatalog (extracted messages) which doesn't contain flags, and only preserves translation from prevCatalog. The extra.flags field is silently discarded.
Verifications
Reproduction Steps
1. Create a PO file with a flag
cat > messages.po << 'EOF'
msgid "Hello"
msgstr "Hallo"
#, myTag
EOF
2. Run extract
lingui extract
3. Check the PO file - the flag "#, myTag" is gone
Or programmatically:
import { mergeCatalog } from "@lingui/cli/api"
const prevCatalog = {
"Hello": {
translation: "Hallo",
extra: { flags: ["myTag"] }
}
}
const nextCatalog = {
"Hello": {
message: "Hello",
origin: [["src/app.ts", 1]]
}
}
const result = mergeCatalog(prevCatalog, nextCatalog, false, {})
console.log(result["Hello"].extra?.flags) // undefinedExpected Behavior
The flags should be preserved from the existing catalog when running extract. Flags are translator/tooling metadata that should persist across extractions, similar to how translation is preserved.
Macro Support
Not using macro
Lingui Version
5.8.0
Babel Version
@babel/core@7.28.3
Framework
Affects CLI command
Reactions are currently unavailable