我正在使用最新版本的biblatex-apa
文件spanish-apa.lbx
进行本地化,但长日期中同一月份但不同日期似乎存在问题。例如,
2019-03-27/2019-04-29 正确呈现为“(2019, 27 de marzo-29 de abril)”
但
2019-03-27/2019-03-29 呈现为“(2019, 27 de marzo-)”而不是“(2019, 27-29 de marzo)”。
我也尝试了加利西亚语 ( galician-apa.lbx
),其日期格式与西班牙语相同,结果也相同。
在此先感谢关于如何解决问题的任何提示。
答案1
标准(美国)日期格式biblatex-apa
并不特别适合dd. mm. yyyy
日期格式,因此许多其他语言需要特殊处理。
请尝试以下操作(基于来自的代码ngerman-apa.lbx
)
\documentclass[spanish]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=apa, backend=biber]{biblatex}
\makeatletter
\DefineBibliographyExtras{spanish}{%
\def\urldatecomma{\addcomma\addspace}%
\protected\def\mkbibdateapalong#1#2#3{%
% As per 10.1, Articles only have year
\ifboolexpr{ test {\ifentrytype{article}}
and not test {\ifkeyword{nonacademic}} }
{\clearfield{labelmonth}%
\clearfield{labelday}}
{}%
\iffieldundef{#1}%
{}%
{\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}%
\ifboolexpr{test {\iffieldundef{#3}} and test {\iffieldundef{#2}}}
{}
{\addcomma\space}}%
\iffieldundef{#3}%
{}%
{\stripzeros{\thefield{#3}}%
\iffieldundef{#2}
{}
{\addspace de\space}}%
\iffieldundef{#2}%
{}%
{\mkbibmonth{\thefield{#2}}}}%
\protected\def\mkbibdateapalongextra#1#2#3{%
% As per 10.1, Articles only have year
\ifboolexpr{ test {\ifentrytype{article}}
and not test {\ifkeyword{nonacademic}} }
{\clearfield{labelmonth}%
\clearfield{labelday}}
{}%
\iffieldundef{#1}%
{}%
{\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}%
\printfield{extradate}%
\ifboolexpr{test {\iffieldundef{#3}} and test {\iffieldundef{#2}}}
{}
{\addcomma\space}}%
\iffieldundef{#3}%
{}%
{\stripzeros{\thefield{#3}}%
\iffieldundef{#2}
{}
{\addspace de\space}}%
\iffieldundef{#2}%
{}%
{\mkbibmonth{\thefield{#2}}}}%
\protected\def\mkbibdateapalongmdy#1#2#3{%
% As per 10.1, Articles only have year
\ifboolexpr{ test {\ifentrytype{article}}
and not test {\ifkeyword{nonacademic}} }
{\clearfield{labelmonth}%
\clearfield{labelday}}
{}%
\iffieldundef{#3}%
{}%
{el\addspace\stripzeros{\thefield{#3}}}%
\iffieldundef{#2}%
{\addspace{en}\addspace}%
{\iffieldundef{#3}%
{en\addspace}%
{\addspace{de}\addspace}%
\mkbibmonth{\thefield{#2}}{\addspace{de}\addspace}}%
\iffieldundef{#1}%
{}%
{\iffieldundef{#2}%
{}%
{\addspace}%
\thefield{#1}}}%
\def\apa@lbx@es@mkdaterangeapalong#1{%
\begingroup
\blx@metadateinfo{#1}%
\iffieldundef{#1year}{}
{\datecircaprint
\ifstrequal{#1}{url}% URL dates are unlikely to be BCE ...
{\printtext{%
\iffieldsequal{#1year}{#1endyear}
{\iffieldsequal{#1month}{#1endmonth}
{\mkbibdateapalongmdy{}{}{#1day}}
{\mkbibdateapalongmdy{}{#1month}{#1day}}}
{\mkbibdateapalongmdy{#1year}{#1month}{#1day}}%
\iffieldundef{#1endyear}%
{}%
{\iffieldequalstr{#1endyear}{}% open-ended range?
{\mbox{\bibdatedash}}
{\bibdatedash%
\mkbibdateapalongmdy{#1endyear}{#1endmonth}{#1endday}}}%
\dateuncertainprint}}
{\printtext{%
\ifboolexpr{test {\iffieldsequal{#1year}{#1endyear}}
and test {\iffieldsequal{#1month}{#1endmonth}}}
{\mkbibdateapalong{#1year}{}{#1day}}%
{\mkbibdateapalong{#1year}{#1month}{#1day}}%
\dateeraprint{#1year}%
\iffieldundef{#1endyear}%
{}%
{\iffieldequalstr{#1endyear}{}% open-ended range?
{\mbox{\bibdatedash}}
{\bibdatedash%
\iffieldsequal{#1year}{#1endyear}%
{\mkbibdateapalong{}{#1endmonth}{#1endday}}%
{\mkbibdateapalong{#1endyear}{#1endmonth}{#1endday}%
\dateeraprint{#1endyear}}}%
\enddateuncertainprint}}}}%
\endgroup}%
\def\apa@lbx@es@mkdaterangeapalongextra#1{%
\begingroup
\blx@metadateinfo{#1}%
\iffieldundef{#1year}{}
{\printtext{%
\datecircaprint
\ifboolexpr{test {\iffieldsequal{#1year}{#1endyear}}
and test {\iffieldsequal{#1month}{#1endmonth}}}
{\mkbibdateapalongextra{#1year}{}{#1day}}%
{\mkbibdateapalongextra{#1year}{#1month}{#1day}}%
\dateeraprint{#1year}%
\dateuncertainprint
\iffieldundef{#1endyear}%
{}%
{\iffieldequalstr{#1endyear}{}% open-ended range?
{\mbox{\bibdatedash}}
{\bibdatedash%
\iffieldsequal{#1year}{#1endyear}%
{\mkbibdateapalongextra{}{#1endmonth}{#1endday}}
{\mkbibdateapalongextra{#1endyear}{#1endmonth}{#1endday}%
\dateeraprint{#1endyear}}}%
\enddateuncertainprint}}}%
\endgroup}%
\savecommand\mkdaterangeapalong
\savecommand\mkdaterangeapalongextra
\def\mkdaterangeapalong{%
\apa@lbx@es@mkdaterangeapalong}%
\def\mkdaterangeapalongextra#1{%
\apa@lbx@es@mkdaterangeapalongextra{#1}}%
}
\UndefineBibliographyExtras{spanish}{%
\restorecommand\mkdaterangeapalong
\restorecommand\mkdaterangeapalongextra
}
\makeatother
\begin{filecontents}[force]{\jobname.bib}
@book{appleby,
author = {Humphrey Appleby},
title = {On the Importance of the Civil Service},
date = {2019-03-27/2019-03-29},
}
@book{bppleby,
author = {Humphrey Bppleby},
title = {On the Importance of the Civil Service},
date = {2019-03-27/2019-04-29},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
X\cite{sigfridsson,appleby,bppleby}X
\printbibliography
\end{document}
如果结果可以接受,并且对 APA 样式在西班牙语中应该是什么样的解释是合理的(在没有 APA 样式的西班牙语官方翻译的情况下),您可能希望在https://github.com/plk/biblatex-apa。