From a65c5cd4e18359327f5beae3fd620f0834601e72 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 19 Oct 2007 15:52:59 +0000 Subject: [PATCH] Closes #726, Localize remaining hard-coded strings Not localizing 'Error initializing Zotero database' or bundle.js alerts -- they shouldn't happen except during development, and if they do it doesn't really matter if the user understands them. --- chrome/content/zotero/overlay.js | 14 +++++++++++++- chrome/content/zotero/overlay.xul | 11 ++++++++++- chrome/content/zotero/xpcom/schema.js | 2 +- chrome/locale/en-US/zotero/zotero.properties | 6 ++++++ defaults/preferences/zotero.js | 1 + install.rdf | 1 - 6 files changed, 31 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js index 2c8561edd..7743ed636 100644 --- a/chrome/content/zotero/overlay.js +++ b/chrome/content/zotero/overlay.js @@ -235,6 +235,19 @@ var ZoteroPane = new function() var errFunc = Zotero.startupErrorHandler; } + if (!errMsg) { + // Get the stringbundle manually + var src = 'chrome://zotero/locale/zotero.properties'; + var localeService = Components.classes['@mozilla.org/intl/nslocaleservice;1']. + getService(Components.interfaces.nsILocaleService); + var appLocale = localeService.getApplicationLocale(); + var stringBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"] + .getService(Components.interfaces.nsIStringBundleService); + var stringBundle = stringBundleService.createBundle(src, appLocale); + + var errMsg = stringBundle.GetStringFromName('startupError'); + } + if (errFunc) { errFunc(); } @@ -242,7 +255,6 @@ var ZoteroPane = new function() // TODO: Add a better error page/window here with reporting // instructions // window.loadURI('chrome://zotero/content/error.xul'); - // TODO: localize if possible alert(errMsg); } diff --git a/chrome/content/zotero/overlay.xul b/chrome/content/zotero/overlay.xul index ba438eb21..072542df1 100644 --- a/chrome/content/zotero/overlay.xul +++ b/chrome/content/zotero/overlay.xul @@ -385,7 +385,16 @@ // Use defaults if necessary if (!errMsg) { - var errMsg = 'There was an error starting Zotero.'; + // Get the stringbundle manually + var src = 'chrome://zotero/locale/zotero.properties'; + var localeService = Components.classes['@mozilla.org/intl/nslocaleservice;1']. + getService(Components.interfaces.nsILocaleService); + var appLocale = localeService.getApplicationLocale(); + var stringBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"] + .getService(Components.interfaces.nsIStringBundleService); + var stringBundle = stringBundleService.createBundle(src, appLocale); + + var errMsg = stringBundle.GetStringFromName('startupError'); } icon.setAttribute('tooltiptext', errMsg); diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js index a37f8e308..9f59335f5 100644 --- a/chrome/content/zotero/xpcom/schema.js +++ b/chrome/content/zotero/xpcom/schema.js @@ -511,7 +511,7 @@ Zotero.Schema = new function(){ Zotero.debug(e, 1); Components.utils.reportError(e); Zotero.DB.rollbackTransaction(); - alert('Error initializing Zotero database'); // TODO: localize + alert('Error initializing Zotero database'); throw(e); } } diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index a27d1fd4e..a1295cfb0 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -1,3 +1,5 @@ +extensions.zotero@chnm.gmu.edu.description = The Next-Generation Research Tool + general.error = Error general.warning = Warning general.dontShowWarningAgain = Don't show this warning again. @@ -44,6 +46,8 @@ dataDir.selectDir = Select a Zotero data directory dataDir.selectedDirNonEmpty.title = Directory Not Empty dataDir.selectedDirNonEmpty.text = The directory you selected is not empty and does not appear to be a Zotero data directory.\n\nCreate Zotero files in this directory anyway? +startupError = There was an error starting Zotero. + pane.collections.delete = Are you sure you want to delete the selected collection? pane.collections.deleteSearch = Are you sure you want to delete the selected search? pane.collections.newCollection = New Collection @@ -113,6 +117,8 @@ pane.item.changeType.text = Are you sure you want to change the item type?\n\nT pane.item.defaultFirstName = first pane.item.defaultLastName = last pane.item.defaultFullName = full name +pane.item.switchFieldMode.one = Switch to single field +pane.item.switchFieldMode.two = Switch to two fields pane.item.notes.untitled = Untitled Note pane.item.notes.delete.confirm = Are you sure you want to delete this note? pane.item.notes.count.zero = %S notes: diff --git a/defaults/preferences/zotero.js b/defaults/preferences/zotero.js index ad1c3b7aa..ab015c86b 100644 --- a/defaults/preferences/zotero.js +++ b/defaults/preferences/zotero.js @@ -1,6 +1,7 @@ // These are DEFAULT prefs for the INSTALL. You will have to reinstall the extension to see differences! pref("extensions.zotero.firstRun", true); +pref("extensions.zotero@chnm.gmu.edu.description", "chrome://zotero/locale/zotero.properties"); pref("extensions.zotero.useDataDir", false); pref("extensions.zotero.dataDir", ''); diff --git a/install.rdf b/install.rdf index 8fbb7e35f..e755693cc 100644 --- a/install.rdf +++ b/install.rdf @@ -7,7 +7,6 @@ zotero@chnm.gmu.edu Zotero 1.0.0rc4.SVN - The Next-Generation Research Tool Center for History and New Media
George Mason University
Dan Cohen Sean Takats