Referring to my previous post, I reopen now the topic saying that I performed a pull request on GitHub (as suggested by @rmano, whom I thank, in the comments), to implement the Italian language support, but I also rearranged the previous code, inserting the customization of the backreferences directly in the definition of the commands \backrefenglish, \backrefgerman, \backreffrench, \backrefspanish, \backrefbrazil, \backrefafrikaans, \backrefitalian, like so:
\def\backrefenglish{%
\def\backrefpagesname{pages}%
\def\backrefsectionsname{sections}%
\def\backrefsep{, }%
\def\backreftwosep{ and~}%
\def\backreflastsep{, and~}%
\renewcommand*{\backref}[1]{}% for backref < 1.33 necessary
\renewcommand*{\backrefalt}[4]{[{%
\ifcase ##1 No citations%
\or Cited in page~##2%
\else Cited in pages~##2%
\fi%
}]}%
}
\def\backrefitalian{%
\def\backrefpagesname{pagine}%
\def\backrefsectionsname{sezioni}%
\def\backrefsep{, }%
\def\backreftwosep{ e~}%
\def\backreflastsep{ e~}%
\renewcommand*{\backref}[1]{}% for backref < 1.33 necessary
\renewcommand*{\backrefalt}[4]{[{%
\ifcase ##1 Nessuna citazione%
\or Cit. a pagina~##2%
\else Cit. alle pagine~##2%
\fi%
}]}%
}
It would be necessary to extend the translation of the following 3 sentences in the current languages (german, french, spanish, brazil, afrikaans), if you can contribute in my branch backref-multilingual-implemented on GitHub:
- No citations
- Cited in page
- Cited in pages
The code works, generating the Italian or English version of the custom \backrefalt command, based on \backrefenglish or \backrefitalian used command inside \begin{document}, before \bibliographystyle (as shown in the previous post), but it is necessary to comment out the \backrefenglish command after \BR@DeclareLang{italian}{italian}, in the backref.sty file of hyperref package, making it explicit instead with the one in the desired language (\backrefenglish, \backrefgerman, \backreffrench, \backrefspanish, \backrefbrazil, \backrefafrikaans or \backrefitalian) inside \begin{document}, before \bibliographystyle. Maybe the written code could be made cleaner, considering also a backref to sections instead of pages. What do you think?
hyperref'sbackref.styfile and I put it in the same folder as my.texdocument making the above changes and it works. I'm asking if the code can be written in such a way to make it global with the possibility to contemplate a similar scenario of customization with multilingual translation of back-references. It would be nice, I think – Riccardo Volpe Feb 19 '23 at 09:55