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

otherComments should be part of ctxComments of the following entry #25

Open
memo33 opened this issue Jan 25, 2023 · 0 comments
Open

otherComments should be part of ctxComments of the following entry #25

memo33 opened this issue Jan 25, 2023 · 0 comments

Comments

@memo33
Copy link

memo33 commented Jan 25, 2023

The trailing comments of an entry should really belong to the leading comments of the next entry.

import scaposer._
val Right(Seq(first, second)) = Parser.parse(raw"""
# comment
msgctxt "context1"
msgid "aaa"
msgstr "AAA"

#, fuzzy
msgctxt "context2"
msgid "bbb"
msgstr "BBB"
""")

scala> first.asInstanceOf[SingularTranslation].otherComments  // should be empty
res1: Seq[String] = List(#, fuzzy)

scala> second.asInstanceOf[SingularTranslation].ctxComments  // should be non-empty
res2: Seq[String] = List()

In this example, the comment containing the fuzzy flag is parsed as part of the first entry, but it would be expected to be part of the second entry. (As tools should ignore fuzzy translations, it is important that the comment is matched with the correct entry.)

If you accept pull requests, I'd be happy to look into sending a fix.

Tested with 1.11.1 using Scala 2.11.12.

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

No branches or pull requests

1 participant