0

I am using BibLaTeX with the Biber backend for the bibliography of my PhD thesis, written in English.

The Harvard style that my university recommends, encourages the translation of titles and journal titles written in a foreign language.

To get correct hyphenation patterns, one would use the langid field to declare the foreign language. However, what about if I want to add the title translated in English? Is there a way to declare languages 'locally' in a clean manner?

An example of such an entry would be:

@article{doe2000,
  title     = {Die numerische Strömungsmechanik [Computational Fluid Dynamics]},
  author    = {J. Doe},
  booktitle = {Internationalen Mathematiker Kongresses [International Congress of Mathematics]},
  date      = {2000},
  langid    = {german} % but translated titles are in English
}
4
  • 1
    If you're adding the translation at the end of fields, you may as well wrap them in a \foreignlanguage call or some such to switch the language. (\foreignlanguage and other macros are problematic at the beginning of fields because of sorting, but the further back they appear the less likely they are to matter.) A conceptually nicer solution may use data annotations (one annotation would be the translation and a second annotation could be the language of the translation that would be used for \foreignlanguage). ... – moewe Sep 9 '20 at 7:28
  • ... I probably won't have time to look into that soon, but I shall see what I can do when I have more time. – moewe Sep 9 '20 at 7:29
  • I guess the planned multi-script version of biblatex would be of interest here. It is still under development and I don't think it is ready for an official release any time soon, you can find out more about it at github.com/plk/biblatex/issues/416 (there is a test version available). – moewe Sep 9 '20 at 7:30
  • Hi @moewe thanks for taking the time. It's a fine problem anyways, but If I understand the first comment well, I would remove the langid field to let biblatex know it's an english entry and just put \foreignlanguage{german}{..} at the end of the wanted fields? – circuitbreaker Sep 9 '20 at 8:30
1

The best input here will strongly depend on your your overall setup and the desired outcome.

Generally it is a bad idea to add too much markup commands to fields, as formatting should be up to the style and markup can be problematic for sorting. But here it seems not totally crazy to add some language switching markup at the end of the field (which is unlikely to matter for sorting).

\documentclass[german,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=authoryear, backend=biber, autolang=hyphen]{biblatex}


\begin{filecontents}{\jobname.bib}
@incollection{doe2000,
  title     = {Die numerische Strömungsmechanik
               \foreignlanguage{english}{[Computational Fluid Dynamics]}},
  author    = {J. Doe},
  booktitle = {Internationaler Mathematikerkongress
               \foreignlanguage{english}{[International Congress of Mathematicians]}},
  date      = {2000},
  langid    = {german},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}


\begin{document}
\cite{doe2000}
\printbibliography
\end{document}

Doe, J. (2000). “Die numerische Strömungsmechanik [Computational Fluid Dynamics]”. In: Internationaler Mathematikerkongress [International Congress of Mathematicians].

For a fully multilingual bibliography with the possibility to translate certain fields, you'll probably have to wait until the biblatex multiscript development branch makes it into the released version. See https://github.com/plk/biblatex/issues/416 for more details and an available test version.

In the meantime you can do some translating with field annotations.

\documentclass[ngerman,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=authoryear, backend=biber]{biblatex}

% expand the first argument of \foreignlanguage
% needs a modern TeX engine with \expanded primitive
\newcommand*{\foreignlanguageE}[1]{\foreignlanguage{\expanded{#1}}}

\newcommand*{\foreignlangbyannotation}[2][\currentfield]{%
  \hasfieldannotation[#1][lang]
    {\foreignlanguageE{\csuse{abx@annotation@literal@field@#1@lang}}{#2}}
    {#2}}

\newcommand*{\printtranslation}[1][\currentfield]{%
  \hasfieldannotation[#1][translation]
    {\addspace \mkbibbrackets{\getfieldannotation[#1][translation]}}
    {}}

\DeclareFieldFormat{title}{%
  \mkbibemph{%
    \foreignlangbyannotation[title]{#1}%
    \printtranslation[title]}}

\DeclareFieldFormat
  [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
  {title}{%
  \mkbibquote{%
    \foreignlangbyannotation[title]{#1}%
    \printtranslation[title]\isdot}}

\DeclareFieldFormat
  [suppbook,suppcollection,suppperiodical]
  {title}{%
    \foreignlangbyannotation[title]{#1}%
    \printtranslation[title]}

\DeclareFieldFormat{booktitle}{%
  \mkbibemph{%
    \foreignlangbyannotation[booktitle]{#1}%
    \printtranslation[booktitle]}}

\begin{filecontents}{\jobname.bib}
@incollection{doe2000,
  title                    = {Die numerische Strömungsmechanik},
  title+an:lang            = {="ngerman"},
  title+an:translation     = {="Computational Fluid Dynamics"},
  author                   = {J. Doe},
  booktitle                = {Internationaler Mathematikerkongress},
  booktitle+an:lang        = {="ngerman"},
  booktitle+an:translation = {="International Congress of Mathematicians"},
  date                     = {2000},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}


\begin{document}
\cite{doe2000}
\printbibliography
\end{document}

Doe, J. (2000). “Die numerische Strömungsmechanik [Computational Fluid Dynamics]”. In: Internationaler Mathematikerkongress [International Congress of Mathematicians].

I have shown a similar approach on TeXwelt: https://texwelt.de/fragen/24268/biblatexbiber-deutscher-autorenname-eines-bibliographie-eintrags-englischer-rest

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.