Skip to content

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

@memo33

Description

@memo33

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions