General Introduction
This is do-able; but it is not easily doable. So I'm
afraid this is not an answer to the question that anyone is going to
be able to accept: just a record of the problem. The person to do this would have to understand intimately the conventions of the languages involved, and have at least some idea of how biblatex
works, though that isn't any harder than escaping from the Cretan labyrinth -- just follow the thread as it snakes around.
To understand why it's possible, and why it's hard, you need to
know a bit about how biblatex
works.
At the heart of every biblatex
style are three files:
One (or more) file(s) with the .lbx
extension contain
language definitions, such as the
appropriate strings for things like "editor", "commentator"
(obviously, different in every language), but also macros for
producing dates (consider, e.g., the difference between
English-English and American-English date conventions).
One file .cbx
is responsible for generating the in-text citations,
such as "[1]" or "(Chuzzlewit 1975)".
One file .bbx
is responsible for generating the bibliography list.
That is a slight oversimplification, because in some styles there is a
close linkage between .cbx
and .bbx
files, because in some styles
the in-text citations are (at least sometimes) more or less identical
to the full bibliographical entry. But it's sufficiently accurate to
say that the actual printing of the bibliographical data, whether it
is done in-text or in a separate bibliography or both, is largely the
work of the .bbx
files.
For present purposes, let's ignore that complexity. Let's concentrate
on the .bbx
files.
What a .bbx file looks like
If you look at a .bbx
file, you will see a lot of things that look
like this:
\DeclareBibliographyDriver{article}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
\setunit{\printdelim{nametitledelim}}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{bytranslator+others}%
\newunit\newblock
\printfield{version}%
\newunit\newblock
\usebibmacro{in:}%
\usebibmacro{journal+issuetitle}%
\newunit
\usebibmacro{byeditor+others}%
\newunit
\usebibmacro{note+pages}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{issn}}
{}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
Basically what this does is work systematically through the various
"chunks" that make up any bibliographical entry, printing them as
appropriate. But note two things. First, the order of those chunks is
fixed. And secondly, within each chunk, the driver makes heavy use of
\usebibmacro
to call subsidiary bits and pieces that deal with the
logic within chunks. One of the things they often do is print
bibstring
s, which are defined in .lbx
files: things like "editor"
or "translator" or "volume". But where a bibmacro
generates output it,
like the BibliographyDriver
usually does so in an order that is hardwired.
How different languages are handled
Biblatex is able, while sticking with this same driver in every case,
to make certain concessions to differences in language: so
\bibstring
for instance can work out whether to print "editor" or
"Herausgeber"; the .lbx
files also define some macros which are used
to print dates and the like. And it can make (which is really the most
important) hyphenation patterns depend on the original language.
But
so much is hard baked into the .bbx
despatcher system, that the sort
of reorganisation that involves fundamentally altering the order of
what is printed is tiresome to achieve. There is no
"off-the shelf" solution. One can easily say "take your bibstring
definitions for Japanese from this file, but your bibstring
definitions for English from that one; but you cannot say "take
your bibliographic template for English works from this .bbx
, but
your bibliographic template for Japanese ones from that .bbx
. The
.bbx
files can load others, but in the end there is a single point
of entry. From this, the basic structure is hard-baked.
In order to allow the choice of language to have a more than largely
superficial effect, therefore, you have to work as follows:
- Write (or copy) a bibliography driver and/or set of
macros for each entrytype and language.
- Write a mechanism which somehow examines the language and then
despatches to the right driver.
I can think of at least two ways to do this, and there are very likely more.
One would involve playing with the data before it ever got into Biblatex, while it was in biber, effectively re-writing the entrytypes so that, say, book
became
book-japanese
, and then distinguishing between the book
and
book-japanese
types by providing them with different types. This is suggested in the comments above. There
are downsides to that for the user, though, who would have to know and
understand the implications, for instance if s/he wanted to have a
bibliography divided by type
.
The other, which I used when I faced an analogous problem when dealing
with cases from different jurisdictions, is to keep a single type
,
but to make the driver a wrapper whose only job is to examine the
relevant field, and then despatch on it, as well as doing bits and
pieces of cleanup, leaving it for a set of \bibmacro
s to do the
actual formatting. That produces some rather unlovely code, but it
does the job.
But it is key to note, that whichever of these you do, you have to
produce a new .bbx
, specialised for just the languages you are
willing to handle. Even if you just copied definitions from existing
and appropriate .bbx
file and renamed them as necessary (and I don't know whether, for instance,
anyone has even done one for Japanese), you'd still have a great deal
of work and testing, because you would find that your source files
made heavy use of bibmacro
s with the same name, but with different
definitions, and you'd have to work out which macros were safe to use,
and which need specialising, and do all that. Theoretically dull work, but
painstaking.
(Often--mostly--the bibmacro
s are dealing with the sort of obscure corner-cases beloved of those who dictate bibliography rules. They are capable of requiring all sorts of odd little things.)
Could one do this just from Biblatex?
I have nothing to do with maintaining biblatex, but from the outside I don't think one can realistically hold on to one's hat for this to
be tidied up in Biblatex in the near future -- even though Biblatex
has a really creditable record of being written, as far as possible, to be
expandable and adaptable. The problem is that it would not be enough
to change drivers by language (that would be fairly simple, I expect):
the .bbx
files do a lot of work using bibmacro
s, and those often
share names. Some method for putting these macros in different
namespaces depending on where they were defined would be needed, when
the classic pattern in the existing codebase is for promiscuous
redefinition without renaming, and in various ways that approach is
cooked in.
Edited to add Also, as moewe points out in the comments, it is hard to conceive of any way of adding this feature that would not cause compatibility problems. A tiny recent change in this direction (designed to remove the parochial assumption that one's first name is also one's given name), simple as it was, hints at the possible problems. And now that Biblatex has a reasonable range of working styles, maintaining compatibility is pretty important.
japbook
andrussbook
) which can easily be done withbiber
. Or just have one style where there's a language check for each document type. You will end up with huge a .bbx file but it should be doable this way.keywords
field and the\ifkeyword{}
macro. But, still it will be a lot of work … I tried to do something similar here: tex.stackexchange.com/a/167250/47927eds.
but that alone is hard for me to find as an untrained reader.