I think this works:
\makeatletter
\AtEveryCitekey{%
\blx@langsetup\abx@field@hyphenation%
\blx@hyphenreset%
}
\makeatother
In \abx@field@hyphenation
is hyphenation value. Probably it needs some testing, if it is set.
edit:
Some time ago, I was looking at biblatex language switching because of problem with my citation style[1]. I didn't understand this code at all, so I ended with ugly hack[2].
But when I looked yesterday on biblatex's patch of babel you posted, I have found line
\blx@langsetup\languagename\select@language
Function \blx@langsetup
uses edef
to define \blx@languagename
, which is used by macro \blx@hyphenreset
to load hyphenation patterns, and then loads localization strings for given language. So in fact, instead of
\blx@langsetup\abx@field@hyphenation%
it is possible to use just
\edef\blx@languagename{\abx@field@hyphenation}%
Then there is problem with French language. When used as the main document language, instead of
... (Fis-
el 1985)...
there is
...(FISCHEL
1985)...
I think there is issue only with French, I tried Czech, Russian and Spanish and they worked correctly.
With babel
, we can solve this issue with
\select@language\abx@field@hyphenation%
but, polyglossia
in xelatex has same issue and this trick is there not working, I don't know how to fix that.
Anyway, if you don't need French with polyglossia
, this is the current solution
\makeatletter
\AtEveryCitekey{%
\ifcsdef{abx@field@hyphenation}{%
\edef\blx@languagename{\abx@field@hyphenation}%
\select@language\abx@field@hyphenation%
\blx@hyphenreset%
}{}%
}
\makeatother
[1] Biblatex - using two languages in one reference entry
[2] Biblatex - using two languages in one reference entry
The spanish
option is not passed to the class, to begin with.
I don't think you really need to have class options for this, however. Here is zunbeltz.cls
:
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{zunbeltz}[2012/10/22 v0.1]
\providecommand*{\conclusionsname}{Final conclusions}
\AtBeginDocument{
\@ifpackagewith{babel}{spanish}{%
\addto\captionsspanish{\renewcommand*\conclusionsname{Conclusiones finales}}%
}{}
\@ifpackagewith{babel}{english}{%
\addto\captionsenglish{\renewcommand*\conclusionsname{Final conclusions}}%
}{}
}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
\ProcessOptions\relax
\LoadClass{report}
and here the test document zunbeltz.tex
:
\documentclass{zunbeltz}
\usepackage[english,spanish]{babel}
\begin{document}
\conclusionsname
\selectlanguage{english}
\conclusionsname
\end{document}
You'll get
Conclusiones finales
Final conclusions
Best Answer
biblatex
's language support is implemented in way thatbabel
this means, all languages you are going to use need to be announced as options tobabel
),biblatex
localisations for all announced languages even if there are no citations/bibliographies in the portion of your document typeset in that language.That means that your document compiles with fewer warnings as soon as you make it read
You still get a warning that
esperanto
is unsupported inbiblatex
, becausebiblatex
does not have anesperanto.lbx
.You may choose to ignore this warning or you may want to look into writing a suitable
esperanto.lbx
(cf. What is the most appropriate way to configure biblatex for use with an unsupported language?).There are ways to "silence" this warning, but I would not recommend that, since silencing the warning could come back to bite you if you really want Esperanto citations/bibliography entries at some point.
gusbrs suggested a simple way to make
biblatex
shut up in the comments: Map Esperanto to EnglishOr you can issue
in the preamble to remove the code that generates the relevant warning.
While
babel
does not error if you don't passesperanto
as option and later use\selectlanguage{esperanto}
, the result might be a bit off.gives
and the warning
With
I get
I can't tell you if other more important features like hyphenation work in both settings, but this behaviour seems to suggest to me that at least at the moment, you should still announce all languages to
babel
as package/class options.