Unwanted change to "Language" field during import from .bib to Zotero.

I find that Zotero will change the text in 'Language' field from .bib during import. For example, the "language = {en}" in the .bib below:

@article{r1022,
author = {Ospppo, A},
title = {Corynebacterium-associated skin infections},
journal = {Ann Dermatol Venereol},
language = {en},
year = {2018},
volume = {145},
number = {3},
pages = {214-218},
}

the "Language" field will be changed to "english" in Zotero database after import, instead of "en" as in the .bib.

How can I prevent this unwanted change please? Can we edit the 'import filter'?

By the way, I installed the "Better BibTeX" plugin. But it does not provide a way to prevent the automatic unwanted change.

Appreciate any hints.

Miya
  • Not easily, no. I'm pretty sure BBT could be customized to do this with a hook, but let's maybe start with why you want this changed?
  • edited March 23, 2022
    Because csl uses locale xml:lang="en" , where the 'en' is to match Zotero's 'Language' field. Now Zotero changes the 'en' in .bib to 'english', which then does not match the setup in .csl styles, so cannot generate references properly.

    Is this a valid reason for hoping to keep the 'en' instead of 'english'?
  • Can you say more? CSL doesn't use the language field to match the locale. The only function CSL takes from the language field is to disable title casing if it doesn't start with en, which makes both english and en work.
  • edited March 24, 2022
    CSL can support multi-languages by using the 'Language' field, to get different styles for different languages, as show below (the angle brackets which can not show under this web page's settings, are replaced with *):

    default-locale="zh-CN"

    *locale*
    *terms*
    *term name="edition"*第%s版*/term*
    */terms*
    */locale*
    *locale xml:lang="en"*
    *terms*
    *term name="edition"*%s*/term*
    */terms*
    */locale*

    *bibliography et-al-min="99" et-al-use-first="3" entry-spacing="0"*
    *layout suffix="" locale="en"*
    *text macro="bib-entry-en"/*
    */layout*
    *layout suffix=""*
    *text macro="bib-entry-zh"/*
    */layout*
    */bibliography*

    So I want Zotero NOT to change the 'en' to 'english' during import.
  • Hi Adam (and other community members),

    Could you tell more about how Better BibTeX can keep the text in the 'Language' field in .bib during the import process, instead of being automatically changed by Zotero please?

    If without Better BibTeX, how can we set up Zotero itself not to change 'en' in .bib to 'english' in Zotero?

    Thanks all,

    Gary
  • edited March 26, 2022
    The language mapping is actually Better Bibtex-specific. If you don't use BBT, Zotero will import the language field as is. If you want to keep using BBT, you want to look at post-processing hook/script as described here: https://retorque.re/zotero-better-bibtex/exporting/scripting/

    If you post an issue to the BBT github with details of what you want, there's a good chance Emiliano will help you in more detail.
  • Hi Miya and community,

    I have a related question but in principle. What is the specification of the Language field in Bibtex?
    The conversion is an issue of course, but what I also see is a spectrum such as German, german, ger, ... which I would expect to be standardized as 'de', 'en', etc.

    Also where does Zotero fetch the bibtex-information from (which service, server) if entering an for example ISBN, does anyone know?

    In the mentioned refs (1+2), I don't find the answer.

    Refs:

    1: https://ctan.mirror.norbert-ruehl.de/biblio/bibtex/base/btxdoc.pdf
    2: http://texdoc.net/texmf-dist/doc/bibtex/tamethebeast/ttb_en.pdf
  • Also where does Zotero fetch the bibtex-information from (which service, server) if entering an for example ISBN, does anyone know?
    Zotero doesn't fetch bibtex information, it fetches metadata and stores it in Zotero's database (which you can then export as bibtex among other things). ISBN metadata is retrieved, in this order, from:
    1. The US Library of Congress
    2. The German K10+ federated catalog
    3. The French National Library
    4. Open Worldcat (which has significantly worse metadata than 1-3)

    For the language names in bibtex, I believe BBT uses languages as used in biblatex, which in turn uses babel/polyglossia (see 2.2.3 in the BibLaTeX guide). Zotero otoh recommends ISO two-latter codes. Any questions about BBT beyond that is likely better on the project github.

  • I'd be OK with leaving the language as-is on import, and adding language fields with the un-meddled-with value from the Zotero language field. Please open an issue on github for this.
  • Thanks @adamsmith : Correct, I meant metadata of course and yes, BBT is beyond this forum. So Zotero "recommends" ISO two-letter, interesting, how exactly?

    (see https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)

    Thanks @emilianoeheyns , but I did not fully understand that part "un-meddled-with value"?
    So you mean that the import stays, example: Import is "Eng" (whichever database) and then Zotero is converting for Export to two-letter, say "en" ?

    Also note:

    Reading: https://www.zotero.org/support/requested_features
    "Batch editing" Status: Tentatively scheduled for version 5.2
    Ticket: https://www.zotero.org/trac/ticket/364
    Inside ticket reads:

    Opened 16 years ago
    Last modified 12 years ago
    #364 new enhancement

    Regards
  • So Zotero "recommends" ISO two-letter, interesting, how exactly?
    Quite literally, as a recommendation in its documentation. No technical help/enforcement of any kind is currently used/provided and if they decide to standardize the field at some point, they'd likely need to script conversions anyway.
  • edited 8 days ago
    Thanks @emilianoeheyns , but I did not fully understand that part "un-meddled-with value"?
    So you mean that the import stays, example: Import is "Eng" (whichever database) and then Zotero is converting for Export to two-letter, say "en" ?
    It'd mean that whatever is in the language field during import will be written into the language field of Zotero as-is. Changing Eng to en is BBTs existing behavior.
Sign In or Register to comment.