# Is is possible to conditionally switch languages within one document? [duplicate]

I'm quite new to biblatex. I'm typesetting a collection that has papers both in English and Russian, and I'm making a single bibliography at the end of the book.

For the bibliography to look pretty, the entries should be 'localized' individually. That is, I want an English book to come out as

Smith and Smith (eds.)


but a Russian one to come out as

Иванов и Иванов (ред.) [not "eds."!]


I have a very vague idea that it can be achieved with a conditional in some macro that'd check the language field of each given entry and select things accordingly. But I've no idea how to approach it --- just browsing biblatex.def lead me nowhere but here. I'm using lualatex for this, just in case.

Thank you for any ideas!

• The language field is important for hyphenation of, for example, the title. I am not aware that biblatex would suddenly chage the localisation strings, though this would be possible. On the other hand, this would make your bibliography impossible to read for a non-language speaker. Even the names would be better to additionally given in roman transliteration, i.e. Ivanov and Ivanov. – Johannes_B May 11 '15 at 12:40
• @Johannes_B: Sure, hyphenation would come in handy anyway, and it seems more economical to me to reuse the field compared to introducing a new custom one. On the other hand, transliteration is not a possible solution here (russian names are only referenced in papers in russian which assume some knowledge of the language:). It's in those entries that I need Russian abbrv -- otherwise they are transliterated, of course. – Ivan Kapitonov May 11 '15 at 12:44
• Wouldn't it be better vice versa then? Instead having eds to have the russian equivalent? For accessed and others as well to have a consistent bibiography? – Johannes_B May 11 '15 at 12:49
• @Johannes_B: Sorry, I didn't quite follow that..:) What's vice versa in this case? – Ivan Kapitonov May 11 '15 at 12:52
• @IvanKapitonov You could try adding the babel=other option when loading biblatex and supplying the Russian-language entries with something like hyphenation = russian. – Pavel Rudnev May 11 '15 at 13:19

This is most definitely not a complete answer but you could try adding the babel=other option when loading biblatex and supplying the Russian-language entries with something like hyphenation = russian. Whether there is a way of automating this latter operation is still an open question.

• That works and is by far simpler than conditionals! Thx – Ivan Kapitonov May 11 '15 at 13:34

You can also give the langid field in addition to setting autolang to a sensible value.

Unfortunately, the mapping to the language is a bit picky and does not work with XeLaTeX (an utf8 aware engine) out of the box.

\begin{filecontents}{\jobname.bib}
@online{someotherentry,
url={texwelt.de},
urldate={2015-05-11},
author={a guy},
translator={a guy},
editor={a guy},
langid={ngerman}
}
@online{onlineentry,
url={some},
urldate={2015-05-11},
langid={russian},
}
@book{bookentry,
editor={smith and Wesson},
langid={russian}
}
\end{filecontents}
\documentclass[ngerman,russian,english]{article}
\usepackage[autolang=other,maxcitenames=1]{biblatex}
\usepackage{babel}
\usepackage{lmodern}