diff --git a/chrome/content/zotero/bindings/tagsbox.xml b/chrome/content/zotero/bindings/tagsbox.xml index 200bbe576..5f20cf317 100644 --- a/chrome/content/zotero/bindings/tagsbox.xml +++ b/chrome/content/zotero/bindings/tagsbox.xml @@ -200,7 +200,8 @@ count = 0; } - this.id('tagsNum').value = count + ' tags:'; + this.id('tagsNum').value = + Zotero.getString('pane.item.tags.count.' + (count != 1 ? "plural" : "singular"), [count]) + ":"; this.count = count; ]]> diff --git a/chrome/content/zotero/itemPane.js b/chrome/content/zotero/itemPane.js index 89de2d968..e98bb4f7d 100644 --- a/chrome/content/zotero/itemPane.js +++ b/chrome/content/zotero/itemPane.js @@ -1202,14 +1202,14 @@ var ZoteroItemPane = new function() { var c = _notesList.childNodes.length; - _notesLabel.value = Zotero.getString('pane.item.notes.count.'+(c != 1 ? "plural" : "singular")).replace('%1',c) + ":"; + _notesLabel.value = Zotero.getString('pane.item.notes.count.'+(c != 1 ? "plural" : "singular"), [c]) + ":"; } function _updateAttachmentCount() { var c = _attachmentsList.childNodes.length; - _attachmentsLabel.value = Zotero.getString('pane.item.attachments.count.'+(c != 1 ? "plural" : "singular")).replace('%1',c) + ":"; + _attachmentsLabel.value = Zotero.getString('pane.item.attachments.count.'+(c != 1 ? "plural" : "singular"), [c]) + ":"; } function removeAttachment(id) diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js index 335adc460..1c9859a1f 100644 --- a/chrome/content/zotero/overlay.js +++ b/chrome/content/zotero/overlay.js @@ -364,7 +364,7 @@ var ZoteroPane = new function() var label = document.getElementById('zotero-view-selected-label'); if(itemsView && itemsView.selection.count) - label.value = Zotero.getString('pane.item.selected.multiple').replace('%1', itemsView.selection.count); + label.value = Zotero.getString('pane.item.selected.multiple', itemsView.selection.count); else label.value = Zotero.getString('pane.item.selected.zero'); } diff --git a/chrome/content/zotero/xpcom/db.js b/chrome/content/zotero/xpcom/db.js index 6a2534469..2a03bf069 100644 --- a/chrome/content/zotero/xpcom/db.js +++ b/chrome/content/zotero/xpcom/db.js @@ -552,9 +552,10 @@ Zotero.DB = new function(){ file.append(ZOTERO_CONFIG['DB_FILE']); _connection = store.openDatabase(file); Zotero.debug('Database restored', 1); - var msg = Zotero.getString('db.dbRestored'); - msg = msg.replace('%1', Zotero.Date.getFileDateString(backupFile)) - msg = msg.replace('%2', Zotero.Date.getFileTimeString(backupFile)) + var msg = Zotero.getString('db.dbRestored', [ + Zotero.Date.getFileDateString(backupFile), + Zotero.Date.getFileTimeString(backupFile) + ]); alert(msg); break catchBlock; diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index c874cce9a..83d4298be 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -311,11 +311,20 @@ var Zotero = new function(){ } - function getString(name){ + function getString(name, params){ try { - var l10n = _localizedStringBundle.GetStringFromName(name); + if (params){ + if (typeof params != 'object'){ + params = [params]; + } + var l10n = _localizedStringBundle.formatStringFromName(name, params, params.length); + } + else { + var l10n = _localizedStringBundle.GetStringFromName(name); + } } catch (e){ + Zotero.debug(e); throw ('Localized string not available for ' + name); } return l10n; diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index 670f7fdd7..4efe02899 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -19,7 +19,7 @@ pane.items.menu.createBib = Create Bibliography from Selected Item... pane.items.menu.createBib.multiple = Create Bibliography from Selected Items... pane.item.selected.zero = No items selected -pane.item.selected.multiple = %1 items selected +pane.item.selected.multiple = %s items selected pane.item.changeType = Are you sure you want to change the item type? Certain fields may be lost. pane.item.defaultFirstName = first @@ -27,15 +27,17 @@ pane.item.defaultLastName = last pane.item.defaultFullName = full name pane.item.notes.untitled = Untitled Note pane.item.notes.delete.confirm = Are you sure you want to delete this note? -pane.item.notes.count.singular = %1 note -pane.item.notes.count.plural = %1 notes +pane.item.notes.count.singular = %s note +pane.item.notes.count.plural = %s notes pane.item.attachments.view.link = View Page pane.item.attachments.view.snapshot = View Snapshot pane.item.attachments.view.file = View File pane.item.attachments.delete.confirm = Are you sure you want to delete this attachment? -pane.item.attachments.count.singular = %1 attachment -pane.item.attachments.count.plural = %1 attachments +pane.item.attachments.count.singular = %s attachment +pane.item.attachments.count.plural = %s attachments pane.item.attachments.select = Select a File +pane.item.tags.count.singular = %s tag +pane.item.tags.count.plural = %s tags itemTypes.note = Note itemTypes.attachment = Attachment @@ -107,7 +109,7 @@ itemFields.legislativeBody = Legislative Body itemFields.history = History itemFields.reporter = Reporter itemFields.court = Court -itemFields.numberOfVolumes = Number of Volumes +itemFields.numberOfVolumes = # of Volumes itemFields.committee = Committee itemFields.assignee = Assignee itemFields.patentNumber = Patent Number @@ -175,7 +177,7 @@ ingester.scrapeError = Could Not Save Item. ingester.scrapeErrorDescription = An error occurred while saving this item. Please try again. If this error persists, contact the translator author. db.dbCorruptedNoBackup = The Zotero database appears to have become corrupted, and no automatic backup is available.\n\nA new database file has been created. The damaged file was saved in your Zotero directory. -db.dbRestored = The Zotero database appears to have become corrupted.\n\nYour data was restored from the last automatic backup made on %1 at %2. The damaged file was saved in your Zotero directory. +db.dbRestored = The Zotero database appears to have become corrupted.\n\nYour data was restored from the last automatic backup made on %1$s at %2$s. The damaged file was saved in your Zotero directory. db.dbRestoreFailed = The Zotero database appears to have become corrupted, and an attempt to restore from the last automatic backup failed.\n\nA new database file has been created. The damaged file was saved in your Zotero directory. zotero.preferences.status.positionChange = Position change will take effect in new windows only