Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
6 posts
|
Hi all,
I would like to localize "Table of Contents", "List of Figures", "Figure 1.1", ... in asciidoctor-fopub. I would like to use Japanese words instead. Could you tell me how to do it? Best regards, Hiroaki |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
6 posts
|
I searched and found some info about DocBook localization.
* https://www.debian.org/doc/manuals/sgml-howto/x165.html * "Localization (l10n) of the output" section * http://www.kosek.cz/xml/dboscon/ucel/foil07.html DocBook-xsl * http://docbook.sourceforge.net/ * DocBook releases / docbook-xls * http://www.linuxfromscratch.org/blfs/view/svn/pst/docbook-xsl.html XSL DocBook Stylesheet for Japanese http://docbook.sourceforge.net/release/xsl/current/common/ja.xml Now what to do to use this stylesheet in asciidoctor-fopub? Best regards, Hiroaki |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
6 posts
|
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 |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
2681 posts
|
You can control the value of the lang attribute on the root element of the DocBook output by setting the lang attribute when running Asciidoctor: $ asciidoctor -a lang=ja -b docbook -d book source.adoc The XML will begin as: <book xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:lang="ja"> Note that the lang doesn't do anything other than set this attribute at the moment. FYI, for a discussion about localizing the output from the HTML5 backend, see this thread: http://discuss.asciidoctor.org/Non-English-translations-for-captions-toc-etc-lang-XY-conf-in-Asciidoc-td1724.html Cheers, -Dan On Tue, Nov 4, 2014 at 9:48 PM, hnakamur [via Asciidoctor :: Discussion] <[hidden email]> wrote: Hi, I found a way to do it manually. ... [show rest of quote] Dan Allen | http://google.com/profiles/dan.j.allen |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
6 posts
|
Hi Dan,
Thanks for your info! Before seeing you reply, I wrote a ruby code to modify the `xml:lang` attribute, which becomes unnecessary now. My rule in Rakefile now becomes: ---- rule '.pdf' => '.adoc' do |t| dirname = File.dirname t.source basename = File.basename t.source, '.adoc' xml_file = "#{dirname}/#{basename}.xml" unless File.directory? "./asciidoctor-fopub" sh "git clone https://github.com/asciidoctor/asciidoctor-fopub" end sh %Q{ bundle exec asciidoctor -a lang=ja -b docbook -d book \ -r asciidoctor-diagram -r asciidoctor-diagram-cacoo #{t.source} && \ ./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 && \ open #{t.name} } end ---- Thanks again for your help! Hiroaki |
Free forum by Nabble | Edit this page |