![如何正确使用 biblatex 中的“语言”字段](https://linux22.com/image/438967/%E5%A6%82%E4%BD%95%E6%AD%A3%E7%A1%AE%E4%BD%BF%E7%94%A8%20biblatex%20%E4%B8%AD%E7%9A%84%E2%80%9C%E8%AF%AD%E8%A8%80%E2%80%9D%E5%AD%97%E6%AE%B5.png)
我正在使用 biblatex(与 biber 一起使用)并language
在我的文件的条目中设置字段.bib
。奇怪的是,语言没有被解释为本地化键,而显然应该是这样。(我使用 polyglossia 进行语言支持和本地化。)
我得到如下输出。
Hume, D., 1777. An enquiry concerning human understanding. british.
(上面假定我设置了language = {british}
。如果我设置了language = {en-GB}
,那么相应的文本就会出现在输出文档中。)
我这里遗漏了什么吗?
顺便说一句,如果有人能推荐如何不是只要它是文档语言之一(即“默认”或“其他”语言之一),就打印参考书目中的语言。
最小可重复示例
\begin{filecontents*}[overwrite]{\jobname.bib}
@book{author00,
title = {{A Title}},
publisher = {Alpha},
year = {2008},
editor = {Author, A},
address = {London},
language = {english},
}
@book{buthor00,
title = {{B Title}},
publisher = {Bravo},
year = {1990},
author = {Buthor, B},
address = {New York},
language = {english},
}
\end{filecontents*}
\documentclass{article}
\usepackage{polyglossia}
\usepackage[backend = biber]{biblatex}
\addbibresource{\jobname.bib}
\begin{document}
\citeauthor{author00} has written \textcite{author00}.
\citeauthor{buthor00} has written \textcite{buthor00}.
\nocite{*}
\printbibliography
\end{document}
答案1
这是我在听取了@UlrikeFischer 在聊天中提出的一些善意建议后最终得到的解决方案。
主要问题是我做了\setdefaultlanguage{british}
但没有做\setmainlanguage{british}
,所以本地化没有生效。我真傻!
% Do not mention language of an entry if it is in the same or another variety of English.
% Copied from `tex/latex/biblatex/lbx/english.lbx` in the biblatex package, and adjusted accordingly.
% This solves the "side point" in my question.
\DeclareRedundantLanguages{british}{english,american,british,canadian,australian,newzealand,USenglish,UKenglish}
% Define localisation strings for the 'british' language.
% This is just an example, since due to the above "redundant languages" setting, this is superfluous, though it would not be if you did, e.g., `\DefineBibliographyStrings{spanish}{...}`.
\NewBibliographyString{langbritish}
\NewBibliographyString{frombritish}
\DefineBibliographyStrings{english}{
langbritish = {British},
frombritish = {from the British},
}