English
About this handbook

This handbook belongs to the Quartz plugin quartz-multilanguage. And it is built with it: the switcher at the top right comes from there.

This box, too, appears twice in the configuration — once per language.

1.3 – The six parts

One entry in the configuration, but six roles in the build. Knowing which runs when explains most of the plugin’s quirks by itself.

RoleWhenWhat it does
Transformerwhile processing each pagedetects the language, sets frontmatter.lang and fileData.multilanguage
Linkingafter all pages are readgroups translations with one another
Filterbefore renderingremoves languages that are not being published (chapter 8)
Emitterwhile writingcreates the redirect pages, the root index.html and static/multilanguage.json for the script
Componentwhile building the layoutrenders the switcher
Scriptin the browsernotices, remembered language choice, localized dates

Why the linking comes afterwards

A transformer only ever sees one page. Whether de/kaffee has an English version can only be said once every page has been read — which is why the grouping happens in a step of its own after that.

Something practical follows from it: a page removed from the build by a filter — a draft, an unlisted page — is not there for the linking either. The switcher then does not show it.

For the switcher that always holds, because it reads the list after every filter. For hreflang it depends on the order the filters run in among themselves — see the second box below.

Why order almost never matters

order sets the order of the transformers. For language detection it is almost irrelevant — it only needs the frontmatter, which note-properties (order 5) has long since read.

The one exception, for the transformer

rewriteCrossLanguageLinks reads the data-slug that crawl-links (order 60) leaves on every link while resolving it. The rewriting therefore has to run after crawl-links, and order: 65 does exactly that. Put the plugin earlier and you get no message — you get links that silently stay uncorrected. Anyone not using that option may leave the line out.

And a second one, for the filter

order applies to this plugin’s filter too, not only to its transformer — and that filter has two jobs: it removes languages that are not published and records every page it lets through in the list hreflang later draws from. Below 50, that is before remove-draft, it records drafts before they are removed; the hreflang of a published page then names an address that does not exist, and nobody sees it. Measured: at order: 40 the draft appears in hreflang, at order: 65 it does not. The switcher is unaffected.

The script

Three things happen only in the browser, because they concern the visitor rather than the page: the notices about translations (chapter 7), remembering the language choice and formatting the dates.

Everything else happens at build time. Without JavaScript the switcher, hreflang and the redirects keep working — only those three things do not.