xmllocalecsl

CSL: citation element localization problem


When creating in-text citations CSL doesn't take into account localized terms for different languages and uses et-al term in a single language whether it's specified or not in Zotero in the language field

this results in [Author [et al.], 2019] for 1 language and [Auteur [et al.], 2017] for another language. But et-al terms are localized for different languages:

<locale xml:lang="en">
    <terms>
      <term name="et-al">&#160;[et al.]</term>
</terms>
</locale>

<locale xml:lang="fr">
    <terms>
      <term name="et-al">&#160;(et al.)</term>
</terms>
</locale>
<macro name="author_short">
    <names variable="author">
      <name form="short" name-as-sort-order="all" sort-separator=" " delimiter=", " delimiter-precedes-last="always"/>
      <substitute>
        <text variable="title"/>
      </substitute>
    </names>
  </macro>

 <citation et-al-min="4" et-al-use-first="1" disambiguate-add-year-suffix="true" collapse="year" et-al-subsequent-use-first="1" disambiguate-add-names="false" disambiguate-add-givenname="false">
    <sort>
      <key macro="language-sort"/>
      <key macro="author-title"/>
      <key variable="issued"/>
    </sort>
    <layout prefix="[" suffix="]" delimiter="; " page-range-format="">
      <group delimiter=", ">
        <text macro="author_short" suffix=""/>
        <text macro="year-date"/> 

      </group>
      <choose>
        <if variable="locator">
          <label variable="locator" form="short" prefix=",&#160;" suffix="&#160;"/>
          <text variable="locator"/>
        </if>
      </choose>      
    </layout>
  </citation>

Solution

  • In CSL, the locale refers to the entire document/bibliography. It's not possible to have the localization of terms be determined by the bibliography item.

    Zotero, specifically, does support the csl-m variant of CSL, in which you can do this by specifying separate layouts for all supported languages, so:

    <macro name="citation">
      <group delimiter=", ">
        <text macro="author_short" suffix=""/>
        <text macro="year-date"/> 
      </group>
      <choose>
        <if variable="locator">
          <label variable="locator" form="short" prefix=",&#160;" suffix="&#160;"/>
          <text variable="locator"/>
        </if>
      </choose>   
    </macro>
     <citation et-al-min="4" et-al-use-first="1" disambiguate-add-year-suffix="true" collapse="year" et-al-subsequent-use-first="1" disambiguate-add-names="false" disambiguate-add-givenname="false">
        <sort>
          <key macro="language-sort"/>
          <key macro="author-title"/>
          <key variable="issued"/>
        </sort>
        <layout locale="en" prefix="[" suffix="]" delimiter="; " page-range-format="" >
          <text macro="citation"/>
        </layout>
        <layout locale="fr" prefix="[" suffix="]" delimiter="; " page-range-
          <text macro="citation"/>
        </layout>
      </citation>
    

    Do note that Zotero will warn you that the citation style is invalid on install and that it won't be accepted on the standard CSL repository.