To finally give an comprehensive answer to my own question for future reference, the following will do what I initially wanted:
First of all, there is no need to use the \zh{}
token, as this example will work with using the name affix as described here by Audrey: https://tex.stackexchange.com/a/66825/47927
I didn’t use the titleaddon
part of Audrey’s proposal, since I have no need for this. Also, I stuck to only using the last-first name order.
So, the bibliography entries should be like this (the keyword ‘latn’ or ‘hani’ are meant to represent the writing system of the respective article and are used to conditionally hide the Chinese part of the name):
@article{Liu2008,
author = {Liu, 刘国福, Guofu},
title = {The Latest Development of Immigration Law: On the Transformation of China's Emmigration and Immigration Administration Law (移民法的最新发展——兼论中国出入境管理法的改造和重塑)},
journal = {Journal of Henan Administrative Institute of Politics and Law (河南省政法管理干部学院学报)},
year = {2008},
volume = {5},
pages = {46--58},
language = {chinese},
keywords = {article,hani}
}
@book{Liu2011,
author = {Liu, 刘国福, Guofu},
title = {Chinese Immigration Law},
year = {2011},
publisher = {Ashgate},
address = {Farnham},
language = {english},
keywords = {monography,latn}
}
Now the part for the .tex file (slightly edited from the above linked posting of Audrey):
% Keep name affixes for English names
\forcsvlist{\listadd\nameaffixlist}{Junior,Senior}
\newcommand{\ifnameaffix}[1]{%
\ifboolexpr{test{\ifrmnum{#1}} or test{\ifinlist{#1}{\nameaffixlist}}}}
% Set label format using last-first order
\DeclareNameFormat{labelname}{%
\ifboolexpr{test{\ifblank{#7}} or test{\ifnameaffix{#7}}}
{\ifcase\value{uniquename}%
\usebibmacro{name:last}{#1}{#3}{#5}{#7}\or
\ifuseprefix
{\usebibmacro{name:last-first}{#1}{#4}{#5}{#8}}
{\usebibmacro{name:last-first}{#1}{#4}{#6}{#8}}\or
\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}\fi}%
{\ifnumequal{\value{uniquename}}{0}%
{\usebibmacro{name:cjk}{#1}{}{}}
{\usebibmacro{name:cjk}{#1}{#3}{}}}%
\usebibmacro{name:andothers}
}
% Set name field format also using last-first order
\DeclareNameFormat{last-first}{%
\ifboolexpr{test{\ifblank{#7}} or test{\ifnameaffix{#7}}}
{\iffirstinits
{\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}}
{\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}}
{\usebibmacro{name:cjk}{#1}{#3}{#7}}%
\usebibmacro{name:andothers}
}
\DeclareNameAlias{sortname}{last-first}
\DeclareNameAlias{default}{last-first}
% Making Chinese name appear after first name in parentheses, but only if the keyword 'hani' exists (see bib entries above for reference)
\newbibmacro*{name:cjk}[3]{%
\usebibmacro{name:delim}{#2#3#1}%
\usebibmacro{name:hook}{#2#3#1}%
\mkbibnamelast{#1}%
\ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{#2}}%
\ifkeyword{hani}{%
\ifblank{#3}{}{\bibnamedelimd\mkbibnameaffix{\mkbibparens{#3}}}%
}{}
}
\AtEveryBibitem{\clearlist{language}}
\AtBeginBibliography{%
\renewcommand*{\multinamedelim}{\addsemicolon\space}
}
One thing to consider: If there is only the first appearance of the author shown in the bibliography and the following appearances replaced by a dash, this script will choose the first appearance depending of the language of the first entry. So, if the first entry is not Chinese but one of the following entries is, the Chinese name will not appear anywhere.
Edit (2018-01-22):
The macro names name:last
and name:first
have been changed to name:family
and name:given
, the macro \mkbibnamefirst
has accordingly been renamed to \mkbibnamegiven
and \iffirstinits
to \ifgiveninits
. Further, \ifblank
should be changed into \ifdefvoid
. I did not test this answer very recently. I guess, some other things have to be changed as the BibLaTeX packages have been updated several times in the meantime.
This is my final set up as MWE (altough it is quite a lot of code):
\begin{filecontents}{example.bib}
@article{Liu2008,
author = {Liu, 刘国福, Guofu},
title = {The Latest Development of Immigration Law: On the Transformation of China's Emmigration and Immigration Administration Law (移民法的最新发展——兼论中国出入境管理法的改造和重塑)},
journal = {Journal of Henan Administrative Institute of Politics and Law (河南省政法管理干部学院学报)},
year = {2008},
volume = {5},
pages = {46--58},
language = {chinese},
keywords = {article,hani}
}
@book{Liu2011,
author = {Liu, 刘国福, Guofu},
title = {Chinese Immigration Law},
year = {2011},
publisher = {Ashgate},
address = {Farnham},
language = {english},
keywords = {monography,latn}
}
\end{filecontents}
\documentclass{article}
\usepackage{fontspec}
\setmainfont[SmallCapsFeatures={LetterSpace=2}]{TeX Gyre Termes}
\usepackage{xeCJK}
\setCJKmainfont[Script=CJK]{Noto Serif CJK SC}
\CJKsetecglue{\,}
\usepackage[
backend=biber,
language=autobib,
autolang=hyphen,
style=authoryear,
defernumbers=true,
sortlocale=en-GB,
urldate=long,
dateabbrev=false,
sortcites=true,
sorting=anyvt,
safeinputenc
]{biblatex}
% =====
\renewbibmacro*{labeltitle}{\iffieldundef{shorttitle}%
{\printfield{title}\clearfield{title}}%
{\mkbibemph{\printfield{shorttitle}}\addspace\printtext[parens]{\printfield{year}}}%
}
\renewbibmacro*{date+extradate}{\ifkeyword{law}%
{}%
{\printtext[parens]{%
\iflabeldateisdate%
{\printfield{issue}\setunit*{\addspace}\printdateextra}%
{\printlabeldateextra}}}%
}
\renewbibmacro*{issue+date}{\ifkeyword{law}%
{}%
{\iflabeldateisdate%
{\printfield{issue}\setunit*{\addspace}\printtext[parens]{\printdate}}%
{\printtext[parens]{\printfield{issue}\setunit*{\addspace}\printdate}}}%
}
\renewbibmacro*{cite:labeldate+extradate}{\ifkeyword{law}%
{}%
{\iffieldundef{labelyear}%
{}%
{\printtext[bibhyperref]{\mkbibparens{\printlabeldateextra}}}}%
}
\renewcommand*{\multinamedelim}{\addnbthinspace\slash\thinspace}
\renewcommand*{\finalnamedelim}{\multinamedelim}
\renewcommand*{\labelnamepunct}{\addcolon\addspace}
\renewcommand*\mkbibnameprefix[1]{\textsc{#1}}
\renewcommand*\mkbibnamefamily[1]{\textsc{#1}}
\renewcommand*\bibnamedash{\rule[.48ex]{3em}{.5pt}\addspace}
\DeclareFieldFormat*{citetitle}{\mkbibemph{#1}}
\DeclareFieldFormat*{extradate}{\addnbthinspace\mknumalph{#1}}
\DeclareFieldFormat*{url}{URL\addcolon\addspace\url{#1}}
% =====
% Settings for Chinese names
\forcsvlist{\listadd\nameaffixlist}{Junior,Senior}
\newcommand{\ifnameaffix}[1]{%
\ifboolexpr{ test {\ifrmnum{#1}} or test {\xifinlist{#1}{\nameaffixlist}} }}
% Based on definitions from biblatex.def
\newbibmacro*{name:cjk}[3]{%
\usebibmacro{name:delim}{#2#3#1}%
\usebibmacro{name:hook}{#2#3#1}%
\mkbibnamefamily{#1}%
\ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{#2}}%
\ifkeyword{hani}{%
\ifdefvoid{#3}{}{\bibnamedelimd\mkbibnamesuffix{\mkbibparens{\upshape #3}}}%
}{}}
\newbibmacro*{name:cjk-short}[3]{%
\usebibmacro{name:delim}{#2#3#1}%
\usebibmacro{name:hook}{#2#3#1}%
\mkbibnamefamily{#1}%
\ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{#2}}%
\ifkeyword{hani}{%
\ifdefvoid{#3}{}{}%
}{}}
\DeclareNameFormat{given-family}{%
\ifboolexpr{ test {\ifdefvoid{\namepartsuffix}} or test {\ifnameaffix{\namepartsuffix}} }%
{\ifgiveninits%
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffix}}%
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}}%
{\usebibmacro{name:cjk}{\namepartfamily}{\namepartgiven}{\namepartsuffix}}%
\usebibmacro{name:andothers}}
\DeclareNameFormat{family-given}{%
\ifboolexpr{ test {\ifdefvoid{\namepartsuffix}} or test {\ifnameaffix{\namepartsuffix}} }%
{\ifgiveninits%
{\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffix}}%
{\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}}%
{\usebibmacro{name:cjk}{\namepartfamily}{\namepartgiven}{\namepartsuffix}}%
\usebibmacro{name:andothers}}
\DeclareNameFormat{family-given/given-family}{%
\ifboolexpr{ test {\ifdefvoid{\namepartsuffix}} or test {\ifnameaffix{\namepartsuffix}} }%
{\ifnumequal{\value{listcount}}{1}%
{\ifgiveninits%
{\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffix}}%
{\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}%
\ifboolexpe{ test {\ifdefvoid\namepartgiven} and test {\ifdefvoid\namepartprefix} }%
{}%
{\usebibmacro{name:revsdelim}}}%
{\ifgiveninits%
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffix}}%
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}}}%
{\usebibmacro{name:cjk}{\namepartfamily}{\namepartgiven}{\namepartsuffix}}%
\usebibmacro{name:andothers}}
\DeclareNameFormat{labelname}{%
\ifcase\value{uniquename}%
\usebibmacro{name:family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}%
\or%
\ifboolexpr{ test {\ifdefvoid{\namepartsuffix}} or test {\ifnameaffix{\namepartsuffix}} }%
{\ifuseprefix%
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiven} % i
{\namepartprefix}
{\namepartsuffix}}% i
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiven} % i
{\namepartprefix} % i
{\namepartsuffix}}}% i
{\usebibmacro{name:cjk-short}{\namepartfamily}{\namepartgiven}{\namepartsuffix}}%
\or%
\ifboolexpr{ test {\ifdefvoid{\namepartsuffix}} or test {\ifnameaffix{\namepartsuffix}} }%
{\usebibmacro{name:given-family}%
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}%
{\usebibmacro{name:cjk-short}{\namepartfamily}{\namepartgiven}{\namepartsuffix}}%
\fi%
\usebibmacro{name:andothers}}
\DeclareFieldFormat{citetitle}{\mkbibemph{#1}\ifkeyword{law}{\addspace\printtext[parens]{\printfield{year}}}{}}
\AtEveryBibitem{\clearlist{language}}
\AtBeginBibliography{%
\renewcommand*{\multinamedelim}{\addsemicolon\addspace}%
}
\DefineBibliographyExtras{english}{%
\protected\def\mkbibdatelong#1#2#3{%
\iffieldundef{#3}
{}
{\stripzeros{\thefield{#3}}%
\iffieldundef{#2}{}{\nobreakspace}}%
\iffieldundef{#2}
{}
{\mkbibmonth{\thefield{#2}}%
\iffieldundef{#1}{}{\space}}%
\iffieldbibstring{#1}
{\bibstring{\thefield{#1}}}
{\stripzeros{\thefield{#1}}}%
}%
}
\addbibresource{example.bib}
\begin{document}
Some text.\footnote{\cite{Liu2008}, \cite{Liu2011}.}
\printbibliography
\end{document}
The output for the bibliography is:

The output for the footnotes is:

\zh
command as a post-name thing, like "Junior" or "Senior" with American names? Then you could have two different name formats – one for the.bbx
and one for the.cbx
\zh{}
part when the entry’s language is not Chinese and show it when it is, because there might be authors with “Jr.” or “Sr.” among the non-Chinese ones, whose names I would like to print out completely. Still, I’ll give it a try.langid
field for that and hyphenation purposes, but that would mean the entire entry would be treated as Chinese unless you tweak with Babel.