-
Notifications
You must be signed in to change notification settings - Fork 44
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
Tolerate additional entries in obsolete messages #79
Comments
Thank you for reporting this! After some initial investigation any additional character after an obsolete marker ( |
@KapitanOczywisty would you be able to have a look at this? |
@smhg Yes, they can, by using |
@KapitanOczywisty If I understand correctly |
I only found that: https://github.com/winlibs/gettext/blob/24b0fe071cff79acf4a3904591b481328732ddc1/source/gettext-tools/src/po-lex.c#L903-L906
I thinks parsing ignores whitespace and searches for msgid keyword. I can make this work wit
|
I believe the simplest, non-surprising behavior would be to treat as a regular comment, if that makes sense with regards to the way gettext-parser currently works. |
Basically But looking a the code, this does not look straighforward. |
At the time I was not aware of |
In my suggestion, this file:
after parse would become:
and then after compilation:
|
Versions above this break with doubly escaped comments such as #~| which weblate uses with fuzzy matching. smhg/gettext-parser#79
Versions above this break with doubly escaped comments such as #~| which weblate uses with fuzzy matching. smhg/gettext-parser#79
Versions above this break with doubly escaped comments such as #~| which weblate uses with fuzzy matching. smhg/gettext-parser#79
Versions above this break with doubly escaped comments such as #~| which weblate uses with fuzzy matching. smhg/gettext-parser#79
Versions above this break with doubly escaped comments such as #~| which weblate uses with fuzzy matching. smhg/gettext-parser#79
Versions above this break with doubly escaped comments such as #~| which weblate uses with fuzzy matching. smhg/gettext-parser#79
I have a .po file whose translations are handled with
Poedit
and I get obsolete entries in my.po
files. The parser fails when it encounters them.Reproduction
en.po
Parsing the content of
en.po
withgettext-parser
(runninggettextParser.po.parse(content)
) produces the following error:node_modules\gettext-parser\lib\poparser.js:224 throw err; ^ SyntaxError: Error parsing PO data: Invalid key name "|" at line 2. This can be caused by an unescaped quote character in a msgid or msgstr value.
Expected behavior
The parser should not crash. It should either ignore the entry, or properly parse it to data.
Misc
I believe this issue was introduced by the following PR: #64 -- released in version 5.0.0. 4.2.0 is the last version before 5.0.0.
Have a good day !
The text was updated successfully, but these errors were encountered: