electricbookworks / electric-book

A Jekyll template for creating books in multiple formats
https://electricbookworks.github.io/electric-book
GNU General Public License v3.0
117 stars 45 forks source link

Translations inherit parent-language hyphenation dictionary #290

Closed arthurattwell closed 6 years ago

arthurattwell commented 6 years ago

At the moment, if a translation uses its parent language's stylesheet (which is always preferable), it inherits that parent language's hyphenation settings. If the parent language specifies a custom hyphenation dictionary, this is a problem. For instance, a French translation would inherit a custom hyphenation dictionary for English.

The workaround is to override the hyphenation dictionary in custom CSS:

:lang(fr) {
    p, ul, ol, dl {
        prince-hyphenate-patterns: url("hyph-fr.pat");
    }
}

In the above snippet, we've overridden any custom dictionary defined in the sass partials.

(You can find the dictionary itself by following PrinceXML guidance, and downloading the pattern file from tug.ctan.org/tex-archive/language/hyph-utf8/tex/generic/hyph-utf8/patterns/txt/. Save the pattern file in styles alongside your book's print-pdf.scss etc.)

We shouldn't have to do an workaround for every translation. It would be better to be able to specify a variable or setting, or even have language selection done automatically based on the page language somehow.

arthurattwell commented 6 years ago

Resolved in #298