由于自定义字符串导致的日期格式变化

由于自定义字符串导致的日期格式变化

我添加了自定义的 bibstrings 并使用了语言ngerman。如果我将 bibstrings 之前的定义留空ngerman,它将按所需的格式打印日期。DD.MM.YYYY

但是,如果我使用 LanguageMappingngermangerman,它将显示为 DD/MM/YYYY - 这是为什么?显示正确格式的正确方法是什么?

LBX 文件:

\ProvidesFile{custombibstrings.lbx}[2019 SoSe]
\DeclareBibliographyStrings{%
  inherit      = {ngerman},
  andothers    = {{et al\adddot}{et al\adddot}},
  byeditor     = {{herausgegeben von}{hg\adddotspace von}},
  bytranslator = {{übersetzt von} {{\"u}bers\adddotspace von}},
  editor       = {{Herausgeber}{Hg\adddot}},
  editors      = {{Herausgeber}{Hg\adddot}},
  urlseen      = {{letzter Abruf}{letzter Abruf}},
  paragraph    = {{Paragraph}{\S}},
  subparagraph = {{Absatz}{Abs\adddot}},
  article      = {{Artikel}{Art\adddot}},
  bydirector   = {{unter der Regie von}{unter der Regie von}},
  byproducer   = {{produziert von}{produziert von}},
  volume       = {{Vol\adddot}{Vol\adddot}},
  seriesseason = {{Staffel}{Staffel}},
  episode      = {{Episode}{Episode}},
  duration     = {{Spieldauer}{Spieldauer}},
  fsk          = {{FSK}{FSK}},
}

平均能量损失

% arara: lualatex: { shell: true, synctex: true }
% arara: biber
% arara: lualatex: { shell: true, synctex: true }
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@online{Amano.2011,
 author = {Amano, Fumiko},
 title = {Testimonial Videos of Survivors},
 url = {https://www.global-peace.go.jp/OTHER/ot_german_pic_syousai.php?gbID=920&dt=161012173049},
 date = {2011-11-18},
 urldate = {2019-08-23},
 maintitle = {National Peace Memorial Halls for the Atomic Bomb Victims in Hiroshima and Nagasaki},
 organization = {{Net-Gtas Global Network}},
 keywords = {primary}
}
\end{filecontents*}
\documentclass[
  12pt,
  a4paper,
  headings=standardclasses,
  listof=totoc,
  numbers=noenddot
]{scrartcl}

\usepackage{showframe}
\usepackage[left=2.50cm, right=2.50cm, top=2.50cm, bottom=2.00cm, footskip=1cm]{geometry}
\usepackage[onehalfspacing]{setspace}
\usepackage[main=ngerman, english]{babel}
\usepackage[babel, german=quotes]{csquotes}
\usepackage[ngerman]{isodate}
\usepackage[ngerman]{datetime}

\usepackage[match,MogaHMinEx90]{luatexja-preset}
\setmainjfont{MogaHMinEx90}
\usepackage{luatexja-ruby}
\ltjsetparameter{jacharrange={-3}} %    punctuation is Latin

\usepackage[
  backend=biber,
  style=ext-authoryear,
  sorting=nyvt,
  datamodel=customstyles,
  maxnames=25,
  innamebeforetitle=true,
  usetranslator=true,
  alldates=terse,
  labeldate=year,
  dashed=false,
  isbn=false
]{biblatex}
\addbibresource{\jobname.bib}
\usepackage[hidelinks, pdfencoding=auto]{hyperref}
\begin{filecontents}{customstyles.dbx}
\DeclareDatamodelEntrytypes{video}
\DeclareDatamodelFields[type=field,datatype=literal]{
  duration,
  format,
  type,
}
\DeclareDatamodelFields[type=list,datatype=name]{
  director,
  producer,
}
\DeclareDatamodelFields[type=field, datatype=verbatim]{
  fsk,
  seriesseason,
  episode,
}
\DeclareDatamodelEntryfields[video]{
  duration,
  director,
  episode,
  format,
  fsk,
  producer,
  seriesseason,
  type,
}
\end{filecontents}
% regarded in custombibstrings
\NewBibliographyString{bydirector,duration,episode,format,fsk,paragraph,subparagraph,article,byproducer,seriesseason}
\DeclareLanguageMapping{german}{custombibstrings}

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map[overwrite=false]{
      \pertype{article}
      \step[fieldsource=entrysubtype, match=\regexp{\Anewspaper\Z}, final]
      \step[fieldsource=journal, final]
      \step[fieldset=author, origfieldval, final]
      \step[fieldsource=author, match=\regexp{\A(.*)\Z}, replace=\regexp{\{$1\}}]
      \step[fieldset=author+an, fieldvalue={1=journalauthor}]
      \step[fieldset=options, fieldvalue={journalauthor}]
    }
  }
}

% smallcaps
\newtoggle{bbx@journalauthor}
\DeclareEntryOption[boolean]{journalauthor}[true]{%
\settoggle{bbx@journalauthor}{#1}}

\renewcommand{\mkbibnamefamily}[1]{%
  \ifitemannotation{journalauthor}
    {\mkbibemph{#1}}
    {\textsc{#1}}}

\newtoggle{bbx@director}
\DeclareEntryOption[boolean]{director}[true]{%
\settoggle{bbx@director}{#1}}

\renewcommand{\mkbibnamefamily}[1]{%
  \ifitemannotation{director}
    {\mkbibemph{#1}}
    {\textsc{#1}}}

\newtoggle{bbx@producer}
\DeclareEntryOption[boolean]{producer}[true]{%
\settoggle{bbx@producer}{#1}}

\renewcommand{\mkbibnamefamily}[1]{%
  \ifitemannotation{producer}
    {\mkbibemph{#1}}
    {\textsc{#1}}}    

\DeclareDelimFormat[bib]{nametitledelim}{\addcolon\space}

% editor in parentheses
\DeclareDelimFormat{editortypedelim}{\addspace} 
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DeclareDelimAlias{translatortypedelim}{editortypedelim}
\DeclareFieldAlias{translatortype}{editortype}

\DeclareFieldFormat
  [article,inbook,incollection,inproceedings,patent,online]
  {title}{#1\isdot}
\DeclareFieldFormat
  [thesis,unpublished]
  {title}{\mkbibemph{#1}\isdot} % thesis title italic

% no period after addon titles
\renewcommand*{\titleaddonpunct}{\addspace}
\DeclareFieldFormat{titleaddon}{\mkbibbrackets{#1}}
\DeclareFieldAlias{booktitleaddon}{titleaddon}
\DeclareFieldAlias{maintitleaddon}{titleaddon}
\DeclareFieldAlias{journaltitleaddon}{titleaddon}
\DeclareFieldAlias{lawtitleaddon}{titleaddon}
\DeclareFieldAlias{subtitleaddon}{titleaddon}

\newbibmacro{online:editor+maintitle}{% organization in front of maintitle
  \printlist{organization}%
  \clearlist{organization}%
  \setunit*{\addcolon\space}%
  \printnames{editor}%
  \setunit*{\addcolon\space}%
  \usebibmacro{maintitle}}

\usepackage{xpatch}
\xpatchbibdriver{online}
  {\usebibmacro{byeditor+others}}
  {\usebibmacro{online:editor+maintitle}}
  {}{}
\xpatchbibmacro{editorstrg}{\bibstring}{\bibcpstring}{}{}
\xpatchbibmacro{editorstrg}{\bibstring}{\bibcpstring}{}{}

\renewbibmacro*{in:}{%
  \iftoggle{bbx@journalauthor}
    {}
    {\printtext{%
     \bibstring{in}\intitlepunct}}}

\DeclareNameAlias{ineditor}{sortname}

\renewcommand*{\volnumdelim}{\addcomma\space}

% set online sources as per IOA
\renewbibmacro*{addendum+pubstate}{%
  \setunit{\space}%
  \printfield{addendum}%
  \newunit\newblock
  \printfield{pubstate}}

 \DeclareListFormat[online,law]{organization}{% organization in caps 
  \textsc{%
    \usebibmacro{list:delim}{#1}%
    #1\isdot
    \usebibmacro{list:andothers}}} 

\urlstyle{same}% 
\DeclareFieldFormat{url}{\url{#1}}
\DeclareFieldFormat{urldate}{\mkbibparens{\bibstring{urlseen}\addcolon\space#1}}


%----------------------------------------------------------------------------
%   CITING
%----------------------------------------------------------------------------
\makeatletter 
\renewbibmacro*{cite:labeldate+extradate}{%
  \iffieldundef{labelyear}
    {}
    {\printtext[extblx@inner\blx@delimcontext delims]{%
       \printtext[bibhyperref]{%
         \iftoggle{bbx@journalauthor}
           {\printfield{issue}%
            \setunit{\addcomma\space}%
            \printtext[\blx@delimcontext labeldate]{%
              \printdateextra}}
           {\printtext[\blx@delimcontext labeldate]{%
              \printlabeldateextra}}}}}}
\makeatother

\renewcommand\postnotedelim{\addcolon\addspace}
\DeclareFieldFormat{postnote}{\mknormrange{#1}}
\DeclareFieldFormat{multipostnote}{\mknormrange{#1}}

%----------------------------------------------------------------------------
%   MAIN
%----------------------------------------------------------------------------
\begin{document}
\nocite{*} 
\printbibliography[heading=bibintoc,title={Literaturverzeichnis}]
\end{document}

答案1

一个.lbx文件应该始终包含至少两件事的定义。

  1. 参考书目字符串(和\DeclareBibliographyStrings
  2. 和参考书目额外内容(主要是日期处理、序数格式等等\DeclareBibliographyExtras)。

.lbx文件目前缺少参考书目附加项的定义。我biblatex甚至在.log

Package biblatex Warning: Using fallback definition for \mkbibdateshort.
(biblatex)                The command should be defined in the .lbx file.
(biblatex)                If you see this message, the .lbx file could not be
(biblatex)                loaded, is faulty or does not contain a definition
(biblatex)                for \mkbibdateshort.


Package biblatex Warning: Using fallback definition for \mkbibdateshort.
(biblatex)                The command should be defined in the .lbx file.
(biblatex)                If you see this message, the .lbx file could not be
(biblatex)                loaded, is faulty or does not contain a definition
(biblatex)                for \mkbibdateshort.

由于您实际上是在编写一个新.lbx文件,因此您需要从另一种语言继承参考书目附加内容或从头定义所有必要的命令。对于您来说,从ngermanwith继承\InheritBibliographyExtras{ngerman}似乎是最佳选择。您仍然可以用 覆盖定义\DeclareBibliographyExtras

inherit = {ngerman},情况与参考书目字符串类似,但是继承是由中的特殊键值对提供的\DeclareBibliographyStrings

我强烈建议您帮自己一个忙,将语言名称添加到通用文件名中custombibstrings.lbx以使其易于读取custombibstrings-ngerman.lbx(当然,如果您能想出一个更具描述性的名称,custombibstrings这也可能会有用......)

\ProvidesFile{custombibstrings-ngerman.lbx}[2019 SoSe]

\InheritBibliographyExtras{ngerman}

\DeclareBibliographyStrings{%
  inherit      = {ngerman},
  andothers    = {{et al\adddot}{et al\adddot}},
  byeditor     = {{herausgegeben von}{hg\adddotspace von}},
  bytranslator = {{übersetzt von} {übers\adddotspace von}},
  editor       = {{Herausgeber}{Hg\adddot}},
  editors      = {{Herausgeber}{Hg\adddot}},
  urlseen      = {{letzter Abruf}{letzter Abruf}},
  paragraph    = {{Paragraph}{\S}},
  subparagraph = {{Absatz}{Abs\adddot}},
  article      = {{Artikel}{Art\adddot}},
  bydirector   = {{unter der Regie von}{unter der Regie von}},
  byproducer   = {{produziert von}{produziert von}},
  volume       = {{Vol\adddot}{Vol\adddot}},
  seriesseason = {{Staffel}{Staffel}},
  episode      = {{Episode}{Episode}},
  duration     = {{Spieldauer}{Spieldauer}},
  fsk          = {{FSK}{FSK}},
}

当然你需要

\DeclareLanguageMapping{ngerman}{custombibstrings-ngerman}

使用此文件并更改此行,MWE 生成

Amano, Fumiko (2011.11.18):幸存者证言视频。Net-Gtas 全球网络:广岛和长崎原子弹受害者国家和平纪念馆。https://www.global-peace.go.jp/OTHER/ot 德语图片 syousai.php?gbID=920&dt=161012173049(上次更新:2019.08.23)。

编辑变成。{\"u}bers\adddotspace vonübers\adddotspace von

相关内容