diff --git a/chrome/content/zotero/tools/csledit.js b/chrome/content/zotero/tools/csledit.js
index 1bcbc6a91..5234ec5aa 100644
--- a/chrome/content/zotero/tools/csledit.js
+++ b/chrome/content/zotero/tools/csledit.js
@@ -27,39 +27,32 @@ var Zotero_CSL_Editor = new function() {
this.init = init;
this.handleKeyPress = handleKeyPress;
this.loadCSL = loadCSL;
- this.generateBibliography = generateBibliography;
- this.refresh = refresh;
function init() {
- var cslList = document.getElementById('zotero-csl-list');
- if (cslList.getAttribute('initialized') == 'true') {
- if (currentStyle) {
- loadCSL(currentStyle);
- refresh();
- }
- return;
- }
+ Zotero.Styles.populateLocaleList(document.getElementById("locale-menu"));
- var rawDefaultStyle = Zotero.Prefs.get('export.quickCopy.setting');
- var defaultStyle = Zotero.QuickCopy.stripContentType(rawDefaultStyle);
+ var cslList = document.getElementById('zotero-csl-list');
+ cslList.removeAllItems();
+
+ var lastStyle = Zotero.Prefs.get('export.lastStyle');
var styles = Zotero.Styles.getAll();
var currentStyle = null;
- var listPos = 0;
for each(var style in styles) {
if (style.source) {
continue;
}
var item = cslList.appendItem(style.title, style.styleID);
- if (!currentStyle || defaultStyle == ('bibliography=' + style.styleID)) {
- currentStyle = style.styleID;
- cslList.selectedIndex = listPos;
+ if (!currentStyle && lastStyle == style.styleID) {
+ currentStyle = style;
+ cslList.selectedItem = item;
}
- listPos += 1;
}
+
if (currentStyle) {
- loadCSL(currentStyle);
- refresh();
+ // Call asynchronously, see note in Zotero.Styles
+ window.setTimeout(this.onStyleSelected.bind(this, currentStyle.styleID), 1);
}
+
var pageList = document.getElementById('zotero-csl-page-type');
var locators = Zotero.Cite.labels;
for each(var type in locators) {
@@ -69,13 +62,25 @@ var Zotero_CSL_Editor = new function() {
}
pageList.selectedIndex = 0;
- cslList.setAttribute('initialized', true);
}
- function refresh() {
- var editor = document.getElementById('zotero-csl-editor');
- generateBibliography(editor.value);
-
+
+ this.onStyleSelected = function(styleID) {
+ Zotero.Prefs.set('export.lastStyle', styleID);
+ let style = Zotero.Styles.get(styleID);
+ Zotero.Styles.updateLocaleList(
+ document.getElementById("locale-menu"),
+ style,
+ Zotero.Prefs.get('export.lastLocale')
+ );
+
+ loadCSL(style.styleID);
+ this.refresh();
}
+
+ this.refresh = function() {
+ this.generateBibliography(this.loadStyleFromEditor());
+ }
+
this.save = function() {
var editor = document.getElementById('zotero-csl-editor');
var style = editor.value;
@@ -120,20 +125,52 @@ var Zotero_CSL_Editor = new function() {
document.getElementById('zotero-csl-list').value = cslID;
}
+ this.loadStyleFromEditor = function() {
+ var styleObject;
+ try {
+ styleObject = new Zotero.Style(
+ document.getElementById('zotero-csl-editor').value
+ );
+ } catch(e) {
+ document.getElementById('zotero-csl-preview-box')
+ .contentDocument.documentElement.innerHTML = ''
+ + Zotero.getString('styles.editor.warning.parseError')
+ + '
' + e + '
';
+ throw e;
+ }
+
+ return styleObject;
+ }
- function generateBibliography(str) {
- var editor = document.getElementById('zotero-csl-editor')
+ this.onStyleModified = function(str) {
+ document.getElementById('zotero-csl-list').selectedIndex = -1;
+
+ let styleObject = this.loadStyleFromEditor();
+
+ Zotero.Styles.updateLocaleList(
+ document.getElementById("locale-menu"),
+ styleObject,
+ Zotero.Prefs.get('export.lastLocale')
+ );
+ Zotero_CSL_Editor.generateBibliography(styleObject);
+ }
+
+ this.generateBibliography = function(style) {
var iframe = document.getElementById('zotero-csl-preview-box');
var items = Zotero.getActiveZoteroPane().getSelectedItems();
if (items.length == 0) {
- iframe.contentDocument.documentElement.innerHTML = '' + Zotero.getString('styles.editor.warning.noItems') + '
';
+ iframe.contentDocument.documentElement.innerHTML =
+ ''
+ + Zotero.getString('styles.editor.warning.noItems')
+ + '
';
return;
}
- var styleObject, styleEngine;
+
+ var selectedLocale = document.getElementById("locale-menu").value;
+ var styleEngine;
try {
- styleObject = new Zotero.Style(str);
- styleEngine = styleObject.getCiteProc();
+ styleEngine = style.getCiteProc(style.locale || selectedLocale);
} catch(e) {
iframe.contentDocument.documentElement.innerHTML = '' + Zotero.getString('styles.editor.warning.parseError') + '
'+e+'
';
throw e;
diff --git a/chrome/content/zotero/tools/csledit.xul b/chrome/content/zotero/tools/csledit.xul
index f646d266f..a46192ac9 100644
--- a/chrome/content/zotero/tools/csledit.xul
+++ b/chrome/content/zotero/tools/csledit.xul
@@ -58,12 +58,13 @@
-
+
+
+ oncommand="Zotero_CSL_Editor.onStyleModified()"/>
diff --git a/chrome/content/zotero/tools/cslpreview.js b/chrome/content/zotero/tools/cslpreview.js
index fcc9828af..8ff06009d 100644
--- a/chrome/content/zotero/tools/cslpreview.js
+++ b/chrome/content/zotero/tools/cslpreview.js
@@ -30,7 +30,10 @@ var Zotero_CSL_Preview = new function() {
this.generateBibliography = generateBibliography;
function init() {
- //refresh();
+ var menulist = document.getElementById("locale-menu");
+
+ Zotero.Styles.populateLocaleList(menulist);
+ menulist.value = Zotero.Prefs.get('export.lastLocale');;
var iframe = document.getElementById('zotero-csl-preview-box');
iframe.contentDocument.documentElement.innerHTML = '' + Zotero.getString('styles.preview.instructions') + '
';
@@ -86,7 +89,9 @@ var Zotero_CSL_Preview = new function() {
Zotero.debug("CSL IGNORE: citation format is " + style.categories);
return '';
}
- var styleEngine = style.getCiteProc();
+
+ var locale = document.getElementById("locale-menu").value;
+ var styleEngine = style.getCiteProc(locale);
// Generate multiple citations
var citations = styleEngine.previewCitationCluster(
diff --git a/chrome/content/zotero/tools/cslpreview.xul b/chrome/content/zotero/tools/cslpreview.xul
index 0b984577a..3f60c1f04 100644
--- a/chrome/content/zotero/tools/cslpreview.xul
+++ b/chrome/content/zotero/tools/cslpreview.xul
@@ -56,6 +56,8 @@
+
+
diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js
index 3d92761a9..a6c6e7bdb 100644
--- a/chrome/content/zotero/xpcom/integration.js
+++ b/chrome/content/zotero/xpcom/integration.js
@@ -2039,7 +2039,7 @@ Zotero.Integration.Session.prototype.setData = function(data, resetStyle) {
try {
var getStyle = Zotero.Styles.get(data.style.styleID);
data.style.hasBibliography = getStyle.hasBibliography;
- this.style = getStyle.getCiteProc(data.prefs.automaticJournalAbbreviations);
+ this.style = getStyle.getCiteProc(data.locale, data.prefs.automaticJournalAbbreviations);
this.style.setOutputFormat("rtf");
this.styleClass = getStyle.class;
this.dateModified = new Object();
@@ -2069,6 +2069,7 @@ Zotero.Integration.Session.prototype.setDocPrefs = function(doc, primaryFieldTyp
if(this.data) {
io.style = this.data.style.styleID;
+ io.locale = this.data.locale;
io.useEndnotes = this.data.prefs.noteType == 0 ? 0 : this.data.prefs.noteType-1;
io.fieldType = this.data.prefs.fieldType;
io.primaryFieldType = primaryFieldType;
@@ -2091,13 +2092,19 @@ Zotero.Integration.Session.prototype.setDocPrefs = function(doc, primaryFieldTyp
var data = new Zotero.Integration.DocumentData();
data.sessionID = oldData.sessionID;
data.style.styleID = io.style;
+ data.locale = io.locale;
data.prefs.fieldType = io.fieldType;
data.prefs.storeReferences = io.storeReferences;
data.prefs.automaticJournalAbbreviations = io.automaticJournalAbbreviations;
+ var localeChanged = false;
+ if (!oldData.locale || (oldData.locale != io.locale)) {
+ localeChanged = true;
+ }
+
me.setData(data, oldData &&
- oldData.prefs.automaticJournalAbbreviations !=
- data.prefs.automaticJournalAbbreviations);
+ (oldData.prefs.automaticJournalAbbreviations !=
+ data.prefs.automaticJournalAbbreviations || localeChanged));
// need to do this after setting the data so that we know if it's a note style
me.data.prefs.noteType = me.style && me.styleClass == "note" ? io.useEndnotes+1 : 0;
diff --git a/chrome/content/zotero/xpcom/itemTreeView.js b/chrome/content/zotero/xpcom/itemTreeView.js
index 7aca01e2a..71078eb85 100644
--- a/chrome/content/zotero/xpcom/itemTreeView.js
+++ b/chrome/content/zotero/xpcom/itemTreeView.js
@@ -2670,12 +2670,12 @@ Zotero.ItemTreeView.prototype.onDragStart = function (event) {
event.dataTransfer.setData("text/plain", text);
}
+ format = Zotero.QuickCopy.unserializeSetting(format);
try {
- var [mode, ] = format.split('=');
- if (mode == 'export') {
+ if (format.mode == 'export') {
Zotero.QuickCopy.getContentFromItems(items, format, exportCallback);
}
- else if (mode.indexOf('bibliography') == 0) {
+ else if (format.mode == 'bibliography') {
var content = Zotero.QuickCopy.getContentFromItems(items, format, null, event.shiftKey);
if (content) {
if (content.html) {
@@ -2685,11 +2685,11 @@ Zotero.ItemTreeView.prototype.onDragStart = function (event) {
}
}
else {
- Components.utils.reportError("Invalid Quick Copy mode '" + mode + "'");
+ Components.utils.reportError("Invalid Quick Copy mode");
}
}
catch (e) {
- Components.utils.reportError(e + " with format '" + format + "'");
+ Components.utils.reportError(e + " with '" + format.id + "'");
}
}
diff --git a/chrome/content/zotero/xpcom/quickCopy.js b/chrome/content/zotero/xpcom/quickCopy.js
index 646d55ab1..8cc8c9fd8 100644
--- a/chrome/content/zotero/xpcom/quickCopy.js
+++ b/chrome/content/zotero/xpcom/quickCopy.js
@@ -25,27 +25,61 @@
Zotero.QuickCopy = new function() {
- this.getFormattedNameFromSetting = getFormattedNameFromSetting;
- this.getSettingFromFormattedName = getSettingFromFormattedName;
- this.getContentType = getContentType;
- this.stripContentType = stripContentType;
- this.getFormatFromURL = getFormatFromURL;
- this.getContentFromItems = getContentFromItems;
var _initialized = false;
var _formattedNames = {};
+ /*
+ * Return Quick Copy setting object from string, stringified object, or object
+ *
+ * Example string format: "bibliography/html=http://www.zotero.org/styles/apa"
+ *
+ * Quick Copy setting object has the following properties:
+ * - "mode": "bibliography" (for styles) or "export" (for export translators)
+ * - "contentType: "" (plain text output) or "html" (HTML output; for styles
+ * only)
+ * - "id": style ID or export translator ID
+ * - "locale": locale code (for styles only)
+ */
+ this.unserializeSetting = function (setting) {
+ var settingObject = {};
+
+ if (typeof setting === 'string') {
+ try {
+ // First test if string input is a stringified object
+ settingObject = JSON.parse(setting);
+ } catch (e) {
+ // Try parsing as formatted string
+ var parsedSetting = setting.match(/(bibliography|export)(?:\/([^=]+))?=(.+)$/);
+ if (parsedSetting) {
+ settingObject.mode = parsedSetting[1];
+ settingObject.contentType = parsedSetting[2] || '';
+ settingObject.id = parsedSetting[3];
+ settingObject.locale = '';
+ }
+ }
+ } else {
+ // Return input if not a string; it might already be an object
+ return setting;
+ }
+
+ return settingObject;
+ };
- function getFormattedNameFromSetting(setting) {
+
+ this.getFormattedNameFromSetting = function (setting) {
if (!_initialized) {
_init();
}
- var name = _formattedNames[this.stripContentType(setting)];
+ var format = this.unserializeSetting(setting);
+
+ var name = _formattedNames[format.mode + "=" + format.id];
return name ? name : '';
- }
+ };
- function getSettingFromFormattedName(name) {
+
+ this.getSettingFromFormattedName = function (name) {
if (!_initialized) {
_init();
}
@@ -57,56 +91,45 @@ Zotero.QuickCopy = new function() {
}
return '';
- }
+ };
- /*
- * Returns the setting with any contentType stripped from the mode part
- */
- function getContentType(setting) {
- var matches = setting.match(/(?:bibliography|export)\/([^=]+)=.+$/, '$1');
- return matches ? matches[1] : '';
- }
-
-
- /*
- * Returns the setting with any contentType stripped from the mode part
- */
- function stripContentType(setting) {
- return setting.replace(/(bibliography|export)(?:\/[^=]+)?=(.+)$/, '$1=$2');
- }
-
-
- function getFormatFromURL(url) {
+ this.getFormatFromURL = function(url) {
+ var quickCopyPref = Zotero.Prefs.get("export.quickCopy.setting");
+ quickCopyPref = JSON.stringify(this.unserializeSetting(quickCopyPref));
+
if (!url) {
- return Zotero.Prefs.get("export.quickCopy.setting");
+ return quickCopyPref;
}
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
- var nsIURI = ioService.newURI(url, null, null);
-
try {
+ var nsIURI = ioService.newURI(url, null, null);
+ // Accessing some properties may throw for URIs that do not support those
+ // parts. E.g. hostPort throws NS_ERROR_FAILURE for about:blank
var urlHostPort = nsIURI.hostPort;
var urlPath = nsIURI.path;
}
catch (e) {
- return Zotero.Prefs.get("export.quickCopy.setting");
+ return quickCopyPref;
}
+
var matches = [];
var sql = "SELECT key AS domainPath, value AS format FROM settings "
+ "WHERE setting='quickCopySite' AND (key LIKE ? OR key LIKE ?)";
var urlDomain = urlHostPort.match(/[^\.]+\.[^\.]+$/);
- var rows = Zotero.DB.query(sql, ['%' + urlDomain + '%', '/%']);
- for each(var row in rows) {
- var [domain, path] = row.domainPath.split(/\//);
- path = '/' + (path ? path : '');
- var re = new RegExp(domain + '$');
- if (urlHostPort.match(re) && urlPath.indexOf(path) == 0) {
+ var rows = Zotero.DB.query(sql, ['%' + urlDomain[0] + '%', '/%']);
+ for (let i = 0; i < rows.length; i++) {
+ let row = rows[i];
+ let domain = row.domainPath.split('/',1)[0];
+ let path = row.domainPath.substr(domain.length) || '/';
+ let re = new RegExp('(^|[./])' + Zotero.Utilities.quotemeta(domain) + '$', 'i');
+ if (re.test(urlHostPort) && urlPath.indexOf(path) === 0) {
matches.push({
- format: row.format,
+ format: JSON.stringify(this.unserializeSetting(row.format)),
domainLength: domain.length,
pathLength: path.length
});
@@ -130,15 +153,15 @@ Zotero.QuickCopy = new function() {
}
return -1;
- }
+ };
if (matches.length) {
matches.sort(sort);
return matches[0].format;
+ } else {
+ return quickCopyPref;
}
-
- return Zotero.Prefs.get("export.quickCopy.setting");
- }
+ };
/*
@@ -146,8 +169,9 @@ Zotero.QuickCopy = new function() {
*
* |items| is an array of Zotero.Item objects
*
- * |format| is a Quick Copy format string
- * (e.g. "bibliography=http://purl.org/net/xbiblio/csl/styles/apa.csl")
+ * |format| may be a Quick Copy format string
+ * (e.g. "bibliography=http://www.zotero.org/styles/apa")
+ * or an Quick Copy format object
*
* |callback| is only necessary if using an export format and should be
* a function suitable for Zotero.Translate.setHandler, taking parameters
@@ -157,25 +181,24 @@ Zotero.QuickCopy = new function() {
* If bibliography format, the process is synchronous and an object
* contain properties 'text' and 'html' is returned.
*/
- function getContentFromItems(items, format, callback, modified) {
+ this.getContentFromItems = function (items, format, callback, modified) {
if (items.length > Zotero.Prefs.get('export.quickCopy.dragLimit')) {
Zotero.debug("Skipping quick copy for " + items.length + " items");
return false;
}
- var [mode, format] = format.split('=');
- var [mode, contentType] = mode.split('/');
+ format = this.unserializeSetting(format);
- if (mode == 'export') {
+ if (format.mode == 'export') {
var translation = new Zotero.Translate.Export;
translation.noWait = true; // needed not to break drags
translation.setItems(items);
- translation.setTranslator(format);
+ translation.setTranslator(format.id);
translation.setHandler("done", callback);
translation.translate();
return true;
}
- else if (mode == 'bibliography') {
+ else if (format.mode == 'bibliography') {
// Move notes to separate array
var allNotes = true;
var notes = [];
@@ -320,32 +343,35 @@ Zotero.QuickCopy = new function() {
}
var content = {
- text: contentType == "html" ? html : text,
+ text: format.contentType == "html" ? html : text,
html: copyHTML
};
return content;
}
+ // determine locale preference
+ var locale = format.locale ? format.locale : Zotero.Prefs.get('export.quickCopy.locale');
+
// Copy citations if shift key pressed
if (modified) {
- var csl = Zotero.Styles.get(format).getCiteProc();
+ var csl = Zotero.Styles.get(format.id).getCiteProc(locale);
csl.updateItems([item.id for each(item in items)]);
var citation = {citationItems:[{id:item.id} for each(item in items)], properties:{}};
var html = csl.previewCitationCluster(citation, [], [], "html");
var text = csl.previewCitationCluster(citation, [], [], "text");
} else {
- var style = Zotero.Styles.get(format);
- var cslEngine = style.getCiteProc();
+ var style = Zotero.Styles.get(format.id);
+ var cslEngine = style.getCiteProc(locale);
var html = Zotero.Cite.makeFormattedBibliographyOrCitationList(cslEngine, items, "html");
var text = Zotero.Cite.makeFormattedBibliographyOrCitationList(cslEngine, items, "text");
}
- return {text:(contentType == "html" ? html : text), html:html};
+ return {text:(format.contentType == "html" ? html : text), html:html};
}
- throw ("Invalid mode '" + mode + "' in Zotero.QuickCopy.getContentFromItems()");
- }
+ throw ("Invalid mode '" + format.mode + "' in Zotero.QuickCopy.getContentFromItems()");
+ };
function _init() {
diff --git a/chrome/content/zotero/xpcom/style.js b/chrome/content/zotero/xpcom/style.js
index a1af74e28..367a6184f 100644
--- a/chrome/content/zotero/xpcom/style.js
+++ b/chrome/content/zotero/xpcom/style.js
@@ -44,11 +44,19 @@ Zotero.Styles = new function() {
this.ns = {
"csl":"http://purl.org/net/xbiblio/csl"
};
-
- // TEMP
- // Until we get asynchronous style loading, load renamed styles at startup, since the
- // synchronous call we were using breaks the first drag of the session (on OS X, at least)
+
this.preinit = function () {
+ // Upgrade style locale prefs for 4.0.27
+ var bibliographyLocale = Zotero.Prefs.get("export.bibliographyLocale");
+ if (bibliographyLocale) {
+ Zotero.Prefs.set("export.lastLocale", bibliographyLocale);
+ Zotero.Prefs.set("export.quickCopy.locale", bibliographyLocale);
+ Zotero.Prefs.clear("export.bibliographyLocale");
+ }
+
+ // TEMP
+ // Until we get asynchronous style loading, load renamed styles at startup, since the
+ // synchronous call we were using breaks the first drag of the session (on OS X, at least)
_renamedStyles = {};
Zotero.HTTP.promise(
"GET", "resource://zotero/schema/renamed-styles.json", { responseType: 'json' }
@@ -81,9 +89,33 @@ Zotero.Styles = new function() {
// hidden dir
dir.append("hidden");
- if(dir.exists()) i += _readStylesFromDirectory(dir, true);
+ if (dir.exists()) i += _readStylesFromDirectory(dir, true);
+
+ // Sort visible styles by title
+ _visibleStyles.sort(function(a, b) {
+ return a.title.localeCompare(b.title);
+ })
+ // .. and freeze, so they can be returned directly
+ _visibleStyles = Object.freeze(_visibleStyles);
Zotero.debug("Cached "+i+" styles in "+((new Date()).getTime() - start)+" ms");
+
+ // load available CSL locales
+ var localeFile = {};
+ var locales = {};
+ var primaryDialects = {};
+ var localesLocation = "chrome://zotero/content/locale/csl/locales.json";
+ localeFile = JSON.parse(Zotero.File.getContentsFromURL(localesLocation));
+
+ primaryDialects = localeFile["primary-dialects"];
+
+ // only keep localized language name
+ for (let locale in localeFile["language-names"]) {
+ locales[locale] = localeFile["language-names"][locale][0];
+ }
+
+ this.locales = locales;
+ this.primaryDialects = primaryDialects;
}
/**
@@ -128,6 +160,7 @@ Zotero.Styles = new function() {
}
i++;
}
+
return i;
}
@@ -156,11 +189,11 @@ Zotero.Styles = new function() {
/**
* Gets all visible styles
- * @return {Zotero.Style[]} An array of Zotero.Style objects
+ * @return {Zotero.Style[]} An immutable array of Zotero.Style objects
*/
this.getVisible = function() {
if(!_initialized || !_cacheTranslatorData) this.init();
- return _visibleStyles.slice(0);
+ return _visibleStyles; // Immutable
}
/**
@@ -399,6 +432,97 @@ Zotero.Styles = new function() {
}
});
}
+
+ /**
+ * Populate menulist with locales
+ *
+ * @param {xul:menulist} menulist
+ */
+ this.populateLocaleList = function(menulist) {
+ if(!_initialized) this.init();
+
+ // Reset menulist
+ menulist.selectedItem = null;
+ menulist.removeAllItems();
+
+ let fallbackLocale = Zotero.Styles.primaryDialects[Zotero.locale]
+ || Zotero.locale;
+
+ let menuLocales = Zotero.Utilities.deepCopy(Zotero.Styles.locales);
+ let menuLocalesKeys = Object.keys(menuLocales).sort();
+
+ // Make sure that client locale is always available as a choice
+ if (fallbackLocale && !(fallbackLocale in menuLocales)) {
+ menuLocales[fallbackLocale] = fallbackLocale;
+ menuLocalesKeys.unshift(fallbackLocale);
+ }
+
+ for (let i=0; i
- *
- * Certain entities can be inserted manually:
- * <ZOTEROBREAK/> => <br/>
- * <ZOTEROHELLIP/> => …
- * @type String
+ * Encode special XML/HTML characters
+ * Certain entities can be inserted manually:
+ * =>
+ * => …
+ *
+ * @param {String} str
+ * @return {String}
*/
- "htmlSpecialChars":function(/**String*/ str) {
- if (typeof str != 'string') str = str.toString();
-
- if (!str) {
- return '';
+ "htmlSpecialChars":function(str) {
+ if (str && typeof str != 'string') {
+ str = str.toString();
}
+ if (!str) return '';
+
return str
.replace(/&/g, '&')
.replace(/"/g, '"')
diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js
index bdc57bfc2..5fb81aa90 100644
--- a/chrome/content/zotero/zoteroPane.js
+++ b/chrome/content/zotero/zoteroPane.js
@@ -1866,24 +1866,27 @@ var ZoteroPane = new function()
}
var url = (window.content && window.content.location ? window.content.location.href : null);
- var [mode, format] = Zotero.QuickCopy.getFormatFromURL(url).split('=');
- var [mode, contentType] = mode.split('/');
+ var format = Zotero.QuickCopy.getFormatFromURL(url);
+ format = Zotero.QuickCopy.unserializeSetting(format);
- if (mode == 'bibliography') {
+ // determine locale preference
+ var locale = format.locale ? format.locale : Zotero.Prefs.get('export.quickCopy.locale');
+
+ if (format.mode == 'bibliography') {
if (asCitations) {
- Zotero_File_Interface.copyCitationToClipboard(items, format, contentType == 'html');
+ Zotero_File_Interface.copyCitationToClipboard(items, format.id, locale, format.contentType == 'html');
}
else {
- Zotero_File_Interface.copyItemsToClipboard(items, format, contentType == 'html');
+ Zotero_File_Interface.copyItemsToClipboard(items, format.id, locale, format.contentType == 'html');
}
}
- else if (mode == 'export') {
+ else if (format.mode == 'export') {
// Copy citations doesn't work in export mode
if (asCitations) {
return;
}
else {
- Zotero_File_Interface.exportItemsToClipboard(items, format);
+ Zotero_File_Interface.exportItemsToClipboard(items, format.id);
}
}
}
diff --git a/chrome/locale/en-US/zotero/preferences.dtd b/chrome/locale/en-US/zotero/preferences.dtd
index 4206ab2c3..8f2e992d2 100644
--- a/chrome/locale/en-US/zotero/preferences.dtd
+++ b/chrome/locale/en-US/zotero/preferences.dtd
@@ -107,6 +107,7 @@
+
diff --git a/chrome/locale/en-US/zotero/zotero.dtd b/chrome/locale/en-US/zotero/zotero.dtd
index 19f40477f..f29ddfc0f 100644
--- a/chrome/locale/en-US/zotero/zotero.dtd
+++ b/chrome/locale/en-US/zotero/zotero.dtd
@@ -165,6 +165,7 @@
+
diff --git a/defaults/preferences/zotero.js b/defaults/preferences/zotero.js
index c49ee66df..0aa2ba5ac 100644
--- a/defaults/preferences/zotero.js
+++ b/defaults/preferences/zotero.js
@@ -99,7 +99,6 @@ pref("extensions.zotero.export.lastTranslator", '14763d24-8ba0-45df-8f52-b8d1108
pref("extensions.zotero.export.translatorSettings", 'true,false');
pref("extensions.zotero.export.lastStyle", 'http://www.zotero.org/styles/chicago-note-bibliography');
pref("extensions.zotero.export.bibliographySettings", 'save-as-rtf');
-pref("extensions.zotero.export.bibliographyLocale", '');
pref("extensions.zotero.export.displayCharsetOption", false);
pref("extensions.zotero.export.citePaperJournalArticleURL", false);
pref("extensions.zotero.cite.automaticJournalAbbreviations", true);