splitbrain / dokuwiki-plugin-dw2pdf

A fork of Luigi Micco's PDF export plugin for DokuWiki
http://www.dokuwiki.org/plugin:dw2pdf
55 stars 68 forks source link

Use document language to set hyphenation and CJK support #481

Closed splitbrain closed 1 year ago

splitbrain commented 1 year ago

This uses the globally defined language or the language reported by the translation plugin.

As suggested here: https://forum.dokuwiki.org/d/20915-dw2pdf-with-language-dependent-hyphenation

Klap-in commented 1 year ago

First reaction, DokuPDF is initialized with $ID of the page at that time. This works for single pages exported with dw2pdf plugin I guess, but for the Bookcreator I expect it uses the language of the page we're the book manager is. Also exporting namespaces is probably not yet covered? (not checked)

splitbrain commented 1 year ago

You're right, bookcreator and namespace exports are not covered here. However they weren't covered before either - $conf['lang'] was simply always used.

I'm not sure how to cover them at all since theoretically at least for bookcreator each page could have a different language...

splitbrain commented 1 year ago

@Klap-in any objections to merging this?

Klap-in commented 1 year ago

Sorry, bit busy, so not yet time for details. Is it doable to use, for example, the language of the first page added to the selection of a book, or the first page of an exported namespace? If I see it right, this DokuPdf is initiated in generatePDF() where you have already $this->list available.

The language of the bookmanager page is quite useless. The replacement function has that issue as well if i remember it right. If this works, we might consider this approach there as well.

splitbrain commented 1 year ago

Okay, I moved document language detection out of the DokuPDF class. I'm not super happy about the whole state of the action.php - too much going on all over the place (eg. it's not immeadiately apparant where $this->list even comes from). But that's definitely out of scope for this little fix.

splitbrain commented 1 year ago

@Klap-in is this good to merge or are there any further objections?