Open maduin75 opened 4 years ago
Hi!
The lib does not support obsolete strings at the moment. The implementation is based on these specs, which do not mention obsolete strings or the "#~" syntax.
So this is not a bug, you get the intended behavior. The parser looks for a msgctxt/msgid line and it analyzes and stores the comments found before those. It does not know how to deal with the unknown comment syntax, thus it skips it.
Unfortunately, this feature cannot simply be implemented by adding an Obsolete
member to POCommentKind
because comment blocks ending like this should be treated as a separate PO entry but marked as obsolete. This would involve changes to the model and the parser as well.
I'm open to include this feature into the lib so I'll leave the issue open. However, I'm quite busy currently so I cannot promise it will be done in the near future. If you need this feature ASAP, you may give it a try. If you do so, please add a reference to the PO docs which describes this feature (that is, upon which your work is based on) to your PR.
Hi,
I updated my comment. As you as said, my solution couldn't really work. I'm working on some tools for the translation tool in my company and they felt I should use a parser instead of parsing it myself. So I may try to include this feature at some point. Your solution is the most complete PO Gettext parser for c# I found so far where I edit and change the layout of the PO File.
Hi,
There seem to have an issue with obsolete string. For exemple, if I have an entry in the PO file that looks like this (note that the msg* string of the first block are marked as obsolete) :
#. Key: 4EC8E9094C30B300EE2B129090719D37
#. SourceLocation: /Game/UI/WBP_Events_Character_Menu.WBP_Events_Character_Menu_C:WidgetTree.TextBlock_107.Text
#: /Game/UI/WBP_Events_Character_Menu.WBP_Events_Character_Menu_C:WidgetTree.TextBlock_107.Text
#~ msgctxt ",4EC8E9094C30B300EE2B129090719D37"
#~ msgid "Character select"
#~ msgstr "Character select"
#. Key: 597E72D944E780B7A33242AEDE6FBB6C
#. SourceLocation: /Game/UI/WBP_Location_Menu.WBP_Location_Menu_C:ExecuteUbergraph_WBP_Location_Menu [Script Bytecode]
#: /Game/UI/WBP_Location_Menu.WBP_Location_Menu_C:ExecuteUbergraph_WBP_Location_Menu [Script Bytecode]
msgctxt ",597E72D944E780B7A33242AEDE6FBB6C"
msgid "Location : {Location}"
msgstr "Location : {Location}"
When I save back the file with the POGenerator, I get this result:
#. Key: 4EC8E9094C30B300EE2B129090719D37
#. SourceLocation: /Game/UI/WBP_Events_Character_Menu.WBP_Events_Character_Menu_C:WidgetTree.TextBlock_107.Text
#. Key: 597E72D944E780B7A33242AEDE6FBB6C
#. SourceLocation: /Game/UI/WBP_Location_Menu.WBP_Location_Menu_C:ExecuteUbergraph_WBP_Location_Menu [Script Bytecode]
#: /Game/UI/WBP_Events_Character_Menu.WBP_Events_Character_Menu_C:WidgetTree.TextBlock_107.Text
#: /Game/UI/WBP_Location_Menu.WBP_Location_Menu_C:ExecuteUbergraph_WBP_Location_Menu [Script Bytecode]
msgctxt ",597E72D944E780B7A33242AEDE6FBB6C"
msgid "Location : {Location}"
msgstr "Location : {Location}"
The two entries merged together and the msg* lines are lost. I've checked in the Catalog and the entry with the obsolete string is not there and merge with the next entry in the catalog.
Obsolete entries are described here. This tool is based on GNU Specification. http://pology.nedohodnik.net/doc/user/en_US/ch-poformat.html Section 2.5.3
For an entry to be obsolete, it should be preceded by #~ even the msg* line.