michal-h21 / biblatex-iso690

ISO 690 style for biblatex.
LaTeX Project Public License v1.3c
93 stars 31 forks source link

Localization does not follow the currently selected language #90

Closed Witiko closed 2 years ago

Witiko commented 3 years ago

BibLaTeX documentation says (emphasis mine):

By default biblatex automatically picks up the active surrounding language from the babel/polyglossia package (and fall back to English if babel/polyglossia is not available).

However, the following MWE (see also Overleaf playground) shows that biblatex-iso690 follows the main language of babel (czech), not the active surrounding language (english) as evidenced by the Czech text "Dostupné z DOI" in the output:

\documentclass{article}

\begin{filecontents}[noheader]{main.bib}
@article{tex:zpravodajchlebikova91eng,
  author = {Chlebíková, Jana},
  title = {Ako rozděliť (slovo) Československo},
  journal = {Zpravodaj CSTUG},
  volume = 1,
  number = 4,
  year = 1991,
  month = April,
  pages = 10-13,
  doi = {10.5300/1991-4/10},
}
\end{filecontents}

\usepackage[main=czech,english]{babel}
\usepackage[style=iso-numeric]{biblatex}
\addbibresource{main.bib}

\begin{document}

\selectlanguage{english}

\nocite{*}
\printbibliography

\end{document}

BibLaTeX_ISO_690__Switching_languages__MWE_

This becomes an issue in document classes such as csbulletin, where babel's main language is selected in the document class and the user can only switch the active language, not the main language. Is this an issue with biblatex-iso690, or should I take this issue upstream to plk/biblatex?

michal-h21 commented 3 years ago

Yes, we use the \mainlang macro provided by BibLaTeX, which switches to the main document language. I can see that this macro is deprecated, \textmainlang should be used instead. I expect that both of them use the main document language.

Witiko commented 3 years ago

@michal-h21 Perhaps we should be using just \bibstring instead of \mainlangbibstring? BibLaTeX documentation seems quite clear that the references should be localized according to the active surrounding language, not the main language.

michal-h21 commented 3 years ago

No, some fields should be printed in the main document language according to ISO 690. So for example pages should be printed as s. if your document is in Czech. But other strings should be in the language of the cited document, for example journal volume. The norm is quite explicit in this, so we had to make quite some effort to support this.

Witiko commented 3 years ago

@michal-h21 Oh, definitely! What you say is completely correct: If my document is in Czech, then I want some of the strings to be in Czech (such as "Dostupné z DOI") and some in the language of the cited document, as specified by the langid field. However, the BibLaTeX documentation claims that "the language of my document" should not be the main language of babel/polyglossia, but the active surrounding language:

By default biblatex automatically picks up the active surrounding language from the babel/polyglossia package (and fall back to English if babel/polyglossia is not available).

If you take a look at the MWE in the original post, then the active surrounding language is english, but the bibliography produced by biblatex-iso690 says "Dostupné z DOI" instead of "Available from DOI" as it should. This is because the main language of babel is czech and biblatex-iso690 uses the main language instead of the active surrounding language, which is english.

Witiko commented 3 years ago

@michal-h21 It seems that this issue exists both in BibLaTeX and in biblatex-iso690. @moewew just provided a patch for BibLaTeX in https://github.com/plk/biblatex/commit/933003cfcecf2ce81b946481849f292461ee6484.

michal-h21 commented 3 years ago

The discussion continued in the main BibLaTeX tracker. @moewew posted a great comment: https://github.com/plk/biblatex/issues/1108#issuecomment-797990911

I think it would be best to provide a new package option, so user can decide if \textmainlang or \textouterlang should be used. One issue we discussed in the thread is with footnotes. Maybe it will be best to left it to the user to select the correct language for footnotes. We probably should add a section about that to the documentation.

@moewew will be \textouterlang available in the BibLaTeX version shipped in TL 21?

moewew commented 3 years ago

@moewew will be \textouterlang available in the BibLaTeX version shipped in TL 21?

I don't think so. According to http://tug.org/texlive/ the currently planned CTAN update cut-off is 22 March. A combined biblatex+Biber release usually takes more than a week (sometimes even two to three weeks) until all binaries are built by the volunteers. Plus we haven't really amassed a whole lot of changes, so we aren't really 'due' for another biblatex release on that grounds.

I understand that this isn't ideal for biblatex-iso690. If you guard against \textouterlanguage being undefined you could already implement the option (for forward compatibility), but it would only be usable once biblatex v3.17 is released some time in the future.

michal-h21 commented 3 years ago

@moewew thanks. I've added a new option, currentlang, which will enable the use of currently selected language. It tests for existence of \textouterlanguage, so it should work with the future versions of BibLaTeX. The following example works (except for footnote) with the development version:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[main=czech,english,ngerman]{babel}
\usepackage[style=iso-numeric
  ,backref=true
  ,currentlang=true
]{biblatex}

\begin{filecontents}[force]{\jobname.bib}
@article{tex:zpravodajchlebikova91,
  author  = {Chlebíková, Jana},
  title   = {Ako rozděliť (slovo) Československo},
  journal = {Zpravodaj CSTUG},
  volume  = 1,
  number  = 4,
  year    = 1990,
  month   = {04},
  pages   = {10-13},
  doi     = {10.5300/1991-4/10},
  note    = {no laingid},
}
@article{tex:zpravodajchlebikova91cz,
  author  = {Chlebíková, Jana},
  title   = {Ako rozděliť (slovo) Československo},
  journal = {Zpravodaj CSTUG},
  volume  = 1,
  number  = 4,
  year    = 1991,
  month   = {04},
  pages   = {10-13},
  doi     = {10.5300/1991-4/10},
  langid  = {czech},
  note    = {Czech langid},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\nocite{*}
\printbibliography

\selectlanguage{english}
Hello\footfullcite{tex:zpravodajchlebikova91cz}
\printbibliography

\selectlanguage{ngerman}
\printbibliography
\end{document}
Luk164 commented 2 years ago

Is this issue going to be fixed anytime soon? By using this package in my project I am constantly getting a warning about \mainlang being deprecated. Also in the meanwhile, is there a workaround I could use?

michal-h21 commented 2 years ago

@Luk164 we use the new language selection commands, \textmainlang and \textouterlang in the development version, so we just need to release it on CTAN.

Luk164 commented 2 years ago

@michal-h21 Great! Are there any other things that you are waiting to be finished before releasing? Just so I can keep an eye out for any progress.

michal-h21 commented 2 years ago

I think @DavidLuptak is still working on some issues, but I think we will release a new version before TeX Live 2021 freeze, which I think will be on 22th of March.

DavidLuptak commented 2 years ago

I think we can close this issue for now.

Luk164 commented 2 years ago

@michal-h21 How is the release going? Is it gonna land today?

michal-h21 commented 2 years ago

@Luk164 we uploaded the update to CTAN yesterday, and it was already announced as updated by CTAN.

Luk164 commented 2 years ago

@Luk164 we uploaded the update to CTAN yesterday, and it was already announced as updated by CTAN.

My bad, I was checking github releases

michal-h21 commented 2 years ago

Ah, you are right. I've just made also a Github release.