The depreciatete "for each" is used in JavaScript translator files

16 views
Skip to first unread message

Lennart Borgman

unread,
Jun 29, 2015, 10:01:50 AM6/29/15
to zoter...@googlegroups.com
The "for each" statement has been removed in ECMA-script: It does not even work in newer versions of Google Chrome, but is kept for backward compatibility in Firefox (for the moment):

The for each...in statement is deprecated as the part of ECMA-357 (E4X) standard.
for each...in - JavaScript | MDN https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for_each...in

However there are many Zotero translator files where this is used currently. I can't use those files if the "for each" are not replaced with something conformant with ECMA-script.

Fixing this is probably easy, in principle. Just replace

for each (variable in object) {
  statements
}

with

for (feKeyVariable in object) {
  variable = object[feKeyVariable];
  statements
}

Though I am not quite sure that this is exactly the needed feKeyVariable:s are exposed by JavaScript. Does anyone here know that?

And are there any plans to fix this in the translator repo?

Aurimas Vinckevicius

unread,
Jun 29, 2015, 10:08:25 AM6/29/15
to zoter...@googlegroups.com

This should already be taken care of. @zuphilip removed for-each here and in follow-up PRs https://github.com/zotero/translators/pull/896 Update your translators and try again. If you find something that we missed, do let us know.

Aurimas

--
You received this message because you are subscribed to the Google Groups "zotero-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zotero-dev+...@googlegroups.com.
To post to this group, send email to zoter...@googlegroups.com.
Visit this group at http://groups.google.com/group/zotero-dev.
For more options, visit https://groups.google.com/d/optout.

Lennart Borgman

unread,
Jun 29, 2015, 10:24:43 AM6/29/15
to zoter...@googlegroups.com
Ah, a big relief! Thanks, Aurimas. :-)

Lennart Borgman

unread,
Jun 29, 2015, 10:50:42 AM6/29/15
to zoter...@googlegroups.com
Could you please also rename Bibliothèque et Archives nationales du Québec.js and remove the non-ascii chars? It is a pain to deal with this on a Windows pc (since PHP etc does not get everything correct).​

Lennart Borgman

unread,
Jun 29, 2015, 11:54:03 AM6/29/15
to zoter...@googlegroups.com
National Library of Australia (new catalog).js redefines JSON. There is absolutely no need for that now. Please remove that.

Avram Lyon

unread,
Jun 29, 2015, 12:02:14 PM6/29/15
to zoter...@googlegroups.com

If you identify such issues with translators, please feel free to open a pull request into the repo- they are contributed and maintained by interested people like you.


Aurimas Vinckevicius

unread,
Jun 29, 2015, 12:06:38 PM6/29/15
to zoter...@googlegroups.com
In general, please start new threads for unrelated issues. Translator issues should be reported either to the forum or, if it's more technical and you're sure the issue is real, directly on GitHub (preferably in a form of a pull request).

https://github.com/zotero/translators/issues/459 I don't think we will be converting file names to ASCII in the git repo, but translator names are automatically ASCII-fied by the Zotero client (or they should be). 

Lennart Borgman

unread,
Jun 29, 2015, 12:23:15 PM6/29/15
to zoter...@googlegroups.com
Thanks Aurimas. I strongly disagree about the file names. Non-ascii file names are still just a pain.

I entered a comment on https://github.com/zotero/translators/issues/459.

Lennart Borgman

unread,
Jun 29, 2015, 12:26:54 PM6/29/15
to zoter...@googlegroups.com
Ok, thanks, Avram. I was just not sure were to report those issues (and they are very small and should be no-brainers - if the are fixed... ;-) )

The translators are found as part of different repos and it is a bit confusing.​
Reply all
Reply to author
Forward
0 new messages