mquinson / po4a

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

Asciidoctor/Table support #353

Closed dbaio closed 2 years ago

dbaio commented 2 years ago

At this moment seems po4a only supports simple Asciidoctor Tables.

Single example:

Source file. PO file.

po4a-gettextize \
        --format asciidoc \
        --option compat=asciidoctor \
        --option yfm_keys=title,part,description \
        --master "po4a-asciidoctor-table-single.adoc" \
        --master-charset "UTF-8" \
        --copyright-holder "The FreeBSD Project" \
        --package-name "FreeBSD Documentation" \
        --po "po4a-asciidoctor-table-single.po"

-->

#. type: Table
#: po4a-asciidoctor-table-single.adoc:15
#, no-wrap
msgid ""
"|Cell in column 1, header row |Cell in column 2, header row\n"
"\n"
"|Cell in column 1, row 2\n"
"|Cell in column 2, row 2\n"
"\n"
"|Cell in column 1, row 3\n"
"|Cell in column 2, row 3\n"
"\n"
"|Cell in column 1, row 4\n"
"|Cell in column 2, row 4\n"
msgstr ""

It combines all content into a single string, making it difficult to translate, especially when the table has much information.

Table with a operator (Advanced example) for the record:

Source file. PO file.

#. type: Table
#: po4a-asciidoctor-tables.adoc:21
#, no-wrap
msgid ""
"| Meaning\n"
"| Examples\n"
"\n"
"\n"
"|The names of commands.\n"
"|Use `ls -l` to list all files.\n"
"\n"
"|The names of files.\n"
"|Edit [.filename]#.login#.\n"
"\n"
"|On-screen computer output.\n"
"a|\n"
"\n"
msgstr ""

#. type: Table
#: po4a-asciidoctor-tables.adoc:30
msgid ""
"....  You have mail.  ....  |What the user types, contrasted with on-screen "
"computer output.  a|"
msgstr ""

#. type: Table
#: po4a-asciidoctor-tables.adoc:47
msgid ""
"....  % date +\"The time is %H:%M\" The time is 09:18 ....  |User and group "
"names.  |Only `root` can do this.  |Emphasis.  |The user _must_ do this.  "
"|Text that the user is expected to replace with the actual text.  |To search "
"for a keyword in the manual pages, type `man -k _keyword_` |Environment "
"variables.  |`$HOME` is set to the user's home directory."
msgstr ""

It's hard to translate when there is the a operator and chunk of code into the content. ...

https://docs.asciidoctor.org/asciidoc/latest/tables/format-column-content/ https://docs.asciidoctor.org/asciidoc/latest/tables/format-cell-content/#a-operator

jnavila commented 2 years ago

Try using the option tablecells of the asciidoc format:

po4a-gettextize \
        --format asciidoc \
        --option compat=asciidoctor \
        --option tablecells=1 \
        --option yfm_keys=title,part,description \
        --master "po4a-asciidoctor-table-single.adoc" \
        --master-charset "UTF-8" \
        --copyright-holder "The FreeBSD Project" \
        --package-name "FreeBSD Documentation" \
        --po "po4a-asciidoctor-table-single.po"
dbaio commented 2 years ago

Perfect, thanks for this info @jnavila. Not a bug; it's working fine with this option, the simple and the advanced example. My bad.