Skip to content

Saving accidentally removes obsolete Entry's previous_msgid #158

@planetis-m

Description

@planetis-m

Repro:

# File: a.py
import polib

po_filepath = 'test_po_file.po'
# Create a new PO file
po = polib.POFile()

# Add a fuzzy entry
fuzzy_entry = polib.POEntry(
  msgid='fuzzy_message',
  msgstr='ασαφής_εικόνα',
  previous_msgid='fuzzy_image',
  fuzzy=True,  # Mark as fuzzy
  obsolete=True  # Mark as obsolete
)
po.append(fuzzy_entry)

# Save the PO file
po.save(po_filepath)

The .po file's contents:

#
msgid ""
msgstr ""

#~| msgid "fuzzy_image"
#~ msgid "fuzzy_message"
#~ msgstr "ασαφής_εικόνα"
# file: b.py
import polib

po_filepath = 'test_po_file.po'

# Reopen the PO file
po = polib.pofile(po_filepath)
po.save(po_filepath)

After running b.py

#
msgid ""
msgstr ""

#~ msgid "fuzzy_message"
#~ msgstr "ασαφής_εικόνα"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions