Biblatex vs Bibtex – Differences Between langid and language Fields

biblatexbibliographiesbibtex

Could someone summarise the differences in the use of the langid field from language field in biblatex? Documentation to Gost package for bibtex says that langid is a synonym of language but has priority over it.

Best Answer

We have touched upon this subject before in Can I use a shortened “language” entry (language code) in my .bib file?, but let's make the distinction a bit more specific here.

The biblatex documentation says (on pp. 25-26)

langid field (identifier): The language id of the bibliography entry. The alias hyphenation is provided for backwards compatibility. The identifier must be a language name known to the babel/polyglossia packages. This information may be used to switch hyphenation patterns and localise strings in the bibliography. Note that the language names are case sensitive. The languages currently supported by this package are given in table 2. [...]

and (p. 20)

language list (key): The language(s) of the work. Languages may be specified literally or as localisation keys. If localisation keys are used, the prefix lang is omissible.

That means that the langid field holds the localisation you want to use for the entry in the bibliography (and citation depending on your language option setting), it affects hyphenation patterns as well as localisation strings (the exact effect depends on the settings of the language and autolang options). Because this is an internal directive for biblatex the information must be given in a form that TeX understands, you can use babel/polyglossia language identifiers and with Biber even BCP47 language codes.

If you want to prepare a multi-language bibliography, it is recommended to provide langid for all entries. Only with that information can LaTeX properly switch language environments and possibly fonts and encodings to avoid errors or unwanted output.

The language list on the other hand has no special internal meaning, it just holds the language you want to see printed in the bibliography as the language of the work (in the standard styles the language is printed directly after the title, by default the option clearlang suppresses output of languages that match the document language). biblatex offers some localisation support for this ("known" languages are listed in §4.9.2.18 Language Names), so you can either give the language "key" (russian, langrussian) in which case biblatex will translate the field for you, or you can give the content verbatim in case the language is not supported (Klingon).

As far as biblatex is concerned the two fields are completely independent. They do not influence each other. And you can have only one of the two fields filled, or both, or none – and the contents of the field need not be equivalent. You can, for example, have

@online{elk,
  author   = {Anne Elk},
  title    = {A Theory on Brontosauruses},
  url      = {http://www.example.edu/~elk/bronto.pdf},
  date     = {2016-01-01},
  language = {french and latin},
  langid   = {ngerman},
}

Which tells biblatex (mistakenly) to treat the work as German (new orthography) (langid = {ngerman}), hyphenation and localisation strings will be changed accordingly (depending on your language and autolang options). However, since we have language={french and latin} "French and Latin" will be printed as the language(s) of the work. It would of course make no sense to give two languages as langid, but it may very well be that you want to convey the information that a work is bilingual French and Latin.

In

\documentclass[ngerman,british]{article}
\usepackage{babel}
\usepackage{csquotes}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@online{elk,
  author   = {Anne Elk},
  title    = {A Theory on Brontosauruses},
  url      = {http://www.example.edu/~elk/bronto.pdf},
  date     = {2016-01-01},
  language = {french and latin},
  langid   = {ngerman},
}
\end{filecontents}
\usepackage[backend=biber,style=authoryear,autolang=other]{biblatex}
\addbibresource{\jobname.bib}

\begin{document}
  \nocite{elk}
  \printbibliography
\end{document}

we thus get

Elk, Anne (2016). A Theory on Brontosauruses. Französisch und Lateinisch. URL: http://www.example.edu/~elk/bronto.pdf.

Note that even though the main language of the document is british, the information that the work is in French and Latin ("französisch und lateinisch", language={french and latin}) is printed in German (langid={ngerman}).