Login  Register

Re: localization of toc-title, figure-caption, ... in asciidoctor-fopub

Posted by hnakamur on Nov 05, 2014; 4:48am
URL: https://discuss.asciidoctor.org/localization-of-toc-title-figure-caption-in-asciidoctor-fopub-tp2417p2424.html

Hi, I found a way to do it manually.

=== setup

1.  Copy docbook-xsl directory.

----
cp -r asciidoctor-fopub/src/dist/docbook-xsl docbook-xls-ja
----

2. Download XSL DocBook Stylesheet for Japanese
    http://docbook.sourceforge.net/release/xsl/current/common/ja.xml
    and save it in the `docbook-xls-ja` directory.

=== steps to convert *.adoc to *.pdf

1. run asciidoctor

----
  basename = File.basename t.source, '.adoc'
  xml_file = "#{dirname}/#{basename}.xml"
  sh %Q{
    bundle exec asciidoctor -b docbook -d book \
      -r asciidoctor-diagram -r asciidoctor-diagram-cacoo #{t.source}
  }
----

2. manually edit `xml:lang` from "en" to "ja" in the `book` element in the generated xml file.

----
    <book xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en">
----

to

----
    <book xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:lang="ja">
----

3. run asciidoctor-fopub

----
  sh %Q{
    ./asciidoctor-fopub/fopub -t docbook-xsl-ja #{xml_file} \
      -param alignment left \
      -param body.font.family VL-PGothic-Regular \
      -param dingbat.font.family VL-PGothic-Regular \
      -param monospace.font.family VL-PGothic-Regular \
      -param sans.font.family VL-PGothic-Regular \
      -param title.font.family VL-PGothic-Regular
  }
----

=== request for feature

I would like to configure `xml:lang` value in the `book` element with `asciidoctor`.
Maybe a new option for configuring `xml:lang` is needed?

Best regards,
Hiroaki