mquinson / po4a

Maintain the translations of your documentation with ease (PO for anything)
http://po4a.org/
GNU General Public License v2.0
127 stars 62 forks source link

Asciidoc formatting destroyed on using + #410

Closed suddenfall closed 11 months ago

suddenfall commented 1 year ago

The asciidoc formatting will be destroyed if you use a plus sign at the end of a line. I put a simple example in the zip file that causes this error.

bug.zip

jnavila commented 1 year ago

I do not understand your issue. The asciidoc produced by the translation is correct. The "+" sign at the end of line is detected as a break and translated into a carriage return in the po files. If you keep the formating in the translated po file, then the "+" sign is added back into the translated adoc.

suddenfall commented 1 year ago

Hm, that's strange. I can reproduce this bug with two versions:

  1. I used v0.69 the from Ubuntu repository.
  2. I cloned "master" from https://github.com/mquinson/po4a.git.

In both cases I got following result without an "+" for a po-file:

#. type: Plain text

#: accessories.adoc:4
#, no-wrap
msgid ""
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit.  Aenean commodo ligula eget dolor:\n"
"{url1}"
msgstr ""

#. type: Plain text
#: accessories.adoc:7
#, no-wrap
msgid ""
"Aenean massa.  Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus:\n"
"{url2}"
msgstr ""
jnavila commented 1 year ago

OK. This discussion #299 was about how to handle hard line breaks in asciidoc. Hard line breaks are neither inline formatting (they break the line!) nor block separators (the lines should be kept together), which make them a kind of special class. Yet, it is crucial to keep the line break and convey this formatting to the translators.

My take on this was to remove the specific asciidoc format (the '+' sign), keep all the lines in the same po segment, but mutate the segment to "no-wrap" meaning that now "\n" in the segment should be preserved. Thus, for the translator the segment is now some kind of verbatim text with the line breaks being preserved.

When generating the translated content, a "+" sign is added back before the carriage return character in order to get back the correct asciidoc's hard line break mark.