0

from an asciidoc file containing:

[[ill-sketches-intro,Sketches]]
[NOTE,icon=texte-introduction.svg]
.Sketches
====
. <<img-Things-various>>
====

(...)

[[img-Things-various, Various things]]
.<<ill-sketches-intro,Sketches: >><<img-Things-various>>
[caption=""]
image::intro/07ThingsVarious.jpg[img-Things-various,180,100,float="left",align="center"]

Using po4a version 0.69.,

the generated *.pot file content is:

    #. type: Block title
    #: bookname.adoc.pp:343
    #, no-wrap
    msgid "<<ill-sketches-intro,Sketches: >><<img-Things-various>>"
    msgstr ""
    
    #. type: Positional ($1) AttributeList argument for macro 'image'
    #: bookname.adoc.pp:345
    #, no-wrap
    msgid "img-Things-various"
    msgstr ""
    
    #. type: Target for macro image
    #: bookname.adoc.pp:345
    #, no-wrap
    msgid "intro/07ThingsVarious.jpg"
    msgstr ""

    #. type: Block title
    #: bookname.adoc.pp:2469
    #: bookname.adoc.pp:2483
    #: bookname.adoc.pp:2492
    #: bookname.adoc.pp:2517
    #: bookname.adoc.pp:2545
    #: bookname.adoc.pp:2576
    #, no-wrap
    msgid "Sketches"
    msgstr ""

    #. type: delimited block =
    #: bookname.adoc.pp:2472
    msgid "<<img-Things-various>>"
    msgstr ""

Given the Locale::Po4a::AsciiDoc.3pm documentation available, I could declare in the source asciidoc my image macro for it not to be translated like this: //po4a: macro image[]

The po4a generated *.pot file now contains:

    #. type: Block title
    #: bookname.adoc.pp:343
    #, no-wrap
    msgid "<<ill-sketches-intro,Sketches: >><<img-Things-various>>"
    msgstr ""
    
    #. type: Block title
    #: bookname.adoc.pp:2469
    #: bookname.adoc.pp:2483
    #: bookname.adoc.pp:2492
    #: bookname.adoc.pp:2517
    #: bookname.adoc.pp:2545
    #: bookname.adoc.pp:2576
    #, no-wrap
    msgid "Sketches"
    msgstr ""

    #. type: delimited block =
    #: bookname.adoc.pp:2472
    msgid "<<img-Things-various>>"
    msgstr ""

But would you know how to make the *.po translation file:

  1. take in account "Various things" since only the reference key "img-Things-various" seems to be candidate for translation. ref: [[img-Things-various, Various things]]
  2. only take in account the string value ("Sketches: ")of <<ill-sketches-intro,Sketches: >>
  3. ignore key-only references like: <<img-Things-various>>

Simply said, how to exclude cross-references and anchors ids as well as custom-ids from the po4a generated *.po(t) translation file.

user1767316
  • 3,276
  • 3
  • 37
  • 46

0 Answers0