understanding .setTranslator() method

Hi all.
I am pretty new to Zotero, and I have inherited the job of managing translators from the last person who wrote a number of website-specific translators.
I've been crawling this site to master the translators, and I'm currently tearing apart one translator to make sure I understand every line of it.
One thing that has come up: each translator has a translatorID in its metadata, and in the code, a variable was set with that value (var translatorID = "dfadsfadsfasdfdsfdaasdf";)
But then an object is created instantiating Zotero.loadTranslator("web")
and then the .setTranslator() method of the object has a completely different translatorID passed as the parameter.
On a hunch, I searched all the custom translators, and they all had this same ID passed in .setTranslator(). I found the translator that actually had the ID and it looked similar to the others but had lots of user-defined functions inside.
Then I looked at Washington Post translator and saw that it did a similar thing, .setTranslator() was fed an ID that was not the WP's ID. I searched all the repository translators and found over 100 also use the same ID in .setTranslator().
In those translators, it is generally commented as //Embedded data.
Can anybody shed light on this? I'm still in the getting my mind around this thing phase.
Thanks.
  • generally better to ask such questions on zotero-dev, but since this has a simple answer:
    translators can call up other translators which handle common, generic formats. In your case, that's the whole set of Embedded Metatadata that might be in a page header:
    https://github.com/zotero/translators/blob/master/Embedded Metadata.js

    In other cases that might be dedicated bibliographic metadata formats like MARC, RIS, or BibTeX.
    setTranslator has the ID of the translator that's being called up.
Sign In or Register to comment.