Repository navigation
Conversation
When babel sets up a language from its .ini file (\babelprovide[import]
or provide=*) and the hyphenation patterns are not installed, it
silently falls back to the current \language with only an Info line, so
check_babel() had nothing to match.
detect_babel_fallback() pairs the 'Importing data' and 'Hyphen rules'
Info lines for the same locale, and flags a fallback when the target
differs from the hyphenation language the locale's .ini file expects,
modulo language.dat synonyms. The expected patterns are resolved from
the imported .ini file name (.babel_hyphen_codes), so custom locale
names (\babelprovide[import=es]{myspanish}) are covered, with
.babel_hyphen_map (name.babel aliases -> hyphenrules) as fallback for
.ini files without a hyphenrules value. Both maps, plus
.hyphen_synonyms, are generated by tools/update-hyphen.R.
|
While porting False positive for languages loaded from an
Missed detection with the basic level. babel 3.84 (checked in its Changing r1 = "^Package babel Info: Importing (basic )?data for '?([^' ]+)'? .*from babel-([-.A-Za-z0-9]+)[.]ini.*$"With it, the |
Follow-up to #516 and #517. When babel sets up a language from its
.inifile (\babelprovide[import]{spanish}, or theprovide=*package option) and the hyphenation patterns are not installed, it silently falls back to the current\languagewith only an Info line in the log, socheck_babel()had nothing to match and the document compiled with the patterns of the wrong language (usually English).Detection
The
Hyphen rules for 'X' set to ...Info line cannot be matched on its own: it also appears for the dialects defined inenglish.ldf(canadian, australian, ...), and when the patterns were found under another name (e.g.austrianset to\l@ngerman-x-2024-02-28).detect_babel_fallback()pairs theImporting data for 'X' from babel-<code>.iniline with theHyphen rulesline for the same locale (theenglish.ldfdialects have noImportingline), and flags a fallback when the target ofset todiffers from the hyphenation language the locale's.inifile expects, modulolanguage.datsynonyms. A target of\l@nil(no hyphenation) is a fallback too, when the locale expects patterns.The expected language is resolved from the imported
.inifile name rather than the locale name, so custom locale names are covered (\babelprovide[import=es]{myspanish}). For.inifiles without ahyphenrulesvalue, the locale name itself is the expected pattern when it is alanguage.datname (e.g. swissgerman), and no patterns are expected otherwise (e.g. chinese).Generated maps
tools/update-hyphen.Rnow writes three more maps next to.hyphen_map, following the same snapshot pattern as #517:.hyphen_synonyms:language.datsynonyms to canonical names, from thesynonyms=field ofexecute AddHyphen(e.g.ngerman-x-latesttongerman-x-2024-02-28).babel_hyphen_map: babel locale names to the expected hyphenation language, from thename.babelaliases andhyphenrulesvalues of thebabel-*.inifiles.babel_hyphen_codes:babel-*.inibase names (as written in the log) to theirhyphenrulesvalue, for custom locale namesThe babel maps are read from the
babel-*.inifiles of the local TeX installation. Ahyphenrulesvalue that is not alanguage.datname is ignored (e.g.assasemein babel-as.ini), so a missing package that does not exist is never installed.The tests use real lualatex logs (babel v26.13, TeX Live 2026) and don't need the network; the CI test checks that
lualatex()installs hyphen-spanish for a document with\babelprovide[import]{spanish}.Export for quarto-cli
quarto-dev/quarto-cli#15082 ports this detection to quarto-cli, which follows tinytex's tables through the
regex.tar.gzrelease asset. The three maps are exported as a newbabel-hyphen.jsonnext toregex.jsonandhyphen.json(fromtools/export-regex.R). A separate file rather than new keys inhyphen.json, because quarto-cli copieshyphen.jsoninto a flat map whose values are all TeX Live package names; the existinghyphen.jsonexport is unchanged.This is #520 reopened from the upstream branch, with the
babel-hyphen.jsonexport from #521 merged in.Fixes #519