Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with obsolete string #8

Open
maduin75 opened this issue Apr 17, 2020 · 2 comments
Open

Issue with obsolete string #8

maduin75 opened this issue Apr 17, 2020 · 2 comments

Comments

@maduin75
Copy link

maduin75 commented Apr 17, 2020

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.

@adams85
Copy link
Owner

adams85 commented Apr 18, 2020

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.

@maduin75
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants