
A menudo escribo textos en alemán e inglés y uso JabRef para organizar mis referencias. Citando muchos artículos de conferencias, a menudo resulta bastante molesto cambiar siempre el idioma de las ubicaciones de acuerdo con el idioma del documento. Entonces me pregunté si podría proporcionar una especie de diccionario a biblatex, para no tener que adaptar mi base de datos cada vez.
Por ejemplo, en el preámbulo me gustaría definir:
Munich = München
Germany = Deutschland
en caso de que el documento o lenguaje babel sea ngerman
.
Se puede hacer esto?
MWE
\documentclass[ngerman]{article}
\usepackage[ngerman]{babel}
\begin{filecontents}{bla.bib}
@inproceedings{Orwell1984,
author = "George Orwell",
title = "1984",
year = "1948",
booktitle = "Books about big brothers",
location = "Munich, Germany",
}
\end{filecontents}
\RequirePackage[backend=biber,style=ieee-alphabetic]{biblatex}
\addbibresource{bla.bib}
\begin{document}
\cite{Orwell1984}. \\
\printbibliography
\end{document}
Respuesta1
Puedes utilizar biblatex
los bibstrings de para traducir ciertas frases. La pregunta es cuál sería una buena interfaz. Si desea poder combinar términos arbitrarios en un campo, tendría que hacer algo como lo siguiente (que parece un poco complicado).
\documentclass[ngerman]{article}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=ieee-alphabetic]{biblatex}
\NewBibliographyString{munich,germany}
\DefineBibliographyStrings{german}{
munich = {München},
germany = {Deutschland},
}
\begin{filecontents}{\jobname.bib}
@inproceedings{Orwell1984,
author = {George Orwell},
title = {1984},
year = {1948},
booktitle = {Books about big brothers},
location = {\bibstring{munich}, \bibstring{germany}},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\autocite{Orwell1984}
\printbibliography
\end{document}
Si está de acuerdo con usar solo una cadena por campo, podría hacer las cosas un poco mejor
\documentclass[ngerman]{article}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=ieee-alphabetic]{biblatex}
\NewBibliographyString{de-munich}
\DefineBibliographyStrings{german}{
de-munich = {München},
}
\DefineBibliographyStrings{english}{
de-munich = {Munich, Germany},
}
\DeclareListFormat{location}{%
\usebibmacro{list:delim}{#1}%
\ifbibstring{#1}{\bibstring{#1}}{#1}\isdot
\usebibmacro{list:andothers}}
\begin{filecontents}{\jobname.bib}
@inproceedings{Orwell1984,
author = {George Orwell},
title = {1984},
year = {1948},
booktitle = {Books about big brothers},
location = {de-munich},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\autocite{Orwell1984}
\printbibliography
\end{document}
Una solución más BibTeX-y utiliza @string
s. Puede definir cadenas para cada ubicación en diferentes .bib
archivos (uno para cada idioma) y luego seleccionar el .bib
archivo para el idioma que necesita en su documento.
\documentclass[ngerman]{article}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=ieee-alphabetic]{biblatex}
\begin{filecontents}{locationstrings-german.bib}
@string{de:munich = "München"}
\end{filecontents}
\begin{filecontents}{locationstrings-english.bib}
@string{de:munich = "Munich, Germany"}
\end{filecontents}
% select the bib file for the language you want
\addbibresource{locationstrings-german.bib}
\begin{filecontents}{\jobname.bib}
@inproceedings{Orwell1984,
author = {George Orwell},
title = {1984},
year = {1948},
booktitle = {Books about big brothers},
location = de:munich,
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\autocite{Orwell1984}
\printbibliography
\end{document}
La versión multiscript aún muy experimental de biblatex
también podría ser de interés:https://github.com/plk/biblatex/issues/416
Respuesta2
\documentclass[ngerman]{article}
\usepackage[ngerman]{babel}
\begin{filecontents}{german-strings.bib}
@string{muenchen={München}}
@string{germany={Deutschland}}
\end{filecontents}
\begin{filecontents}[overwrite]{bla.bib}
@inproceedings{Orwell1984,
author = "George Orwell",
title = "1984",
year = "1948",
booktitle = "Books about big brothers",
location = muenchen # ", " # germany
}
\end{filecontents}
\RequirePackage[backend=biber,style=ieee-alphabetic]{biblatex}
\addbibresource{german-strings.bib}
\addbibresource{bla.bib}
\begin{document}
\cite{Orwell1984}. \\
\printbibliography
\end{document}