# Additive suffixing in \DeclareLanguageMappingSuffix #745

Open
opened this Issue May 20, 2018 · 7 comments

Projects
None yet
2 participants

### CarlOrff commented May 20, 2018 • edited

 The outcome of the MWE beneath, where a style first inherits from authoryear and then style second from first, is perfectly fine; all files (first.bbx, second.bbx, english-first.lbx, english-second.lbx) are loaded as expected. But it issues a warning that LaTeX does not find english-first-second.lbx. I am not sure wether this is bug or feature but I cannot imagine which purpose such a file should serve? \documentclass{article} \listfiles \begin{filecontents}{first.bbx} \RequireBibliographyStyle{authoryear}% \DeclareLanguageMappingSuffix{-first}% \end{filecontents} \begin{filecontents}{second.bbx} \RequireBibliographyStyle{first}% \DeclareLanguageMappingSuffix{-second}% \end{filecontents} \begin{filecontents}{english-first.lbx} \InheritBibliographyExtras{english} \InheritBibliographyStrings{english} \DeclareBibliographyStrings{% inherit = {english}, bibliography = {{FIRST}{FIRST}}, } \end{filecontents} \begin{filecontents}{english-second.lbx} \InheritBibliographyExtras{english-first} \InheritBibliographyStrings{english-first} \DeclareBibliographyStrings{% inherit = {english-first}, references = {{SECOND}{SECOND}}, } \end{filecontents} \usepackage[citestyle=authoryear,bibstyle=second]{biblatex} \addbibresource{biblatex-examples.bib} \begin{document} \autocite{angenendt}\\\bibname\\\refname \end{document}  The literal warning: Package biblatex Warning: File 'english-first-second.lbx' not found! (biblatex) Ignoring mapping 'english-first' -> 'english-first-se cond'. 
Collaborator

### moewew commented May 20, 2018

 Thank you for reporting this. At the moment I would say that this is intended behaviour. Or rather that your set-up is very unusual and that I'm prepared to accept whatever happens to it as intended behaviour. Two \DeclareLanguageMappingSuffix are already a bit dangerous, but I assume you are aware of the fact that the last such declaration wins. For the benefit of those coming here at a later date via their favourite search engine: #702 and the linked issues are relevant for background. As luck would have it there was a TeX.SX questions just a few days ago where the .lbx loading was discussed in detail: https://tex.stackexchange.com/q/432347/35864 The issue there is complicated by polyglossia, but the second part of my answer discusses .lbx inheritance in general.

Collaborator

### moewew commented May 20, 2018 • edited

 The current approach that language mappings are always followed has a few advantages. Language redirects like UKenglish.lbx work under a mapping without defining a special mapped file UKenglish-first.lbx. The file british-first.lbx alone is enough. british-second.lbx (with an inherit = {british}) not only inherits from british.lbx and english.lbx, but also from english-second.lbx. Files like british-second.lbx need not duplicate english-second.lbx while keeping a structure similar to all other .lbx files. I assumed this would keep the .lbx files more natural. But I realise now that one really has to understand how the mapping works to appreciate this. Maybe it would have been better not to follow any language mapping once the mapping has been resolved for one language. That would allow are more fine-grained control over the mappings in the .lbx files. In theory several inherit = {...}s are possible, so that would be OK. But then language redirects like UKenglish->british would have to be taken care of otherwise. You could clear the suffix in second-english.lbx to avoid further mapping steps like this \ProvidesFile{english-second.lbx} \let\blx@lng@suff\@empty \InheritBibliographyExtras{english-first} \InheritBibliographyStrings{english-first} \DeclareBibliographyStrings{% inherit = {english-first}, references = {{SECOND}{SECOND}}, } But this is low-level hacking and can't be guaranteed to work in future versions, should we have to revisit the .lbx loading again.
Collaborator

### moewew commented May 20, 2018

 Slight correction, because I discussed that with Ulrike a moment ago: Multiple inherit keywords are theoretically possible, but only the last one takes effect because it clears the strings before inheritance.

### CarlOrff commented May 20, 2018

 Thank you very much for your effort. I think I leave it to the advice for biblatex-archaeology users to ignore the respective warnings.
Collaborator

### moewew commented May 20, 2018

 I thought about demoting the warning to an error, it would mainly interest developers anyway, and end users normally can do little about these things. But then many people are starting to get involved in writing .lbx files, so it might help if these messages turn out to be more prominent. Plus the message might give users a heads up why something goes wrong later on. In a more usual set-up with only one \DeclareLanguageMappingSuffix{-apa} Package biblatex Warning: File 'czech-apa.lbx' not found! (biblatex) Ignoring mapping 'czech' -> 'czech-apa'.  is quite a useful hint for the reader that the contributed style has not provided a localisation file for her language and that things may turn out to have some rough edges here and there. I agree that the warning is unfortunate in your case, though. In the aftermath of the TeX.SX question linked above I have been discussing the current language mapping with Ulrike and have realised that the entire thing is a bit more opaque than I had hoped. I am open to discuss improvements to the language mapping and it would greatly help if style developers and users could share their expectations of the language loading. The pre-3.11 system worked well in most cases, but had some weird quirks in edge cases. It turned out that the code was ill-equipped to handle most of them and other situations worked only by sheer luck. The new system was easy to implement at the time, worked in my test cases and implements an overall behaviour that I was - and still am - happy to accept as not entirely stupid and maybe even reasonable.

### CarlOrff commented May 21, 2018

 Yes, the danger of people going blind was my reason for opening an issue. I have now included your fix.
Collaborator

### moewew commented May 21, 2018

 OK, but please remember that there is absolutely no guarantee that the workaround will continue to work as expected in future versions if it turns out that we have to change the .lbx loading again. So please check back if things work as they should when biblatex gets an update.