zotero/zotero — pull request #223 by aurimasv (2013-01-14 06:50:11+00:00)
Title: Allow translators to define translator-specific hidden preferences.

This applies to several use-cases, but one of the more recent discussions is here: https://github.com/zotero/translators/pull/477

Translators can now include the following in the translator info header
```
hiddenPrefs: {
key: 'someTranslator',
prefs: { test: 'hello', myPref: null }},
```
(due to the way the header is currently parsed, it is important that the closing braces for both the `hiddenPrefs` and the `prefs` properties do not match `/}\s*?[\r\n]/`. i.e. they cannot end with new line)

Furthermore, the user can define these hidden properties in about:config under `extensions.zotero.translators`. E.g. with the above setup, you can define `extensions.zotero.translators.someTranslator.myPref` to be `bye`. The user-defined property takes precedence over the default.

From the translator, hidden preferences can be access using `Zotero.getPref("someProp")`. If the property is not defined for this translator, `undefined` is returned. Otherwise, user supplied value or the default value are returned.

E.g. for the above, `Zotero.getPref("test")` returns "hello" and `Zotero.getPref("myPref")` returns "bye".

I hope all the functions are in the right places. I will also commit any changes necessary to connectors/bookmarklet/translation server.

Hopefully I didn't miss anything