Add optional second parameters params to Zotero.getString() to use the stringbundle's formatStringFromName method -- got rid of the silly replace() calls elsewhere in the code
Also localized the "tags" string in the tags tab -- addresses #155, Localize strings
This commit is contained in:
parent
79efa85482
commit
00d8fbd117
|
@ -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;
|
||||
]]>
|
||||
</body>
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user