What’s new in babel 3.43
2020-04-28
Autoloading based on BCP 47 codes
The most relevant new feature is the loading on the
fly based on BCP 47 codes. It must be
activated explicitly with \babeladjust
, because it is meant for special tasks (most
document are mainly monolingual). Mapping from BCP 47 codes to locale
names are not hardcoded in babel
. Instead the data is taken from the
ini
files, which means currently about 250 275 tags are already recognized
\documentclass{article}
\usepackage[danish]{babel}
\babeladjust{ autoload.bcp47 = on }
\begin{document}
\today
\selectlanguage{fr-CA}
\today
\end{document}
Babel performs a simple lookup in the following way: fr-Latn-FR
→
fr-Latn
→ fr-FR
→ fr
. Languages with the same resolved name are
considered the same. Case is normalized before, so that fr-latn-fr
→
fr-Latn-FR
. If a tag and a name overlap, the tag takes precedence (for
example, lu
is considered lubakatanga
).
Currently the locales loaded are based on the ini
files and decoupled from the main ldf
files. This is by design, to ensure code generated externally produces the same result regardless of the languages requested in the document, but an option to use the ldf
instead will be added in a future release, because both options make sense depending on the particular needs of each document (there will be some restrictions, however).
The behaviour is adjusted with \babeladjust
with the following parameters:
autoload.bcp47
with valueson
andoff
.autoload.bcp47.options
, which are passed to\babelprovide
; empty by default, but you may addimport
(features defined in the correspondingbabel-...tex
file might not available).autoload.bcp47.prefix
. Although the public name used in selectors is the tag, the internal name will be different and generated by prepending a prefix, which by default isbcp47-
. You may change it with this key.
Fixes
- Babel reset the
\sfcode
of»
to 1000. Now it’s the default 0. \guillemotleft
and\guillemotleft
renamed to\guillemetleft
and\guillemetleft
(but old names preserved for backwards compatibility) (#63).- With autoloading the hyphenmins were set to the default values.
- With autoloading and counters an error could be raised in
pdftex
.
Changes in ini
locale files
- Assamese: Captions (#58, by Navanath Saharia)
- Finnish: Fixed
contents
(#61, by Teemu Likonen). - Marathi: A couple of corrections (from polyglossia #409, by NiranjanTambe), and
alphabetic
counter. - Bengali:
alphabetic
counter. - Luxembourgish: Much expanded (thanks by Sam Mersch).
- Armenian: Fixed counter names (see the news for 3.42).
Macros in \selectlanguage
Since its beginnings, an alternative syntax was allowed in the argument of \selectlanguage
, so that, say, \selectlanguage{\dutch}
is the same as \selectlanguage{dutch}
. Now, if the passed macro doesn’t match a loaded language, it’s treated as expected, that is, the string contained in the macro will be the name of the language to be selected. For example, the following piece of code will select dutch
\newcommand{\mylang}{dutch}
\selectlanguage{\mylang}
The alternative syntax is deprecated. not recommended (there will be an ‘info’ about this).
Reorganization of the internal code
This change may affect a few packages.
-
Some
babel
commands have been loaded with the LaTeX format for years, but most of them didn’t work without\usepackage{babel}
and raised some cryptic errors. Now in the format some of them have minimal definitions (\addlanguage
,\adddialect
,\iflanguage
,\providehyphenmins
) and others raise a more explanatory error (\selectlanguage
and other selectors). The macros in the format with minimal definitions behave as described in thebabel
manual, but without some additional internal actions added by and specific to thebabel
package (for example, it adds code for\AddBabelHook{..}{adddialect}{..}
to work). It should work without rebuilding the format, but it may be necessary in some cases. -
The files
switch.def
andplain.def
will eventually disappear. Their code has been merged intobabel.def
, but they are still present as proxy files loading the relevant parts now in the latter. -
Support for TeX <3 will be removed altogether. “Support” for LaTeX 2.09 will be removed, too, basically because it hasn’t worked for ages (with TeXLive 2003 already failed).