CSL Discourse

More flexible editortranslator behavior?


The editortranslator behavior is elegant, but leads to some problems. For example, in APA style, an edited book with a translator should be cited as:
Editor, A. A. (Ed.). (Year). Title of book. (A. A. Translator, trans.). Place: Publisher.

If the editor and translator are the same person:
Editor, A. A. (Ed. & Trans.). (Year). Title of book. Place: Publisher.

Handling both of these cases isn’t possible. If variable="editor translator" is used, the first reference will yield:
Editor, A. A. (Ed.), & Translator, A. A. (Trans.). (Year). Title of book. Place: Publisher.

This is unfortunate, but not sure if it is common enough to bother addressing. If the issue is to be addressed, I think the simplest solution would to adopt editortranslator as an explicitly callable variable (with the variable still being automatically generated as currently). Then, the current style coding variable="editor translator" could be replaced with variable="editor editortranslator" meaning “editor, including the editortranslator label if necessary”.


I don’t like the “editor editortranslator” special case, because if it were a real variable, you would already be able to do it explicitly with if variable="editortranslator", without special-casing it. Otherwise it seems ok.


I agree in principle, but the “editor translator” structure is very common in styles, so there is merit in considering the easiest way to implement any changes.


I think you said yourself that this might not be common enough to bother addressing? That doesn’t sound like it calls for shifting the burden to developers in a non-extensible and non-uniform way. Keeping in line with existing patterns is better for people trying to use it as well. If you saw the special case in the wild you would have to look up the spec to work out what it means — it deviates from the way name variables work, and it does so it in a subtly different way from how the original “editortranslator” collapse works with terms. With the “if” approach, there is no new syntax, no new behaviour, and you don’t need to look up anything. So “shifting the burden” as I described it is inaccurate; you would just be creating burdens all round.


So there’s twofold question, right?

  1. Is this important enough to address and
  2. If the answer is yes, then how

I’m a bit skeptical about 1.) – so far we have one fairly rare case in APA, as most items that have a translator have an author so this isn’t relevant and current behavior works.

But if the answer is yes, then I think Cormac is right: just treating editortranslator as a variable would be sufficient.

<if variable="editortranslator">
  <names variable="editor translator">
<label form="short"/>
<names variable="editor">


The biggest reason the current behavior is problematic is because it requires editor and translator to be in the same part of the reference in order for the collapse to work. In APA, unless the editor and translator are the same person, they go in different locations.


But they only go in different places if there is no author, right?
For books with author it’s
Author, A. A. (Year). Title of Book. (E. E. Editor, ed. & T. T. Translator, trans.). Place: Publisher.
That’s why I think it’s rare. I’m not saying this doesn’t exist, but most of the time if you’re going to have a translator you’ll have an author.


That’s right for a book, but for a chapter, I’m not sure this is so uncommon:

Author, A. (Year). Title. (A. Translator, Trans.). In A. Editor (Ed.), Book title. https://doi.org/12345


Would another way to handle this be to add an attribute to cs:names? I’m not good at naming things, but maybe something like this?

<names variable="editor translator" delimiter=", " require-match="true">
  <name name-as-sort-order="first" initialize-with=". "/>
  <label form="short" prefix=" (" suffix=")"/>
    <names variable="editor"/>


Frank’s solution would work well, I think.

In the event an item has both an editor and a different translator, in APA it should be formatted as:
Editor, A. (Ed.) (1990) A book title (B. Translator, Trans.).

With the require-match argument used as Frank does above, there would need to be a way to avoid printing the Translator twice if editortranslator is present, that is, not:
Editor, A. (Ed. & Trans.) (1990) A book title (A. Editor, Trans.).

Editor, A. (Ed. & Trans.) (1990) A book title.

If require-match invoked the same suppression mechanism as substitute, that would work.


I spent some time exploring this yesterday, and I have it working in citeproc-js. I hadn’t looked at my substitution code in a long, long time, and it was quite an experience. Success in the end, though.

In the process, I uncovered a bug in current citeproc-js. When a name var is rendered by substitution, then later called by a top-level cs:names, a name substituted for the suppressed var does not render its term label. This seems like it must be common, and may have been reported before. Fix now forthcoming.

(Edit: Available to play around with in the current citeproc-js release.)