Traducir ubicaciones en la bibliografía según el idioma del documento/babel

Traducir ubicaciones en la bibliografía según el idioma del documento/babel

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 biblatexlos 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}

G. Orwell, "1984", en Libros sobre hermanos mayores, Múnich, Alemania, 1948.


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}

G. Orwell, "1984", en Libros sobre hermanos mayores, Múnich, 1948.


Una solución más BibTeX-y utiliza @strings. Puede definir cadenas para cada ubicación en diferentes .bibarchivos (uno para cada idioma) y luego seleccionar el .bibarchivo 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}

G. Orwell, "1984", en Libros sobre hermanos mayores, Múnich, 1948.


La versión multiscript aún muy experimental de biblatextambié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}

ingrese la descripción de la imagen aquí

información relacionada