izimobil / polib

Pure python library to manipulate, create, modify gettext files (pot, po and mo files).
MIT License
100 stars 28 forks source link

POEntry eats escape characters #155

Open Zsar opened 1 month ago

Zsar commented 1 month ago

polib 1.2.0 on Python 3.7 installed via pip.

Expected: I can access the string contained in the .po file.

Sample C# source line: Catalog.GetString("A configuration profile with name \"{0}\" is already existing.")

Sample .po file entry for that line:

#, csharp-format
msgid "A configuration profile with name \"{0}\" is already existing."
msgstr "A configuration profile with name \"{0}\" already exists."

Content of POEntry.msgid: 'A configuration profile with name "{0}" is already existing.' Content of POEntry.msgstr: 'A configuration profile with name "{0}" already exists.'

The eaten characters are (through guesswork?) added back when saving the POFile, but this means writing out the content anywhere will not result in the original string.