biblatex icon indicating copy to clipboard operation
biblatex copied to clipboard

Babel/Polyglossia: Latin lbx file not always read

Open Doc73 opened this issue 3 years ago • 2 comments

I've created a lbx file for Latin, in order to have, for example, et instead of and (= e in Italian) in the sections of my book written in Latin, but I encounterd an issue.

As you can see in the example below, in latin environments the Latin localization works very well, but It doesn't inside \textlatin{blablabla}.

Is it a bug or am I doing something wrong?

Thank you very much for your patience, Domenico

% !TeX encoding = UTF-8
% !TeX TS-program = xelatex
% !TeX spellcheck = it_IT
% !BIB TS-program = biber

\documentclass{article}
\usepackage{polyglossia}
	\setdefaultlanguage[babelshorthands=true]{italian}
	\setotherlanguage{latin}

\begin{filecontents}[overwrite]{\jobname.bib}
@Book{Adler2002,
	author    = {Adler, William and Tuffin, Paul},
	date      = {2002},
	title     = {The Chronography of George Synkellos},
	isbn      = {0199241902},
	location  = {Oxford},
	publisher = {Oxford University Press},
	subtitle  = {A Byzantine chronicle of universal history from the creation},
}
\end{filecontents}

\begin{filecontents}{latin.lbx}
\ProvidesFile{latin.lbx}[2022/08/06 Latin language stub]

\InheritBibliographyExtras{italian}

\DeclareBibliographyStrings{%
  inherit          = {italian},
  editor           = {{edidit}{ed\adddot}},
  editors          = {{ediderunt}{edd\adddot}},
  and              = {{et}{et}},
  page             = {{pagina}{p\adddot}},
  pages            = {{paginae}{pp\adddot}},
  nodate           = {{sine\space data}{{}s\adddot d\adddot}},
}
\endinput
\end{filecontents}

\usepackage{csquotes}
\usepackage[style=authoryear]{biblatex}
\addbibresource{\jobname.bib}

\begin{document}
\cite{Adler2002}

\begin{latin}
	\cite{Adler2002}
\end{latin}

\textlatin{\cite{Adler2002}}
\end{document}

Doc73 avatar Aug 07 '22 09:08 Doc73

This is expected, because \textlatin does not change all aspects of the currently active language.

The polyglossia documentation explains

For example \textrussian{\today} and \textlang{russian}{\today} yield 18 июля 2022 г. The commands switch to the correct hyphenation patterns, they activate some extra features for the selected language (such as extra spacing before punctuation in French), and they translate the date when using \today. They do not, however, translate so-called caption strings, i.e., “chapter”, “figure” etc., to the local language (these remain in the currently active ‘outer’ language).

By default biblatex writes its language definitions to the caption strings, so you don't get language switching here.

You can set the option langhook=extras to make biblatex write its language definitions to the language extras. That option is explained in the biblatex docs as follows

This option controls whether bibliography strings and extras are written to \captions<language> or \extras<language>. The exact effect of this option depend on the language package (babel/polyglossia). Broadly speaking, the language switching environments provided by those packages (except hyphenrules) either switch language captions and extras or only language extras. Hence, if this option is set to extras, all language switches will affect biblatex, whereas with captions only language switches that also switch other parts of the document language affect biblatex.

Then

\documentclass{article}
\usepackage{polyglossia}
	\setdefaultlanguage[babelshorthands=true]{italian}
	\setotherlanguage{latin}

\begin{filecontents}{\jobname.bib}
@book{Adler2002,
  author    = {Adler, William and Tuffin, Paul},
  date      = {2002},
  title     = {The Chronography of George Synkellos},
  isbn      = {0199241902},
  location  = {Oxford},
  publisher = {Oxford University Press},
  subtitle  = {A Byzantine chronicle of universal history from the creation},
}
\end{filecontents}

\begin{filecontents}{latin.lbx}
\ProvidesFile{latin.lbx}[2022/08/06 Latin language stub]

\InheritBibliographyExtras{italian}

\DeclareBibliographyStrings{%
  inherit          = {italian},
  editor           = {{edidit}{ed\adddot}},
  editors          = {{ediderunt}{edd\adddot}},
  and              = {{et}{et}},
  page             = {{pagina}{p\adddot}},
  pages            = {{paginae}{pp\adddot}},
  nodate           = {{sine\space data}{{}s\adddot d\adddot}},
}
\endinput
\end{filecontents}

\usepackage{csquotes}
\usepackage[style=authoryear, langhook=extras]{biblatex}
\addbibresource{\jobname.bib}

\begin{document}
\cite{Adler2002}

\begin{latin}
  \cite{Adler2002}
\end{latin}

\textlatin{\cite{Adler2002}}
\end{document}

shows "et" in the second and third citations.

moewew avatar Aug 07 '22 10:08 moewew

@moewew Thank you very much for your explanation.

Doc73 avatar Aug 07 '22 10:08 Doc73